264
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
|
2 <HTML
|
|
3 ><HEAD
|
|
4 ><TITLE
|
|
5 >Assembler Modes and Pragmas</TITLE
|
|
6 ><META
|
|
7 NAME="GENERATOR"
|
|
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
|
9 REL="HOME"
|
|
10 TITLE="LW Tool Chain"
|
|
11 HREF="index.html"><LINK
|
|
12 REL="UP"
|
|
13 TITLE="LWASM"
|
|
14 HREF="c43.html"><LINK
|
|
15 REL="PREVIOUS"
|
|
16 TITLE="Object Files and Sections"
|
|
17 HREF="x498.html"><LINK
|
|
18 REL="NEXT"
|
|
19 TITLE="LWLINK"
|
|
20 HREF="c607.html"></HEAD
|
|
21 ><BODY
|
|
22 CLASS="SECTION"
|
|
23 BGCOLOR="#FFFFFF"
|
|
24 TEXT="#000000"
|
|
25 LINK="#0000FF"
|
|
26 VLINK="#840084"
|
|
27 ALINK="#0000FF"
|
|
28 ><DIV
|
|
29 CLASS="NAVHEADER"
|
|
30 ><TABLE
|
|
31 SUMMARY="Header navigation table"
|
|
32 WIDTH="100%"
|
|
33 BORDER="0"
|
|
34 CELLPADDING="0"
|
|
35 CELLSPACING="0"
|
|
36 ><TR
|
|
37 ><TH
|
|
38 COLSPAN="3"
|
|
39 ALIGN="center"
|
|
40 >LW Tool Chain</TH
|
|
41 ></TR
|
|
42 ><TR
|
|
43 ><TD
|
|
44 WIDTH="10%"
|
|
45 ALIGN="left"
|
|
46 VALIGN="bottom"
|
|
47 ><A
|
|
48 HREF="x498.html"
|
|
49 ACCESSKEY="P"
|
|
50 >Prev</A
|
|
51 ></TD
|
|
52 ><TD
|
|
53 WIDTH="80%"
|
|
54 ALIGN="center"
|
|
55 VALIGN="bottom"
|
|
56 >Chapter 3. LWASM</TD
|
|
57 ><TD
|
|
58 WIDTH="10%"
|
|
59 ALIGN="right"
|
|
60 VALIGN="bottom"
|
|
61 ><A
|
|
62 HREF="c607.html"
|
|
63 ACCESSKEY="N"
|
|
64 >Next</A
|
|
65 ></TD
|
|
66 ></TR
|
|
67 ></TABLE
|
|
68 ><HR
|
|
69 ALIGN="LEFT"
|
|
70 WIDTH="100%"></DIV
|
|
71 ><DIV
|
|
72 CLASS="SECTION"
|
|
73 ><H1
|
|
74 CLASS="SECTION"
|
|
75 ><A
|
|
76 NAME="AEN562"
|
|
77 >3.10. Assembler Modes and Pragmas</A
|
|
78 ></H1
|
|
79 ><P
|
|
80 >There are a number of options that affect the way assembly is performed.
|
|
81 Some of these options can only be specified on the command line because
|
|
82 they determine something absolute about the assembly process. These include
|
|
83 such things as the output target. Other things may be switchable during
|
|
84 the assembly process. These are known as pragmas and are, by definition,
|
|
85 not portable between assemblers.</P
|
|
86 ><P
|
|
87 >LWASM supports a number of pragmas that affect code generation or
|
|
88 otherwise affect the behaviour of the assembler. These may be specified by
|
|
89 way of a command line option or by assembler directives. The directives
|
|
90 are as follows.</P
|
|
91 ><P
|
|
92 ></P
|
|
93 ><DIV
|
|
94 CLASS="VARIABLELIST"
|
|
95 ><DL
|
|
96 ><DT
|
|
97 >PRAGMA <CODE
|
|
98 CLASS="PARAMETER"
|
|
99 >pragma[,...]</CODE
|
|
100 ></DT
|
|
101 ><DD
|
|
102 ><P
|
|
103 >Specifies that the assembler should bring into force all <CODE
|
|
104 CLASS="PARAMETER"
|
|
105 >pragma</CODE
|
|
106 >s
|
|
107 specified. Any unrecognized pragma will cause an assembly error. The new
|
|
108 pragmas will take effect immediately. This directive should be used when
|
|
109 the program will assemble incorrectly if the pragma is ignored or not supported.</P
|
|
110 ></DD
|
|
111 ><DT
|
|
112 >*PRAGMA <CODE
|
|
113 CLASS="PARAMETER"
|
|
114 >pragma[,...]</CODE
|
|
115 ></DT
|
|
116 ><DD
|
|
117 ><P
|
|
118 >This is identical to the PRAGMA directive except no error will occur with
|
|
119 unrecognized or unsupported pragmas. This directive, by virtue of starting
|
|
120 with a comment character, will also be ignored by assemblers that do not
|
|
121 support this directive. Use this variation if the pragma is not required
|
|
122 for correct functioning of the code.</P
|
|
123 ></DD
|
|
124 ></DL
|
|
125 ></DIV
|
|
126 ><P
|
|
127 >Each pragma supported has a positive version and a negative version.
|
|
128 The positive version enables the pragma while the negative version disables
|
|
129 it. The negatitve version is simply the positive version with "no" prefixed
|
|
130 to it. For instance, "pragma" vs. "nopragma". Only the positive version is
|
|
131 listed below.</P
|
|
132 ><P
|
|
133 >Pragmas are not case sensitive.</P
|
|
134 ><P
|
|
135 ></P
|
|
136 ><DIV
|
|
137 CLASS="VARIABLELIST"
|
|
138 ><DL
|
|
139 ><DT
|
|
140 >index0tonone</DT
|
|
141 ><DD
|
|
142 ><P
|
|
143 >When in force, this pragma enables an optimization affecting indexed addressing
|
|
144 modes. When the offset expression in an indexed mode evaluates to zero but is
|
|
145 not explicity written as 0, this will replace the operand with the equivalent
|
|
146 no offset mode, thus creating slightly faster code. Because of the advantages
|
|
147 of this optimization, it is enabled by default.</P
|
|
148 ></DD
|
|
149 ><DT
|
|
150 >cescapes</DT
|
|
151 ><DD
|
|
152 ><P
|
|
153 >This pragma will cause strings in the FCC, FCS, and FCN pseudo operations to
|
|
154 have C-style escape sequences interpreted. The one departure from the official
|
|
155 spec is that unrecognized escape sequences will return either the character
|
|
156 immediately following the backslash or some undefined value. Do not rely
|
|
157 on the behaviour of undefined escape sequences.</P
|
|
158 ></DD
|
|
159 ><DT
|
|
160 >importundefexport</DT
|
|
161 ><DD
|
|
162 ><P
|
|
163 >This pragma is only valid for targets that support external references. When
|
|
164 in force, it will cause the EXPORT directive to act as IMPORT if the symbol
|
|
165 to be exported is not defined. This is provided for compatibility with the
|
|
166 output of gcc6809 and should not be used in hand written code. Because of
|
|
167 the confusion this pragma can cause, it is disabled by default.</P
|
|
168 ></DD
|
|
169 ><DT
|
|
170 >undefextern</DT
|
|
171 ><DD
|
|
172 ><P
|
|
173 >This pragma is only valid for targets that support external references. When in
|
|
174 force, if the assembler sees an undefined symbol on the second pass, it will
|
|
175 automatically define it as an external symbol. This automatic definition will
|
|
176 apply for the remainder of the assembly process, even if the pragma is
|
|
177 subsequently turned off. Because this behaviour would be potentially surprising,
|
|
178 this pragma defaults to off.</P
|
|
179 ><P
|
|
180 >The primary use for this pragma is for projects that share a large number of
|
|
181 symbols between source files. In such cases, it is impractical to enumerate
|
|
182 all the external references in every source file. This allows the assembler
|
|
183 and linker to do the heavy lifting while not preventing a particular source
|
|
184 module from defining a local symbol of the same name as an external symbol
|
|
185 if it does not need the external symbol. (This pragma will not cause an
|
|
186 automatic external definition if there is already a locally defined symbol.)</P
|
|
187 ><P
|
|
188 >This pragma will often be specified on the command line for large projects.
|
|
189 However, depending on the specific dynamics of the project, it may be sufficient
|
|
190 for one or two files to use this pragma internally.</P
|
|
191 ></DD
|
|
192 ><DT
|
|
193 >dollarlocal</DT
|
|
194 ><DD
|
|
195 ><P
|
|
196 >When set, a "$" in a symbol makes it local. When not set, "$" does not
|
|
197 cause a symbol to be local. It is set by default except when using the OS9
|
|
198 target.</P
|
|
199 ></DD
|
|
200 ><DT
|
|
201 >dollarnotlocal</DT
|
|
202 ><DD
|
|
203 ><P
|
|
204 > This is the same as the "dollarlocal" pragma except its sense is
|
|
205 reversed. That is, "dollarlocal" and "nodollarnotlocal" are equivalent and
|
|
206 "nodollarlocal" and "dollarnotlocal" are equivalent. </P
|
|
207 ></DD
|
|
208 ></DL
|
|
209 ></DIV
|
|
210 ></DIV
|
|
211 ><DIV
|
|
212 CLASS="NAVFOOTER"
|
|
213 ><HR
|
|
214 ALIGN="LEFT"
|
|
215 WIDTH="100%"><TABLE
|
|
216 SUMMARY="Footer navigation table"
|
|
217 WIDTH="100%"
|
|
218 BORDER="0"
|
|
219 CELLPADDING="0"
|
|
220 CELLSPACING="0"
|
|
221 ><TR
|
|
222 ><TD
|
|
223 WIDTH="33%"
|
|
224 ALIGN="left"
|
|
225 VALIGN="top"
|
|
226 ><A
|
|
227 HREF="x498.html"
|
|
228 ACCESSKEY="P"
|
|
229 >Prev</A
|
|
230 ></TD
|
|
231 ><TD
|
|
232 WIDTH="34%"
|
|
233 ALIGN="center"
|
|
234 VALIGN="top"
|
|
235 ><A
|
|
236 HREF="index.html"
|
|
237 ACCESSKEY="H"
|
|
238 >Home</A
|
|
239 ></TD
|
|
240 ><TD
|
|
241 WIDTH="33%"
|
|
242 ALIGN="right"
|
|
243 VALIGN="top"
|
|
244 ><A
|
|
245 HREF="c607.html"
|
|
246 ACCESSKEY="N"
|
|
247 >Next</A
|
|
248 ></TD
|
|
249 ></TR
|
|
250 ><TR
|
|
251 ><TD
|
|
252 WIDTH="33%"
|
|
253 ALIGN="left"
|
|
254 VALIGN="top"
|
|
255 >Object Files and Sections</TD
|
|
256 ><TD
|
|
257 WIDTH="34%"
|
|
258 ALIGN="center"
|
|
259 VALIGN="top"
|
|
260 ><A
|
|
261 HREF="c43.html"
|
|
262 ACCESSKEY="U"
|
|
263 >Up</A
|
|
264 ></TD
|
|
265 ><TD
|
|
266 WIDTH="33%"
|
|
267 ALIGN="right"
|
|
268 VALIGN="top"
|
|
269 >LWLINK</TD
|
|
270 ></TR
|
|
271 ></TABLE
|
|
272 ></DIV
|
|
273 ></BODY
|
|
274 ></HTML
|
|
275 > |