Commit | Line | Data |
---|---|---|
252b5132 | 1 | \input texinfo @c -*-Texinfo-*- |
5b93d8bb | 2 | @c Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 2000 |
252b5132 RH |
3 | @c Free Software Foundation, Inc. |
4 | @c UPDATE!! On future updates-- | |
5 | @c (1) check for new machine-dep cmdline options in | |
6 | @c md_parse_option definitions in config/tc-*.c | |
7 | @c (2) for platform-specific directives, examine md_pseudo_op | |
8 | @c in config/tc-*.c | |
9 | @c (3) for object-format specific directives, examine obj_pseudo_op | |
10 | @c in config/obj-*.c | |
11 | @c (4) portable directives in potable[] in read.c | |
12 | @c %**start of header | |
13 | @setfilename as.info | |
14 | @c ---config--- | |
15 | @c defaults, config file may override: | |
16 | @set have-stabs | |
17 | @c --- | |
18 | @include asconfig.texi | |
19 | @include gasver.texi | |
20 | @c --- | |
21 | @c common OR combinations of conditions | |
22 | @ifset AOUT | |
23 | @set aout-bout | |
24 | @end ifset | |
25 | @ifset ARM/Thumb | |
26 | @set ARM | |
27 | @end ifset | |
28 | @ifset BOUT | |
29 | @set aout-bout | |
30 | @end ifset | |
31 | @ifset H8/300 | |
32 | @set H8 | |
33 | @end ifset | |
34 | @ifset H8/500 | |
35 | @set H8 | |
36 | @end ifset | |
37 | @ifset SH | |
38 | @set H8 | |
39 | @end ifset | |
40 | @ifset HPPA | |
41 | @set abnormal-separator | |
42 | @end ifset | |
43 | @c ------------ | |
44 | @ifset GENERIC | |
45 | @settitle Using @value{AS} | |
46 | @end ifset | |
47 | @ifclear GENERIC | |
48 | @settitle Using @value{AS} (@value{TARGET}) | |
49 | @end ifclear | |
50 | @setchapternewpage odd | |
51 | @c %**end of header | |
52 | ||
53 | @c @smallbook | |
54 | @c @set SMALL | |
55 | @c WARE! Some of the machine-dependent sections contain tables of machine | |
56 | @c instructions. Except in multi-column format, these tables look silly. | |
57 | @c Unfortunately, Texinfo doesn't have a general-purpose multi-col format, so | |
58 | @c the multi-col format is faked within @example sections. | |
59 | @c | |
60 | @c Again unfortunately, the natural size that fits on a page, for these tables, | |
61 | @c is different depending on whether or not smallbook is turned on. | |
62 | @c This matters, because of order: text flow switches columns at each page | |
63 | @c break. | |
64 | @c | |
65 | @c The format faked in this source works reasonably well for smallbook, | |
66 | @c not well for the default large-page format. This manual expects that if you | |
67 | @c turn on @smallbook, you will also uncomment the "@set SMALL" to enable the | |
68 | @c tables in question. You can turn on one without the other at your | |
69 | @c discretion, of course. | |
70 | @ifinfo | |
71 | @set SMALL | |
72 | @c the insn tables look just as silly in info files regardless of smallbook, | |
73 | @c might as well show 'em anyways. | |
74 | @end ifinfo | |
75 | ||
76 | @ifinfo | |
77 | @format | |
78 | START-INFO-DIR-ENTRY | |
79 | * As: (as). The GNU assembler. | |
80 | END-INFO-DIR-ENTRY | |
81 | @end format | |
82 | @end ifinfo | |
83 | ||
84 | @finalout | |
85 | @syncodeindex ky cp | |
86 | ||
87 | @ifinfo | |
88 | This file documents the GNU Assembler "@value{AS}". | |
89 | ||
a057431b | 90 | Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. |
252b5132 RH |
91 | |
92 | Permission is granted to make and distribute verbatim copies of | |
93 | this manual provided the copyright notice and this permission notice | |
94 | are preserved on all copies. | |
95 | ||
96 | @ignore | |
97 | Permission is granted to process this file through Tex and print the | |
98 | results, provided the printed document carries copying permission | |
99 | notice identical to this one except for the removal of this paragraph | |
100 | (this paragraph not being relevant to the printed manual). | |
101 | ||
102 | @end ignore | |
103 | Permission is granted to copy and distribute modified versions of this manual | |
104 | under the conditions for verbatim copying, provided that the entire resulting | |
105 | derived work is distributed under the terms of a permission notice identical to | |
106 | this one. | |
107 | ||
108 | Permission is granted to copy and distribute translations of this manual | |
109 | into another language, under the above conditions for modified versions. | |
110 | @end ifinfo | |
111 | ||
112 | @titlepage | |
113 | @title Using @value{AS} | |
114 | @subtitle The @sc{gnu} Assembler | |
115 | @ifclear GENERIC | |
116 | @subtitle for the @value{TARGET} family | |
117 | @end ifclear | |
118 | @sp 1 | |
119 | @subtitle Version @value{VERSION} | |
120 | @sp 1 | |
121 | @sp 13 | |
122 | The Free Software Foundation Inc. thanks The Nice Computer | |
123 | Company of Australia for loaning Dean Elsner to write the | |
124 | first (Vax) version of @code{as} for Project @sc{gnu}. | |
125 | The proprietors, management and staff of TNCCA thank FSF for | |
126 | distracting the boss while they got some work | |
127 | done. | |
128 | @sp 3 | |
129 | @author Dean Elsner, Jay Fenlason & friends | |
130 | @page | |
131 | @tex | |
132 | {\parskip=0pt | |
133 | \hfill {\it Using {\tt @value{AS}}}\par | |
134 | \hfill Edited by Cygnus Support\par | |
135 | } | |
136 | %"boxit" macro for figures: | |
137 | %Modified from Knuth's ``boxit'' macro from TeXbook (answer to exercise 21.3) | |
138 | \gdef\boxit#1#2{\vbox{\hrule\hbox{\vrule\kern3pt | |
139 | \vbox{\parindent=0pt\parskip=0pt\hsize=#1\kern3pt\strut\hfil | |
140 | #2\hfil\strut\kern3pt}\kern3pt\vrule}\hrule}}%box with visible outline | |
141 | \gdef\ibox#1#2{\hbox to #1{#2\hfil}\kern8pt}% invisible box | |
142 | @end tex | |
143 | ||
144 | @vskip 0pt plus 1filll | |
a057431b | 145 | Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. |
252b5132 RH |
146 | |
147 | Permission is granted to make and distribute verbatim copies of | |
148 | this manual provided the copyright notice and this permission notice | |
149 | are preserved on all copies. | |
150 | ||
151 | Permission is granted to copy and distribute modified versions of this manual | |
152 | under the conditions for verbatim copying, provided that the entire resulting | |
153 | derived work is distributed under the terms of a permission notice identical to | |
154 | this one. | |
155 | ||
156 | Permission is granted to copy and distribute translations of this manual | |
157 | into another language, under the above conditions for modified versions. | |
158 | @end titlepage | |
159 | ||
160 | @ifinfo | |
161 | @node Top | |
162 | @top Using @value{AS} | |
163 | ||
164 | This file is a user guide to the @sc{gnu} assembler @code{@value{AS}} version | |
165 | @value{VERSION}. | |
166 | @ifclear GENERIC | |
167 | This version of the file describes @code{@value{AS}} configured to generate | |
168 | code for @value{TARGET} architectures. | |
169 | @end ifclear | |
170 | @menu | |
171 | * Overview:: Overview | |
172 | * Invoking:: Command-Line Options | |
173 | * Syntax:: Syntax | |
174 | * Sections:: Sections and Relocation | |
175 | * Symbols:: Symbols | |
176 | * Expressions:: Expressions | |
177 | * Pseudo Ops:: Assembler Directives | |
178 | * Machine Dependencies:: Machine Dependent Features | |
179 | * Reporting Bugs:: Reporting Bugs | |
180 | * Acknowledgements:: Who Did What | |
181 | * Index:: Index | |
182 | @end menu | |
183 | @end ifinfo | |
184 | ||
185 | @node Overview | |
186 | @chapter Overview | |
187 | @iftex | |
188 | This manual is a user guide to the @sc{gnu} assembler @code{@value{AS}}. | |
189 | @ifclear GENERIC | |
190 | This version of the manual describes @code{@value{AS}} configured to generate | |
191 | code for @value{TARGET} architectures. | |
192 | @end ifclear | |
193 | @end iftex | |
194 | ||
195 | @cindex invocation summary | |
196 | @cindex option summary | |
197 | @cindex summary of options | |
198 | Here is a brief summary of how to invoke @code{@value{AS}}. For details, | |
199 | @pxref{Invoking,,Comand-Line Options}. | |
200 | ||
201 | @c We don't use deffn and friends for the following because they seem | |
202 | @c to be limited to one line for the header. | |
203 | @smallexample | |
204 | @value{AS} [ -a[cdhlns][=file] ] [ -D ] [ --defsym @var{sym}=@var{val} ] | |
cdf82bcf | 205 | [ -f ] [ --gstabs ] [ --gdwarf2 ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ] |
252b5132 | 206 | [ --keep-locals ] [ -o @var{objfile} ] [ -R ] [ --statistics ] [ -v ] |
2bdd6cf5 GK |
207 | [ -version ] [ --version ] [ -W ] [ --warn ] [ --fatal-warnings ] |
208 | [ -w ] [ -x ] [ -Z ] | |
252b5132 RH |
209 | @ifset A29K |
210 | @c am29k has no machine-dependent assembler options | |
211 | @end ifset | |
212 | @ifset ARC | |
213 | [ -mbig-endian | -mlittle-endian ] | |
214 | @end ifset | |
215 | @ifset ARM | |
cdf82bcf NC |
216 | [ -m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]60 | |
217 | -m[arm]600 | -m[arm]610 | -m[arm]620 | -m[arm]7[t][[d]m[i]][fe] | -m[arm]70 | | |
218 | -m[arm]700 | -m[arm]710[c] | -m[arm]7100 | -m[arm]7500 | -m[arm]8 | | |
219 | -m[arm]810 | -m[arm]9 | -m[arm]920 | -m[arm]920t | -m[arm]9tdmi | | |
220 | -mstrongarm | -mstrongarm110 | -mstrongarm1100 ] | |
221 | [ -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t | | |
222 | -m[arm]v5 | -[arm]v5t ] | |
252b5132 RH |
223 | [ -mthumb | -mall ] |
224 | [ -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu ] | |
225 | [ -EB | -EL ] | |
cdf82bcf NC |
226 | [ -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant ] |
227 | [ -mthumb-interwork ] | |
228 | [ -moabi ] | |
229 | [ -k ] | |
252b5132 RH |
230 | @end ifset |
231 | @ifset D10V | |
232 | [ -O ] | |
233 | @end ifset | |
234 | @ifset D30V | |
235 | [ -O | -n | -N ] | |
236 | @end ifset | |
237 | @ifset H8 | |
238 | @c Hitachi family chips have no machine-dependent assembler options | |
239 | @end ifset | |
240 | @ifset HPPA | |
241 | @c HPPA has no machine-dependent assembler options (yet). | |
242 | @end ifset | |
041dd5a9 ILT |
243 | @ifset PJ |
244 | [ -mb | -me ] | |
245 | @end ifset | |
252b5132 RH |
246 | @ifset SPARC |
247 | @c The order here is important. See c-sparc.texi. | |
248 | [ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | |
249 | -Av8plus | -Av8plusa | -Av9 | -Av9a ] | |
250 | [ -xarch=v8plus | -xarch=v8plusa ] [ -bump ] [ -32 | -64 ] | |
251 | @end ifset | |
252 | @ifset Z8000 | |
253 | @c Z8000 has no machine-dependent assembler options | |
254 | @end ifset | |
255 | @ifset I960 | |
256 | @c see md_parse_option in tc-i960.c | |
257 | [ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ] | |
258 | [ -b ] [ -no-relax ] | |
259 | @end ifset | |
ec694b89 NC |
260 | @ifset M32R |
261 | [ --m32rx | --[no-]warn-explicit-parallel-conflicts | --W[n]p ] | |
262 | @end ifset | |
252b5132 RH |
263 | @ifset M680X0 |
264 | [ -l ] [ -m68000 | -m68010 | -m68020 | ... ] | |
265 | @end ifset | |
266 | @ifset MCORE | |
267 | [ -jsri2bsr ] [ -sifilter ] [ -relax ] | |
ec694b89 | 268 | [ -mcpu=[210|340] ] |
252b5132 RH |
269 | @end ifset |
270 | @ifset MIPS | |
271 | [ -nocpp ] [ -EL ] [ -EB ] [ -G @var{num} ] [ -mcpu=@var{CPU} ] | |
272 | [ -mips1 ] [ -mips2 ] [ -mips3 ] [ -m4650 ] [ -no-m4650 ] | |
273 | [ --trap ] [ --break ] | |
274 | [ --emulation=@var{name} ] | |
275 | @end ifset | |
276 | [ -- | @var{files} @dots{} ] | |
277 | @end smallexample | |
278 | ||
279 | @table @code | |
280 | @item -a[cdhlmns] | |
281 | Turn on listings, in any of a variety of ways: | |
282 | ||
283 | @table @code | |
284 | @item -ac | |
285 | omit false conditionals | |
286 | ||
287 | @item -ad | |
288 | omit debugging directives | |
289 | ||
290 | @item -ah | |
291 | include high-level source | |
292 | ||
293 | @item -al | |
294 | include assembly | |
295 | ||
296 | @item -am | |
297 | include macro expansions | |
298 | ||
299 | @item -an | |
300 | omit forms processing | |
301 | ||
302 | @item -as | |
303 | include symbols | |
304 | ||
305 | @item =file | |
306 | set the name of the listing file | |
307 | @end table | |
308 | ||
309 | You may combine these options; for example, use @samp{-aln} for assembly | |
310 | listing without forms processing. The @samp{=file} option, if used, must be | |
311 | the last one. By itself, @samp{-a} defaults to @samp{-ahls}. | |
312 | ||
313 | @item -D | |
314 | Ignored. This option is accepted for script compatibility with calls to | |
315 | other assemblers. | |
316 | ||
317 | @item --defsym @var{sym}=@var{value} | |
318 | Define the symbol @var{sym} to be @var{value} before assembling the input file. | |
319 | @var{value} must be an integer constant. As in C, a leading @samp{0x} | |
320 | indicates a hexadecimal value, and a leading @samp{0} indicates an octal value. | |
321 | ||
322 | @item -f | |
323 | ``fast''---skip whitespace and comment preprocessing (assume source is | |
324 | compiler output). | |
325 | ||
326 | @item --gstabs | |
327 | Generate stabs debugging information for each assembler line. This | |
328 | may help debugging assembler code, if the debugger can handle it. | |
329 | ||
cdf82bcf NC |
330 | @item --gdwarf2 |
331 | Generate DWARF2 debugging information for each assembler line. This | |
332 | may help debugging assembler code, if the debugger can handle it. | |
333 | ||
252b5132 RH |
334 | @item --help |
335 | Print a summary of the command line options and exit. | |
336 | ||
337 | @item -I @var{dir} | |
338 | Add directory @var{dir} to the search list for @code{.include} directives. | |
339 | ||
340 | @item -J | |
341 | Don't warn about signed overflow. | |
342 | ||
343 | @item -K | |
344 | @ifclear DIFF-TBL-KLUGE | |
345 | This option is accepted but has no effect on the @value{TARGET} family. | |
346 | @end ifclear | |
347 | @ifset DIFF-TBL-KLUGE | |
348 | Issue warnings when difference tables altered for long displacements. | |
349 | @end ifset | |
350 | ||
351 | @item -L | |
352 | @itemx --keep-locals | |
353 | Keep (in the symbol table) local symbols. On traditional a.out systems | |
354 | these start with @samp{L}, but different systems have different local | |
355 | label prefixes. | |
356 | ||
357 | @item -o @var{objfile} | |
358 | Name the object-file output from @code{@value{AS}} @var{objfile}. | |
359 | ||
360 | @item -R | |
361 | Fold the data section into the text section. | |
362 | ||
363 | @item --statistics | |
364 | Print the maximum space (in bytes) and total time (in seconds) used by | |
365 | assembly. | |
366 | ||
367 | @item --strip-local-absolute | |
368 | Remove local absolute symbols from the outgoing symbol table. | |
369 | ||
370 | @item -v | |
371 | @itemx -version | |
372 | Print the @code{as} version. | |
373 | ||
374 | @item --version | |
375 | Print the @code{as} version and exit. | |
376 | ||
377 | @item -W | |
2bdd6cf5 | 378 | @itemx --no-warn |
252b5132 RH |
379 | Suppress warning messages. |
380 | ||
2bdd6cf5 GK |
381 | @item --fatal-warnings |
382 | Treat warnings as errors. | |
383 | ||
384 | @item --warn | |
385 | Don't suppress warning messages or treat them as errors. | |
386 | ||
252b5132 RH |
387 | @item -w |
388 | Ignored. | |
389 | ||
390 | @item -x | |
391 | Ignored. | |
392 | ||
393 | @item -Z | |
394 | Generate an object file even after errors. | |
395 | ||
396 | @item -- | @var{files} @dots{} | |
397 | Standard input, or source files to assemble. | |
398 | ||
399 | @end table | |
400 | ||
401 | @ifset ARC | |
402 | The following options are available when @value{AS} is configured for | |
403 | an ARC processor. | |
404 | ||
405 | @table @code | |
406 | ||
407 | @cindex ARC endianness | |
408 | @cindex endianness, ARC | |
409 | @cindex big endian output, ARC | |
410 | @item -mbig-endian | |
411 | Generate ``big endian'' format output. | |
412 | ||
413 | @cindex little endian output, ARC | |
414 | @item -mlittle-endian | |
415 | Generate ``little endian'' format output. | |
416 | ||
417 | @end table | |
418 | @end ifset | |
419 | ||
420 | @ifset ARM | |
421 | The following options are available when @value{AS} is configured for the ARM | |
422 | processor family. | |
423 | ||
424 | @table @code | |
cdf82bcf NC |
425 | @item -m[arm][1|2|3|6|7|8|9][...] |
426 | Specify which ARM processor variant is the target. | |
427 | @item -m[arm]v[2|2a|3|3m|4|4t|5|5t] | |
428 | Specify which ARM architecture variant is used by the target. | |
252b5132 RH |
429 | @item -mthumb | -mall |
430 | Enable or disable Thumb only instruction decoding. | |
431 | @item -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu | |
432 | Select which Floating Point architcture is the target. | |
cdf82bcf | 433 | @item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi |
252b5132 RH |
434 | Select which procedure calling convention is in use. |
435 | @item -EB | -EL | |
436 | Select either big-endian (-EB) or little-endian (-EL) output. | |
cdf82bcf NC |
437 | @item -mthumb-interwork |
438 | Specify that the code has been generated with interworking between Thumb and | |
439 | ARM code in mind. | |
440 | @item -k | |
441 | Specify that PIC code has been generated. | |
252b5132 RH |
442 | @end table |
443 | @end ifset | |
444 | ||
445 | @ifset D10V | |
446 | The following options are available when @value{AS} is configured for | |
447 | a D10V processor. | |
448 | @table @code | |
449 | @cindex D10V optimization | |
450 | @cindex optimization, D10V | |
451 | @item -O | |
452 | Optimize output by parallelizing instructions. | |
453 | @end table | |
454 | @end ifset | |
455 | ||
456 | @ifset D30V | |
457 | The following options are available when @value{AS} is configured for a D30V | |
458 | processor. | |
459 | @table @code | |
460 | @cindex D30V optimization | |
461 | @cindex optimization, D30V | |
462 | @item -O | |
463 | Optimize output by parallelizing instructions. | |
464 | ||
465 | @cindex D30V nops | |
466 | @item -n | |
467 | Warn when nops are generated. | |
468 | ||
469 | @cindex D30V nops after 32-bit multiply | |
470 | @item -N | |
471 | Warn when a nop after a 32-bit multiply instruction is generated. | |
472 | @end table | |
473 | @end ifset | |
474 | ||
475 | @ifset I960 | |
476 | The following options are available when @value{AS} is configured for the | |
477 | Intel 80960 processor. | |
478 | ||
479 | @table @code | |
480 | @item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC | |
481 | Specify which variant of the 960 architecture is the target. | |
482 | ||
483 | @item -b | |
484 | Add code to collect statistics about branches taken. | |
485 | ||
486 | @item -no-relax | |
487 | Do not alter compare-and-branch instructions for long displacements; | |
488 | error if necessary. | |
489 | ||
490 | @end table | |
491 | @end ifset | |
492 | ||
ec694b89 NC |
493 | @ifset M32R |
494 | The following options are available when @value{AS} is configured for the | |
495 | Mitsubishi M32R series. | |
496 | ||
497 | @table @code | |
498 | ||
499 | @item --m32rx | |
500 | Specify which processor in the M32R family is the target. The default | |
501 | is normally the M32R, but this option changes it to the M32RX. | |
502 | ||
503 | @item --warn-explicit-parallel-conflicts or --Wp | |
504 | Produce warning messages when questionable parallel constructs are | |
505 | encountered. | |
506 | ||
507 | @item --no-warn-explicit-parallel-conflicts or --Wnp | |
508 | Do not produce warning messages when questionable parallel constructs are | |
509 | encountered. | |
510 | ||
511 | @end table | |
512 | @end ifset | |
252b5132 RH |
513 | |
514 | @ifset M680X0 | |
515 | The following options are available when @value{AS} is configured for the | |
516 | Motorola 68000 series. | |
517 | ||
518 | @table @code | |
519 | ||
520 | @item -l | |
521 | Shorten references to undefined symbols, to one word instead of two. | |
522 | ||
523 | @item -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 | |
524 | @itemx | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32 | -m5200 | |
525 | Specify what processor in the 68000 family is the target. The default | |
526 | is normally the 68020, but this can be changed at configuration time. | |
527 | ||
528 | @item -m68881 | -m68882 | -mno-68881 | -mno-68882 | |
529 | The target machine does (or does not) have a floating-point coprocessor. | |
530 | The default is to assume a coprocessor for 68020, 68030, and cpu32. Although | |
531 | the basic 68000 is not compatible with the 68881, a combination of the | |
532 | two can be specified, since it's possible to do emulation of the | |
533 | coprocessor instructions with the main processor. | |
534 | ||
535 | @item -m68851 | -mno-68851 | |
536 | The target machine does (or does not) have a memory-management | |
537 | unit coprocessor. The default is to assume an MMU for 68020 and up. | |
538 | ||
539 | @end table | |
540 | @end ifset | |
541 | ||
041dd5a9 ILT |
542 | @ifset PJ |
543 | The following options are available when @value{AS} is configured for | |
544 | a picoJava processor. | |
545 | ||
546 | @table @code | |
547 | ||
548 | @cindex PJ endianness | |
549 | @cindex endianness, PJ | |
550 | @cindex big endian output, PJ | |
551 | @item -mb | |
552 | Generate ``big endian'' format output. | |
553 | ||
554 | @cindex little endian output, PJ | |
555 | @item -ml | |
556 | Generate ``little endian'' format output. | |
557 | ||
558 | @end table | |
559 | @end ifset | |
560 | ||
252b5132 RH |
561 | @ifset SPARC |
562 | The following options are available when @code{@value{AS}} is configured | |
563 | for the SPARC architecture: | |
564 | ||
565 | @table @code | |
566 | @item -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | |
567 | @itemx -Av8plus | -Av8plusa | -Av9 | -Av9a | |
568 | Explicitly select a variant of the SPARC architecture. | |
569 | ||
570 | @samp{-Av8plus} and @samp{-Av8plusa} select a 32 bit environment. | |
571 | @samp{-Av9} and @samp{-Av9a} select a 64 bit environment. | |
572 | ||
573 | @samp{-Av8plusa} and @samp{-Av9a} enable the SPARC V9 instruction set with | |
574 | UltraSPARC extensions. | |
575 | ||
576 | @item -xarch=v8plus | -xarch=v8plusa | |
577 | For compatibility with the Solaris v9 assembler. These options are | |
578 | equivalent to -Av8plus and -Av8plusa, respectively. | |
579 | ||
580 | @item -bump | |
581 | Warn when the assembler switches to another architecture. | |
582 | @end table | |
583 | @end ifset | |
584 | ||
585 | @ifset MIPS | |
586 | The following options are available when @value{AS} is configured for | |
587 | a MIPS processor. | |
588 | ||
589 | @table @code | |
590 | @item -G @var{num} | |
591 | This option sets the largest size of an object that can be referenced | |
592 | implicitly with the @code{gp} register. It is only accepted for targets that | |
593 | use ECOFF format, such as a DECstation running Ultrix. The default value is 8. | |
594 | ||
595 | @cindex MIPS endianness | |
596 | @cindex endianness, MIPS | |
597 | @cindex big endian output, MIPS | |
598 | @item -EB | |
599 | Generate ``big endian'' format output. | |
600 | ||
601 | @cindex little endian output, MIPS | |
602 | @item -EL | |
603 | Generate ``little endian'' format output. | |
604 | ||
605 | @cindex MIPS ISA | |
606 | @item -mips1 | |
607 | @itemx -mips2 | |
608 | @itemx -mips3 | |
609 | Generate code for a particular MIPS Instruction Set Architecture level. | |
610 | @samp{-mips1} corresponds to the @sc{r2000} and @sc{r3000} processors, | |
611 | @samp{-mips2} to the @sc{r6000} processor, and @samp{-mips3} to the @sc{r4000} | |
612 | processor. | |
613 | ||
614 | @item -m4650 | |
615 | @itemx -no-m4650 | |
616 | Generate code for the MIPS @sc{r4650} chip. This tells the assembler to accept | |
617 | the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop} | |
618 | instructions around accesses to the @samp{HI} and @samp{LO} registers. | |
619 | @samp{-no-m4650} turns off this option. | |
620 | ||
621 | @item -mcpu=@var{CPU} | |
622 | Generate code for a particular MIPS cpu. This has little effect on the | |
623 | assembler, but it is passed by @code{@value{GCC}}. | |
624 | ||
625 | @cindex emulation | |
626 | @item --emulation=@var{name} | |
627 | This option causes @code{@value{AS}} to emulate @code{@value{AS}} configured | |
628 | for some other target, in all respects, including output format (choosing | |
629 | between ELF and ECOFF only), handling of pseudo-opcodes which may generate | |
630 | debugging information or store symbol table information, and default | |
631 | endianness. The available configuration names are: @samp{mipsecoff}, | |
632 | @samp{mipself}, @samp{mipslecoff}, @samp{mipsbecoff}, @samp{mipslelf}, | |
633 | @samp{mipsbelf}. The first two do not alter the default endianness from that | |
634 | of the primary target for which the assembler was configured; the others change | |
635 | the default to little- or big-endian as indicated by the @samp{b} or @samp{l} | |
636 | in the name. Using @samp{-EB} or @samp{-EL} will override the endianness | |
637 | selection in any case. | |
638 | ||
639 | This option is currently supported only when the primary target | |
640 | @code{@value{AS}} is configured for is a MIPS ELF or ECOFF target. | |
641 | Furthermore, the primary target or others specified with | |
642 | @samp{--enable-targets=@dots{}} at configuration time must include support for | |
643 | the other format, if both are to be available. For example, the Irix 5 | |
644 | configuration includes support for both. | |
645 | ||
646 | Eventually, this option will support more configurations, with more | |
647 | fine-grained control over the assembler's behavior, and will be supported for | |
648 | more processors. | |
649 | ||
650 | @item -nocpp | |
651 | @code{@value{AS}} ignores this option. It is accepted for compatibility with | |
652 | the native tools. | |
653 | ||
654 | @need 900 | |
655 | @item --trap | |
656 | @itemx --no-trap | |
657 | @itemx --break | |
658 | @itemx --no-break | |
659 | Control how to deal with multiplication overflow and division by zero. | |
660 | @samp{--trap} or @samp{--no-break} (which are synonyms) take a trap exception | |
661 | (and only work for Instruction Set Architecture level 2 and higher); | |
662 | @samp{--break} or @samp{--no-trap} (also synonyms, and the default) take a | |
663 | break exception. | |
664 | @end table | |
665 | @end ifset | |
666 | ||
667 | @ifset MCORE | |
668 | The following options are available when @value{AS} is configured for | |
669 | an MCore processor. | |
670 | ||
671 | @table @code | |
672 | @item -jsri2bsr | |
673 | @itemx -nojsri2bsr | |
674 | Enable or disable the JSRI to BSR transformation. By default this is enabled. | |
675 | The command line option @samp{-nojsri2bsr} can be used to disable it. | |
676 | ||
677 | @item -sifilter | |
678 | @itemx -nosifilter | |
679 | Enable or disable the silicon filter behaviour. By default this is disabled. | |
680 | The default can be overidden by the @samp{-sifilter} command line option. | |
681 | ||
682 | @item -relax | |
683 | Alter jump instructions for long displacements. | |
684 | ||
ec694b89 NC |
685 | @item -mcpu=[210|340] |
686 | Select the cpu type on the target hardware. This controls which instructions | |
687 | can be assembled. | |
688 | ||
689 | @item -EB | |
690 | Assemble for a big endian target. | |
691 | ||
692 | @item -EL | |
693 | Assemble for a little endian target. | |
252b5132 RH |
694 | |
695 | @end table | |
696 | @end ifset | |
697 | ||
698 | @menu | |
699 | * Manual:: Structure of this Manual | |
700 | * GNU Assembler:: The GNU Assembler | |
701 | * Object Formats:: Object File Formats | |
702 | * Command Line:: Command Line | |
703 | * Input Files:: Input Files | |
704 | * Object:: Output (Object) File | |
705 | * Errors:: Error and Warning Messages | |
706 | @end menu | |
707 | ||
708 | @node Manual | |
709 | @section Structure of this Manual | |
710 | ||
711 | @cindex manual, structure and purpose | |
712 | This manual is intended to describe what you need to know to use | |
713 | @sc{gnu} @code{@value{AS}}. We cover the syntax expected in source files, including | |
714 | notation for symbols, constants, and expressions; the directives that | |
715 | @code{@value{AS}} understands; and of course how to invoke @code{@value{AS}}. | |
716 | ||
717 | @ifclear GENERIC | |
718 | We also cover special features in the @value{TARGET} | |
719 | configuration of @code{@value{AS}}, including assembler directives. | |
720 | @end ifclear | |
721 | @ifset GENERIC | |
722 | This manual also describes some of the machine-dependent features of | |
723 | various flavors of the assembler. | |
724 | @end ifset | |
725 | ||
726 | @cindex machine instructions (not covered) | |
727 | On the other hand, this manual is @emph{not} intended as an introduction | |
728 | to programming in assembly language---let alone programming in general! | |
729 | In a similar vein, we make no attempt to introduce the machine | |
730 | architecture; we do @emph{not} describe the instruction set, standard | |
731 | mnemonics, registers or addressing modes that are standard to a | |
732 | particular architecture. | |
733 | @ifset GENERIC | |
734 | You may want to consult the manufacturer's | |
735 | machine architecture manual for this information. | |
736 | @end ifset | |
737 | @ifclear GENERIC | |
738 | @ifset H8/300 | |
739 | For information on the H8/300 machine instruction set, see @cite{H8/300 | |
740 | Series Programming Manual} (Hitachi ADE--602--025). For the H8/300H, | |
741 | see @cite{H8/300H Series Programming Manual} (Hitachi). | |
742 | @end ifset | |
743 | @ifset H8/500 | |
744 | For information on the H8/500 machine instruction set, see @cite{H8/500 | |
745 | Series Programming Manual} (Hitachi M21T001). | |
746 | @end ifset | |
747 | @ifset SH | |
748 | For information on the Hitachi SH machine instruction set, see | |
749 | @cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.). | |
750 | @end ifset | |
751 | @ifset Z8000 | |
752 | For information on the Z8000 machine instruction set, see @cite{Z8000 CPU Technical Manual} | |
753 | @end ifset | |
754 | @end ifclear | |
755 | ||
756 | @c I think this is premature---doc@cygnus.com, 17jan1991 | |
757 | @ignore | |
758 | Throughout this manual, we assume that you are running @dfn{GNU}, | |
759 | the portable operating system from the @dfn{Free Software | |
760 | Foundation, Inc.}. This restricts our attention to certain kinds of | |
761 | computer (in particular, the kinds of computers that @sc{gnu} can run on); | |
762 | once this assumption is granted examples and definitions need less | |
763 | qualification. | |
764 | ||
765 | @code{@value{AS}} is part of a team of programs that turn a high-level | |
766 | human-readable series of instructions into a low-level | |
767 | computer-readable series of instructions. Different versions of | |
768 | @code{@value{AS}} are used for different kinds of computer. | |
769 | @end ignore | |
770 | ||
771 | @c There used to be a section "Terminology" here, which defined | |
772 | @c "contents", "byte", "word", and "long". Defining "word" to any | |
773 | @c particular size is confusing when the .word directive may generate 16 | |
774 | @c bits on one machine and 32 bits on another; in general, for the user | |
775 | @c version of this manual, none of these terms seem essential to define. | |
776 | @c They were used very little even in the former draft of the manual; | |
777 | @c this draft makes an effort to avoid them (except in names of | |
778 | @c directives). | |
779 | ||
780 | @node GNU Assembler | |
781 | @section The GNU Assembler | |
782 | ||
783 | @sc{gnu} @code{as} is really a family of assemblers. | |
784 | @ifclear GENERIC | |
785 | This manual describes @code{@value{AS}}, a member of that family which is | |
786 | configured for the @value{TARGET} architectures. | |
787 | @end ifclear | |
788 | If you use (or have used) the @sc{gnu} assembler on one architecture, you | |
789 | should find a fairly similar environment when you use it on another | |
790 | architecture. Each version has much in common with the others, | |
791 | including object file formats, most assembler directives (often called | |
792 | @dfn{pseudo-ops}) and assembler syntax.@refill | |
793 | ||
794 | @cindex purpose of @sc{gnu} assembler | |
795 | @code{@value{AS}} is primarily intended to assemble the output of the | |
796 | @sc{gnu} C compiler @code{@value{GCC}} for use by the linker | |
797 | @code{@value{LD}}. Nevertheless, we've tried to make @code{@value{AS}} | |
798 | assemble correctly everything that other assemblers for the same | |
799 | machine would assemble. | |
800 | @ifset VAX | |
801 | Any exceptions are documented explicitly (@pxref{Machine Dependencies}). | |
802 | @end ifset | |
803 | @ifset M680X0 | |
804 | @c This remark should appear in generic version of manual; assumption | |
805 | @c here is that generic version sets M680x0. | |
806 | This doesn't mean @code{@value{AS}} always uses the same syntax as another | |
807 | assembler for the same architecture; for example, we know of several | |
808 | incompatible versions of 680x0 assembly language syntax. | |
809 | @end ifset | |
810 | ||
811 | Unlike older assemblers, @code{@value{AS}} is designed to assemble a source | |
812 | program in one pass of the source file. This has a subtle impact on the | |
813 | @kbd{.org} directive (@pxref{Org,,@code{.org}}). | |
814 | ||
815 | @node Object Formats | |
816 | @section Object File Formats | |
817 | ||
818 | @cindex object file format | |
819 | The @sc{gnu} assembler can be configured to produce several alternative | |
820 | object file formats. For the most part, this does not affect how you | |
821 | write assembly language programs; but directives for debugging symbols | |
822 | are typically different in different file formats. @xref{Symbol | |
823 | Attributes,,Symbol Attributes}. | |
824 | @ifclear GENERIC | |
825 | @ifclear MULTI-OBJ | |
826 | On the @value{TARGET}, @code{@value{AS}} is configured to produce | |
827 | @value{OBJ-NAME} format object files. | |
828 | @end ifclear | |
829 | @c The following should exhaust all configs that set MULTI-OBJ, ideally | |
830 | @ifset A29K | |
831 | On the @value{TARGET}, @code{@value{AS}} can be configured to produce either | |
832 | @code{a.out} or COFF format object files. | |
833 | @end ifset | |
834 | @ifset I960 | |
835 | On the @value{TARGET}, @code{@value{AS}} can be configured to produce either | |
836 | @code{b.out} or COFF format object files. | |
837 | @end ifset | |
838 | @ifset HPPA | |
839 | On the @value{TARGET}, @code{@value{AS}} can be configured to produce either | |
840 | SOM or ELF format object files. | |
841 | @end ifset | |
842 | @end ifclear | |
843 | ||
844 | @node Command Line | |
845 | @section Command Line | |
846 | ||
847 | @cindex command line conventions | |
848 | After the program name @code{@value{AS}}, the command line may contain | |
849 | options and file names. Options may appear in any order, and may be | |
850 | before, after, or between file names. The order of file names is | |
851 | significant. | |
852 | ||
853 | @cindex standard input, as input file | |
854 | @kindex -- | |
855 | @file{--} (two hyphens) by itself names the standard input file | |
856 | explicitly, as one of the files for @code{@value{AS}} to assemble. | |
857 | ||
858 | @cindex options, command line | |
859 | Except for @samp{--} any command line argument that begins with a | |
860 | hyphen (@samp{-}) is an option. Each option changes the behavior of | |
861 | @code{@value{AS}}. No option changes the way another option works. An | |
862 | option is a @samp{-} followed by one or more letters; the case of | |
863 | the letter is important. All options are optional. | |
864 | ||
865 | Some options expect exactly one file name to follow them. The file | |
866 | name may either immediately follow the option's letter (compatible | |
867 | with older assemblers) or it may be the next command argument (@sc{gnu} | |
868 | standard). These two command lines are equivalent: | |
869 | ||
870 | @smallexample | |
871 | @value{AS} -o my-object-file.o mumble.s | |
872 | @value{AS} -omy-object-file.o mumble.s | |
873 | @end smallexample | |
874 | ||
875 | @node Input Files | |
876 | @section Input Files | |
877 | ||
878 | @cindex input | |
879 | @cindex source program | |
880 | @cindex files, input | |
881 | We use the phrase @dfn{source program}, abbreviated @dfn{source}, to | |
882 | describe the program input to one run of @code{@value{AS}}. The program may | |
883 | be in one or more files; how the source is partitioned into files | |
884 | doesn't change the meaning of the source. | |
885 | ||
886 | @c I added "con" prefix to "catenation" just to prove I can overcome my | |
887 | @c APL training... doc@cygnus.com | |
888 | The source program is a concatenation of the text in all the files, in the | |
889 | order specified. | |
890 | ||
891 | Each time you run @code{@value{AS}} it assembles exactly one source | |
892 | program. The source program is made up of one or more files. | |
893 | (The standard input is also a file.) | |
894 | ||
895 | You give @code{@value{AS}} a command line that has zero or more input file | |
896 | names. The input files are read (from left file name to right). A | |
897 | command line argument (in any position) that has no special meaning | |
898 | is taken to be an input file name. | |
899 | ||
900 | If you give @code{@value{AS}} no file names it attempts to read one input file | |
901 | from the @code{@value{AS}} standard input, which is normally your terminal. You | |
902 | may have to type @key{ctl-D} to tell @code{@value{AS}} there is no more program | |
903 | to assemble. | |
904 | ||
905 | Use @samp{--} if you need to explicitly name the standard input file | |
906 | in your command line. | |
907 | ||
908 | If the source is empty, @code{@value{AS}} produces a small, empty object | |
909 | file. | |
910 | ||
911 | @subheading Filenames and Line-numbers | |
912 | ||
913 | @cindex input file linenumbers | |
914 | @cindex line numbers, in input files | |
915 | There are two ways of locating a line in the input file (or files) and | |
916 | either may be used in reporting error messages. One way refers to a line | |
917 | number in a physical file; the other refers to a line number in a | |
918 | ``logical'' file. @xref{Errors, ,Error and Warning Messages}. | |
919 | ||
920 | @dfn{Physical files} are those files named in the command line given | |
921 | to @code{@value{AS}}. | |
922 | ||
923 | @dfn{Logical files} are simply names declared explicitly by assembler | |
924 | directives; they bear no relation to physical files. Logical file names help | |
925 | error messages reflect the original source file, when @code{@value{AS}} source | |
926 | is itself synthesized from other files. @code{@value{AS}} understands the | |
927 | @samp{#} directives emitted by the @code{@value{GCC}} preprocessor. See also | |
928 | @ref{File,,@code{.file}}. | |
929 | ||
930 | @node Object | |
931 | @section Output (Object) File | |
932 | ||
933 | @cindex object file | |
934 | @cindex output file | |
935 | @kindex a.out | |
936 | @kindex .o | |
937 | Every time you run @code{@value{AS}} it produces an output file, which is | |
938 | your assembly language program translated into numbers. This file | |
939 | is the object file. Its default name is | |
940 | @ifclear BOUT | |
941 | @code{a.out}. | |
942 | @end ifclear | |
943 | @ifset BOUT | |
944 | @ifset GENERIC | |
945 | @code{a.out}, or | |
946 | @end ifset | |
947 | @code{b.out} when @code{@value{AS}} is configured for the Intel 80960. | |
948 | @end ifset | |
949 | You can give it another name by using the @code{-o} option. Conventionally, | |
950 | object file names end with @file{.o}. The default name is used for historical | |
951 | reasons: older assemblers were capable of assembling self-contained programs | |
952 | directly into a runnable program. (For some formats, this isn't currently | |
953 | possible, but it can be done for the @code{a.out} format.) | |
954 | ||
955 | @cindex linker | |
956 | @kindex ld | |
957 | The object file is meant for input to the linker @code{@value{LD}}. It contains | |
958 | assembled program code, information to help @code{@value{LD}} integrate | |
959 | the assembled program into a runnable file, and (optionally) symbolic | |
960 | information for the debugger. | |
961 | ||
962 | @c link above to some info file(s) like the description of a.out. | |
963 | @c don't forget to describe @sc{gnu} info as well as Unix lossage. | |
964 | ||
965 | @node Errors | |
966 | @section Error and Warning Messages | |
967 | ||
968 | @cindex error messsages | |
969 | @cindex warning messages | |
970 | @cindex messages from assembler | |
971 | @code{@value{AS}} may write warnings and error messages to the standard error | |
972 | file (usually your terminal). This should not happen when a compiler | |
973 | runs @code{@value{AS}} automatically. Warnings report an assumption made so | |
974 | that @code{@value{AS}} could keep assembling a flawed program; errors report a | |
975 | grave problem that stops the assembly. | |
976 | ||
977 | @cindex format of warning messages | |
978 | Warning messages have the format | |
979 | ||
980 | @smallexample | |
981 | file_name:@b{NNN}:Warning Message Text | |
982 | @end smallexample | |
983 | ||
984 | @noindent | |
985 | @cindex line numbers, in warnings/errors | |
986 | (where @b{NNN} is a line number). If a logical file name has been given | |
987 | (@pxref{File,,@code{.file}}) it is used for the filename, otherwise the name of | |
988 | the current input file is used. If a logical line number was given | |
989 | @ifset GENERIC | |
990 | (@pxref{Line,,@code{.line}}) | |
991 | @end ifset | |
992 | @ifclear GENERIC | |
993 | @ifclear A29K | |
994 | (@pxref{Line,,@code{.line}}) | |
995 | @end ifclear | |
996 | @ifset A29K | |
997 | (@pxref{Ln,,@code{.ln}}) | |
998 | @end ifset | |
999 | @end ifclear | |
1000 | then it is used to calculate the number printed, | |
1001 | otherwise the actual line in the current source file is printed. The | |
1002 | message text is intended to be self explanatory (in the grand Unix | |
1003 | tradition). | |
1004 | ||
1005 | @cindex format of error messages | |
1006 | Error messages have the format | |
1007 | @smallexample | |
1008 | file_name:@b{NNN}:FATAL:Error Message Text | |
1009 | @end smallexample | |
1010 | The file name and line number are derived as for warning | |
1011 | messages. The actual message text may be rather less explanatory | |
1012 | because many of them aren't supposed to happen. | |
1013 | ||
1014 | @node Invoking | |
1015 | @chapter Command-Line Options | |
1016 | ||
1017 | @cindex options, all versions of assembler | |
1018 | This chapter describes command-line options available in @emph{all} | |
1019 | versions of the @sc{gnu} assembler; @pxref{Machine Dependencies}, for options specific | |
1020 | @ifclear GENERIC | |
1021 | to the @value{TARGET}. | |
1022 | @end ifclear | |
1023 | @ifset GENERIC | |
1024 | to particular machine architectures. | |
1025 | @end ifset | |
1026 | ||
1027 | If you are invoking @code{@value{AS}} via the @sc{gnu} C compiler (version 2), | |
1028 | you can use the @samp{-Wa} option to pass arguments through to the assembler. | |
1029 | The assembler arguments must be separated from each other (and the @samp{-Wa}) | |
1030 | by commas. For example: | |
1031 | ||
1032 | @smallexample | |
1033 | gcc -c -g -O -Wa,-alh,-L file.c | |
1034 | @end smallexample | |
1035 | ||
1036 | @noindent | |
1037 | This passes two options to the assembler: @samp{-alh} (emit a listing to | |
1038 | standard output with with high-level and assembly source) and @samp{-L} (retain | |
1039 | local symbols in the symbol table). | |
1040 | ||
1041 | Usually you do not need to use this @samp{-Wa} mechanism, since many compiler | |
1042 | command-line options are automatically passed to the assembler by the compiler. | |
1043 | (You can call the @sc{gnu} compiler driver with the @samp{-v} option to see | |
1044 | precisely what options it passes to each compilation pass, including the | |
1045 | assembler.) | |
1046 | ||
1047 | @menu | |
1048 | * a:: -a[cdhlns] enable listings | |
1049 | * D:: -D for compatibility | |
1050 | * f:: -f to work faster | |
1051 | * I:: -I for .include search path | |
1052 | @ifclear DIFF-TBL-KLUGE | |
1053 | * K:: -K for compatibility | |
1054 | @end ifclear | |
1055 | @ifset DIFF-TBL-KLUGE | |
1056 | * K:: -K for difference tables | |
1057 | @end ifset | |
1058 | ||
1059 | * L:: -L to retain local labels | |
1060 | * M:: -M or --mri to assemble in MRI compatibility mode | |
1061 | * MD:: --MD for dependency tracking | |
1062 | * o:: -o to name the object file | |
1063 | * R:: -R to join data and text sections | |
1064 | * statistics:: --statistics to see statistics about assembly | |
1065 | * traditional-format:: --traditional-format for compatible output | |
1066 | * v:: -v to announce version | |
2bdd6cf5 | 1067 | * W:: -W, --no-warn, --warn, --fatal-warnings to control warnings |
252b5132 RH |
1068 | * Z:: -Z to make object file even after errors |
1069 | @end menu | |
1070 | ||
1071 | @node a | |
1072 | @section Enable Listings: @code{-a[cdhlns]} | |
1073 | ||
1074 | @kindex -a | |
1075 | @kindex -ac | |
1076 | @kindex -ad | |
1077 | @kindex -ah | |
1078 | @kindex -al | |
1079 | @kindex -an | |
1080 | @kindex -as | |
1081 | @cindex listings, enabling | |
1082 | @cindex assembly listings, enabling | |
1083 | ||
1084 | These options enable listing output from the assembler. By itself, | |
1085 | @samp{-a} requests high-level, assembly, and symbols listing. | |
1086 | You can use other letters to select specific options for the list: | |
1087 | @samp{-ah} requests a high-level language listing, | |
1088 | @samp{-al} requests an output-program assembly listing, and | |
1089 | @samp{-as} requests a symbol table listing. | |
1090 | High-level listings require that a compiler debugging option like | |
1091 | @samp{-g} be used, and that assembly listings (@samp{-al}) be requested | |
1092 | also. | |
1093 | ||
1094 | Use the @samp{-ac} option to omit false conditionals from a listing. Any lines | |
1095 | which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any | |
1096 | other conditional), or a true @code{.if} followed by an @code{.else}, will be | |
1097 | omitted from the listing. | |
1098 | ||
1099 | Use the @samp{-ad} option to omit debugging directives from the | |
1100 | listing. | |
1101 | ||
1102 | Once you have specified one of these options, you can further control | |
1103 | listing output and its appearance using the directives @code{.list}, | |
1104 | @code{.nolist}, @code{.psize}, @code{.eject}, @code{.title}, and | |
1105 | @code{.sbttl}. | |
1106 | The @samp{-an} option turns off all forms processing. | |
1107 | If you do not request listing output with one of the @samp{-a} options, the | |
1108 | listing-control directives have no effect. | |
1109 | ||
1110 | The letters after @samp{-a} may be combined into one option, | |
1111 | @emph{e.g.}, @samp{-aln}. | |
1112 | ||
1113 | @node D | |
1114 | @section @code{-D} | |
1115 | ||
1116 | @kindex -D | |
1117 | This option has no effect whatsoever, but it is accepted to make it more | |
1118 | likely that scripts written for other assemblers also work with | |
1119 | @code{@value{AS}}. | |
1120 | ||
1121 | @node f | |
1122 | @section Work Faster: @code{-f} | |
1123 | ||
1124 | @kindex -f | |
1125 | @cindex trusted compiler | |
1126 | @cindex faster processing (@code{-f}) | |
1127 | @samp{-f} should only be used when assembling programs written by a | |
1128 | (trusted) compiler. @samp{-f} stops the assembler from doing whitespace | |
1129 | and comment preprocessing on | |
1130 | the input file(s) before assembling them. @xref{Preprocessing, | |
1131 | ,Preprocessing}. | |
1132 | ||
1133 | @quotation | |
1134 | @emph{Warning:} if you use @samp{-f} when the files actually need to be | |
1135 | preprocessed (if they contain comments, for example), @code{@value{AS}} does | |
1136 | not work correctly. | |
1137 | @end quotation | |
1138 | ||
1139 | @node I | |
1140 | @section @code{.include} search path: @code{-I} @var{path} | |
1141 | ||
1142 | @kindex -I @var{path} | |
1143 | @cindex paths for @code{.include} | |
1144 | @cindex search path for @code{.include} | |
1145 | @cindex @code{include} directive search path | |
1146 | Use this option to add a @var{path} to the list of directories | |
1147 | @code{@value{AS}} searches for files specified in @code{.include} | |
1148 | directives (@pxref{Include,,@code{.include}}). You may use @code{-I} as | |
1149 | many times as necessary to include a variety of paths. The current | |
1150 | working directory is always searched first; after that, @code{@value{AS}} | |
1151 | searches any @samp{-I} directories in the same order as they were | |
1152 | specified (left to right) on the command line. | |
1153 | ||
1154 | @node K | |
1155 | @section Difference Tables: @code{-K} | |
1156 | ||
1157 | @kindex -K | |
1158 | @ifclear DIFF-TBL-KLUGE | |
1159 | On the @value{TARGET} family, this option is allowed, but has no effect. It is | |
1160 | permitted for compatibility with the @sc{gnu} assembler on other platforms, | |
1161 | where it can be used to warn when the assembler alters the machine code | |
1162 | generated for @samp{.word} directives in difference tables. The @value{TARGET} | |
1163 | family does not have the addressing limitations that sometimes lead to this | |
1164 | alteration on other platforms. | |
1165 | @end ifclear | |
1166 | ||
1167 | @ifset DIFF-TBL-KLUGE | |
1168 | @cindex difference tables, warning | |
1169 | @cindex warning for altered difference tables | |
1170 | @code{@value{AS}} sometimes alters the code emitted for directives of the form | |
1171 | @samp{.word @var{sym1}-@var{sym2}}; @pxref{Word,,@code{.word}}. | |
1172 | You can use the @samp{-K} option if you want a warning issued when this | |
1173 | is done. | |
1174 | @end ifset | |
1175 | ||
1176 | @node L | |
1177 | @section Include Local Labels: @code{-L} | |
1178 | ||
1179 | @kindex -L | |
1180 | @cindex local labels, retaining in output | |
1181 | Labels beginning with @samp{L} (upper case only) are called @dfn{local | |
1182 | labels}. @xref{Symbol Names}. Normally you do not see such labels when | |
1183 | debugging, because they are intended for the use of programs (like | |
1184 | compilers) that compose assembler programs, not for your notice. | |
1185 | Normally both @code{@value{AS}} and @code{@value{LD}} discard such labels, so you do not | |
1186 | normally debug with them. | |
1187 | ||
1188 | This option tells @code{@value{AS}} to retain those @samp{L@dots{}} symbols | |
1189 | in the object file. Usually if you do this you also tell the linker | |
1190 | @code{@value{LD}} to preserve symbols whose names begin with @samp{L}. | |
1191 | ||
1192 | By default, a local label is any label beginning with @samp{L}, but each | |
1193 | target is allowed to redefine the local label prefix. | |
1194 | @ifset HPPA | |
1195 | On the HPPA local labels begin with @samp{L$}. | |
1196 | @end ifset | |
252b5132 RH |
1197 | |
1198 | @node M | |
1199 | @section Assemble in MRI Compatibility Mode: @code{-M} | |
1200 | ||
1201 | @kindex -M | |
1202 | @cindex MRI compatibility mode | |
1203 | The @code{-M} or @code{--mri} option selects MRI compatibility mode. This | |
1204 | changes the syntax and pseudo-op handling of @code{@value{AS}} to make it | |
1205 | compatible with the @code{ASM68K} or the @code{ASM960} (depending upon the | |
1206 | configured target) assembler from Microtec Research. The exact nature of the | |
1207 | MRI syntax will not be documented here; see the MRI manuals for more | |
1208 | information. Note in particular that the handling of macros and macro | |
1209 | arguments is somewhat different. The purpose of this option is to permit | |
1210 | assembling existing MRI assembler code using @code{@value{AS}}. | |
1211 | ||
1212 | The MRI compatibility is not complete. Certain operations of the MRI assembler | |
1213 | depend upon its object file format, and can not be supported using other object | |
1214 | file formats. Supporting these would require enhancing each object file format | |
1215 | individually. These are: | |
1216 | ||
1217 | @itemize @bullet | |
1218 | @item global symbols in common section | |
1219 | ||
1220 | The m68k MRI assembler supports common sections which are merged by the linker. | |
1221 | Other object file formats do not support this. @code{@value{AS}} handles | |
1222 | common sections by treating them as a single common symbol. It permits local | |
1223 | symbols to be defined within a common section, but it can not support global | |
1224 | symbols, since it has no way to describe them. | |
1225 | ||
1226 | @item complex relocations | |
1227 | ||
1228 | The MRI assemblers support relocations against a negated section address, and | |
1229 | relocations which combine the start addresses of two or more sections. These | |
1230 | are not support by other object file formats. | |
1231 | ||
1232 | @item @code{END} pseudo-op specifying start address | |
1233 | ||
1234 | The MRI @code{END} pseudo-op permits the specification of a start address. | |
1235 | This is not supported by other object file formats. The start address may | |
1236 | instead be specified using the @code{-e} option to the linker, or in a linker | |
1237 | script. | |
1238 | ||
1239 | @item @code{IDNT}, @code{.ident} and @code{NAME} pseudo-ops | |
1240 | ||
1241 | The MRI @code{IDNT}, @code{.ident} and @code{NAME} pseudo-ops assign a module | |
1242 | name to the output file. This is not supported by other object file formats. | |
1243 | ||
1244 | @item @code{ORG} pseudo-op | |
1245 | ||
1246 | The m68k MRI @code{ORG} pseudo-op begins an absolute section at a given | |
1247 | address. This differs from the usual @code{@value{AS}} @code{.org} pseudo-op, | |
1248 | which changes the location within the current section. Absolute sections are | |
1249 | not supported by other object file formats. The address of a section may be | |
1250 | assigned within a linker script. | |
1251 | @end itemize | |
1252 | ||
1253 | There are some other features of the MRI assembler which are not supported by | |
1254 | @code{@value{AS}}, typically either because they are difficult or because they | |
1255 | seem of little consequence. Some of these may be supported in future releases. | |
1256 | ||
1257 | @itemize @bullet | |
1258 | ||
1259 | @item EBCDIC strings | |
1260 | ||
1261 | EBCDIC strings are not supported. | |
1262 | ||
1263 | @item packed binary coded decimal | |
1264 | ||
1265 | Packed binary coded decimal is not supported. This means that the @code{DC.P} | |
1266 | and @code{DCB.P} pseudo-ops are not supported. | |
1267 | ||
1268 | @item @code{FEQU} pseudo-op | |
1269 | ||
1270 | The m68k @code{FEQU} pseudo-op is not supported. | |
1271 | ||
1272 | @item @code{NOOBJ} pseudo-op | |
1273 | ||
1274 | The m68k @code{NOOBJ} pseudo-op is not supported. | |
1275 | ||
1276 | @item @code{OPT} branch control options | |
1277 | ||
1278 | The m68k @code{OPT} branch control options---@code{B}, @code{BRS}, @code{BRB}, | |
1279 | @code{BRL}, and @code{BRW}---are ignored. @code{@value{AS}} automatically | |
1280 | relaxes all branches, whether forward or backward, to an appropriate size, so | |
1281 | these options serve no purpose. | |
1282 | ||
1283 | @item @code{OPT} list control options | |
1284 | ||
1285 | The following m68k @code{OPT} list control options are ignored: @code{C}, | |
1286 | @code{CEX}, @code{CL}, @code{CRE}, @code{E}, @code{G}, @code{I}, @code{M}, | |
1287 | @code{MEX}, @code{MC}, @code{MD}, @code{X}. | |
1288 | ||
1289 | @item other @code{OPT} options | |
1290 | ||
1291 | The following m68k @code{OPT} options are ignored: @code{NEST}, @code{O}, | |
1292 | @code{OLD}, @code{OP}, @code{P}, @code{PCO}, @code{PCR}, @code{PCS}, @code{R}. | |
1293 | ||
1294 | @item @code{OPT} @code{D} option is default | |
1295 | ||
1296 | The m68k @code{OPT} @code{D} option is the default, unlike the MRI assembler. | |
1297 | @code{OPT NOD} may be used to turn it off. | |
1298 | ||
1299 | @item @code{XREF} pseudo-op. | |
1300 | ||
1301 | The m68k @code{XREF} pseudo-op is ignored. | |
1302 | ||
1303 | @item @code{.debug} pseudo-op | |
1304 | ||
1305 | The i960 @code{.debug} pseudo-op is not supported. | |
1306 | ||
1307 | @item @code{.extended} pseudo-op | |
1308 | ||
1309 | The i960 @code{.extended} pseudo-op is not supported. | |
1310 | ||
1311 | @item @code{.list} pseudo-op. | |
1312 | ||
1313 | The various options of the i960 @code{.list} pseudo-op are not supported. | |
1314 | ||
1315 | @item @code{.optimize} pseudo-op | |
1316 | ||
1317 | The i960 @code{.optimize} pseudo-op is not supported. | |
1318 | ||
1319 | @item @code{.output} pseudo-op | |
1320 | ||
1321 | The i960 @code{.output} pseudo-op is not supported. | |
1322 | ||
1323 | @item @code{.setreal} pseudo-op | |
1324 | ||
1325 | The i960 @code{.setreal} pseudo-op is not supported. | |
1326 | ||
1327 | @end itemize | |
1328 | ||
1329 | @node MD | |
1330 | @section Dependency tracking: @code{--MD} | |
1331 | ||
1332 | @kindex --MD | |
1333 | @cindex dependency tracking | |
1334 | @cindex make rules | |
1335 | ||
1336 | @code{@value{AS}} can generate a dependency file for the file it creates. This | |
1337 | file consists of a single rule suitable for @code{make} describing the | |
1338 | dependencies of the main source file. | |
1339 | ||
1340 | The rule is written to the file named in its argument. | |
1341 | ||
1342 | This feature is used in the automatic updating of makefiles. | |
1343 | ||
1344 | @node o | |
1345 | @section Name the Object File: @code{-o} | |
1346 | ||
1347 | @kindex -o | |
1348 | @cindex naming object file | |
1349 | @cindex object file name | |
1350 | There is always one object file output when you run @code{@value{AS}}. By | |
1351 | default it has the name | |
1352 | @ifset GENERIC | |
1353 | @ifset I960 | |
1354 | @file{a.out} (or @file{b.out}, for Intel 960 targets only). | |
1355 | @end ifset | |
1356 | @ifclear I960 | |
1357 | @file{a.out}. | |
1358 | @end ifclear | |
1359 | @end ifset | |
1360 | @ifclear GENERIC | |
1361 | @ifset I960 | |
1362 | @file{b.out}. | |
1363 | @end ifset | |
1364 | @ifclear I960 | |
1365 | @file{a.out}. | |
1366 | @end ifclear | |
1367 | @end ifclear | |
1368 | You use this option (which takes exactly one filename) to give the | |
1369 | object file a different name. | |
1370 | ||
1371 | Whatever the object file is called, @code{@value{AS}} overwrites any | |
1372 | existing file of the same name. | |
1373 | ||
1374 | @node R | |
1375 | @section Join Data and Text Sections: @code{-R} | |
1376 | ||
1377 | @kindex -R | |
1378 | @cindex data and text sections, joining | |
1379 | @cindex text and data sections, joining | |
1380 | @cindex joining text and data sections | |
1381 | @cindex merging text and data sections | |
1382 | @code{-R} tells @code{@value{AS}} to write the object file as if all | |
1383 | data-section data lives in the text section. This is only done at | |
1384 | the very last moment: your binary data are the same, but data | |
1385 | section parts are relocated differently. The data section part of | |
1386 | your object file is zero bytes long because all its bytes are | |
1387 | appended to the text section. (@xref{Sections,,Sections and Relocation}.) | |
1388 | ||
1389 | When you specify @code{-R} it would be possible to generate shorter | |
1390 | address displacements (because we do not have to cross between text and | |
1391 | data section). We refrain from doing this simply for compatibility with | |
1392 | older versions of @code{@value{AS}}. In future, @code{-R} may work this way. | |
1393 | ||
1394 | @ifset COFF | |
1395 | When @code{@value{AS}} is configured for COFF output, | |
1396 | this option is only useful if you use sections named @samp{.text} and | |
1397 | @samp{.data}. | |
1398 | @end ifset | |
1399 | ||
1400 | @ifset HPPA | |
1401 | @code{-R} is not supported for any of the HPPA targets. Using | |
1402 | @code{-R} generates a warning from @code{@value{AS}}. | |
1403 | @end ifset | |
1404 | ||
1405 | @node statistics | |
1406 | @section Display Assembly Statistics: @code{--statistics} | |
1407 | ||
1408 | @kindex --statistics | |
1409 | @cindex statistics, about assembly | |
1410 | @cindex time, total for assembly | |
1411 | @cindex space used, maximum for assembly | |
1412 | Use @samp{--statistics} to display two statistics about the resources used by | |
1413 | @code{@value{AS}}: the maximum amount of space allocated during the assembly | |
1414 | (in bytes), and the total execution time taken for the assembly (in @sc{cpu} | |
1415 | seconds). | |
1416 | ||
1417 | @node traditional-format | |
1418 | @section Compatible output: @code{--traditional-format} | |
1419 | ||
1420 | @kindex --traditional-format | |
1421 | For some targets, the output of @code{@value{AS}} is different in some ways | |
1422 | from the output of some existing assembler. This switch requests | |
1423 | @code{@value{AS}} to use the traditional format instead. | |
1424 | ||
1425 | For example, it disables the exception frame optimizations which | |
1426 | @code{@value{AS}} normally does by default on @code{@value{GCC}} output. | |
1427 | ||
1428 | @node v | |
1429 | @section Announce Version: @code{-v} | |
1430 | ||
1431 | @kindex -v | |
1432 | @kindex -version | |
1433 | @cindex assembler version | |
1434 | @cindex version of assembler | |
1435 | You can find out what version of as is running by including the | |
1436 | option @samp{-v} (which you can also spell as @samp{-version}) on the | |
1437 | command line. | |
1438 | ||
1439 | @node W | |
2bdd6cf5 | 1440 | @section Control Warnings: @code{-W}, @code{--warn}, @code{--no-warn}, @code{--fatal-warnings} |
252b5132 | 1441 | |
252b5132 RH |
1442 | @code{@value{AS}} should never give a warning or error message when |
1443 | assembling compiler output. But programs written by people often | |
1444 | cause @code{@value{AS}} to give a warning that a particular assumption was | |
1445 | made. All such warnings are directed to the standard error file. | |
2bdd6cf5 GK |
1446 | |
1447 | @kindex @samp{-W} | |
1448 | @kindex @samp{--no-warn} | |
1449 | @cindex suppressing warnings | |
1450 | @cindex warnings, suppressing | |
1451 | If you use the @code{-W} and @code{--no-warn} options, no warnings are issued. | |
1452 | This only affects the warning messages: it does not change any particular of | |
1453 | how @code{@value{AS}} assembles your file. Errors, which stop the assembly, | |
1454 | are still reported. | |
1455 | ||
1456 | @kindex @samp{--fatal-warnings} | |
1457 | @cindex errors, caused by warnings | |
1458 | @cindex warnings, causing error | |
1459 | If you use the @code{--fatal-warnings} option, @code{@value{AS}} considers | |
1460 | files that generate warnings to be in error. | |
1461 | ||
1462 | @kindex @samp{--warn} | |
1463 | @cindex warnings, switching on | |
1464 | You can switch these options off again by specifying @code{--warn}, which | |
1465 | causes warnings to be output as usual. | |
252b5132 RH |
1466 | |
1467 | @node Z | |
1468 | @section Generate Object File in Spite of Errors: @code{-Z} | |
1469 | @cindex object file, after errors | |
1470 | @cindex errors, continuing after | |
1471 | After an error message, @code{@value{AS}} normally produces no output. If for | |
1472 | some reason you are interested in object file output even after | |
1473 | @code{@value{AS}} gives an error message on your program, use the @samp{-Z} | |
1474 | option. If there are any errors, @code{@value{AS}} continues anyways, and | |
1475 | writes an object file after a final warning message of the form @samp{@var{n} | |
1476 | errors, @var{m} warnings, generating bad object file.} | |
1477 | ||
1478 | @node Syntax | |
1479 | @chapter Syntax | |
1480 | ||
1481 | @cindex machine-independent syntax | |
1482 | @cindex syntax, machine-independent | |
1483 | This chapter describes the machine-independent syntax allowed in a | |
1484 | source file. @code{@value{AS}} syntax is similar to what many other | |
1485 | assemblers use; it is inspired by the BSD 4.2 | |
1486 | @ifclear VAX | |
1487 | assembler. | |
1488 | @end ifclear | |
1489 | @ifset VAX | |
1490 | assembler, except that @code{@value{AS}} does not assemble Vax bit-fields. | |
1491 | @end ifset | |
1492 | ||
1493 | @menu | |
1494 | * Preprocessing:: Preprocessing | |
1495 | * Whitespace:: Whitespace | |
1496 | * Comments:: Comments | |
1497 | * Symbol Intro:: Symbols | |
1498 | * Statements:: Statements | |
1499 | * Constants:: Constants | |
1500 | @end menu | |
1501 | ||
1502 | @node Preprocessing | |
1503 | @section Preprocessing | |
1504 | ||
1505 | @cindex preprocessing | |
1506 | The @code{@value{AS}} internal preprocessor: | |
1507 | @itemize @bullet | |
1508 | @cindex whitespace, removed by preprocessor | |
1509 | @item | |
1510 | adjusts and removes extra whitespace. It leaves one space or tab before | |
1511 | the keywords on a line, and turns any other whitespace on the line into | |
1512 | a single space. | |
1513 | ||
1514 | @cindex comments, removed by preprocessor | |
1515 | @item | |
1516 | removes all comments, replacing them with a single space, or an | |
1517 | appropriate number of newlines. | |
1518 | ||
1519 | @cindex constants, converted by preprocessor | |
1520 | @item | |
1521 | converts character constants into the appropriate numeric values. | |
1522 | @end itemize | |
1523 | ||
1524 | It does not do macro processing, include file handling, or | |
1525 | anything else you may get from your C compiler's preprocessor. You can | |
1526 | do include file processing with the @code{.include} directive | |
1527 | (@pxref{Include,,@code{.include}}). You can use the @sc{gnu} C compiler driver | |
1528 | to get other ``CPP'' style preprocessing, by giving the input file a | |
1529 | @samp{.S} suffix. @xref{Overall Options,, Options Controlling the Kind of | |
1530 | Output, gcc.info, Using GNU CC}. | |
1531 | ||
1532 | Excess whitespace, comments, and character constants | |
1533 | cannot be used in the portions of the input text that are not | |
1534 | preprocessed. | |
1535 | ||
1536 | @cindex turning preprocessing on and off | |
1537 | @cindex preprocessing, turning on and off | |
1538 | @kindex #NO_APP | |
1539 | @kindex #APP | |
1540 | If the first line of an input file is @code{#NO_APP} or if you use the | |
1541 | @samp{-f} option, whitespace and comments are not removed from the input file. | |
1542 | Within an input file, you can ask for whitespace and comment removal in | |
1543 | specific portions of the by putting a line that says @code{#APP} before the | |
1544 | text that may contain whitespace or comments, and putting a line that says | |
1545 | @code{#NO_APP} after this text. This feature is mainly intend to support | |
1546 | @code{asm} statements in compilers whose output is otherwise free of comments | |
1547 | and whitespace. | |
1548 | ||
1549 | @node Whitespace | |
1550 | @section Whitespace | |
1551 | ||
1552 | @cindex whitespace | |
1553 | @dfn{Whitespace} is one or more blanks or tabs, in any order. | |
1554 | Whitespace is used to separate symbols, and to make programs neater for | |
1555 | people to read. Unless within character constants | |
1556 | (@pxref{Characters,,Character Constants}), any whitespace means the same | |
1557 | as exactly one space. | |
1558 | ||
1559 | @node Comments | |
1560 | @section Comments | |
1561 | ||
1562 | @cindex comments | |
1563 | There are two ways of rendering comments to @code{@value{AS}}. In both | |
1564 | cases the comment is equivalent to one space. | |
1565 | ||
1566 | Anything from @samp{/*} through the next @samp{*/} is a comment. | |
1567 | This means you may not nest these comments. | |
1568 | ||
1569 | @smallexample | |
1570 | /* | |
1571 | The only way to include a newline ('\n') in a comment | |
1572 | is to use this sort of comment. | |
1573 | */ | |
1574 | ||
1575 | /* This sort of comment does not nest. */ | |
1576 | @end smallexample | |
1577 | ||
1578 | @cindex line comment character | |
1579 | Anything from the @dfn{line comment} character to the next newline | |
1580 | is considered a comment and is ignored. The line comment character is | |
1581 | @ifset A29K | |
1582 | @samp{;} for the AMD 29K family; | |
1583 | @end ifset | |
1584 | @ifset ARC | |
1585 | @samp{;} on the ARC; | |
1586 | @end ifset | |
550262c4 NC |
1587 | @ifset ARM |
1588 | @samp{@@} on the ARM; | |
1589 | @end ifset | |
252b5132 RH |
1590 | @ifset H8/300 |
1591 | @samp{;} for the H8/300 family; | |
1592 | @end ifset | |
1593 | @ifset H8/500 | |
1594 | @samp{!} for the H8/500 family; | |
1595 | @end ifset | |
1596 | @ifset HPPA | |
1597 | @samp{;} for the HPPA; | |
1598 | @end ifset | |
1599 | @ifset I960 | |
1600 | @samp{#} on the i960; | |
1601 | @end ifset | |
041dd5a9 ILT |
1602 | @ifset PJ |
1603 | @samp{;} for picoJava; | |
1604 | @end ifset | |
252b5132 RH |
1605 | @ifset SH |
1606 | @samp{!} for the Hitachi SH; | |
1607 | @end ifset | |
1608 | @ifset SPARC | |
1609 | @samp{!} on the SPARC; | |
1610 | @end ifset | |
1611 | @ifset M32R | |
1612 | @samp{#} on the m32r; | |
1613 | @end ifset | |
1614 | @ifset M680X0 | |
1615 | @samp{|} on the 680x0; | |
1616 | @end ifset | |
1617 | @ifset VAX | |
1618 | @samp{#} on the Vax; | |
1619 | @end ifset | |
1620 | @ifset Z8000 | |
1621 | @samp{!} for the Z8000; | |
1622 | @end ifset | |
1623 | @ifset V850 | |
1624 | @samp{#} on the V850; | |
1625 | @end ifset | |
1626 | see @ref{Machine Dependencies}. @refill | |
1627 | @c FIXME What about i386, m88k, i860? | |
1628 | ||
1629 | @ifset GENERIC | |
1630 | On some machines there are two different line comment characters. One | |
1631 | character only begins a comment if it is the first non-whitespace character on | |
1632 | a line, while the other always begins a comment. | |
1633 | @end ifset | |
1634 | ||
1635 | @ifset V850 | |
1636 | The V850 assembler also supports a double dash as starting a comment that | |
1637 | extends to the end of the line. | |
1638 | ||
1639 | @samp{--}; | |
1640 | @end ifset | |
1641 | ||
1642 | @kindex # | |
1643 | @cindex lines starting with @code{#} | |
1644 | @cindex logical line numbers | |
1645 | To be compatible with past assemblers, lines that begin with @samp{#} have a | |
1646 | special interpretation. Following the @samp{#} should be an absolute | |
1647 | expression (@pxref{Expressions}): the logical line number of the @emph{next} | |
1648 | line. Then a string (@pxref{Strings,, Strings}) is allowed: if present it is a | |
1649 | new logical file name. The rest of the line, if any, should be whitespace. | |
1650 | ||
1651 | If the first non-whitespace characters on the line are not numeric, | |
1652 | the line is ignored. (Just like a comment.) | |
1653 | ||
1654 | @smallexample | |
1655 | # This is an ordinary comment. | |
1656 | # 42-6 "new_file_name" # New logical file name | |
1657 | # This is logical line # 36. | |
1658 | @end smallexample | |
1659 | This feature is deprecated, and may disappear from future versions | |
1660 | of @code{@value{AS}}. | |
1661 | ||
1662 | @node Symbol Intro | |
1663 | @section Symbols | |
1664 | ||
1665 | @cindex characters used in symbols | |
1666 | @ifclear SPECIAL-SYMS | |
1667 | A @dfn{symbol} is one or more characters chosen from the set of all | |
1668 | letters (both upper and lower case), digits and the three characters | |
1669 | @samp{_.$}. | |
1670 | @end ifclear | |
1671 | @ifset SPECIAL-SYMS | |
1672 | @ifclear GENERIC | |
1673 | @ifset H8 | |
1674 | A @dfn{symbol} is one or more characters chosen from the set of all | |
1675 | letters (both upper and lower case), digits and the three characters | |
1676 | @samp{._$}. (Save that, on the H8/300 only, you may not use @samp{$} in | |
1677 | symbol names.) | |
1678 | @end ifset | |
1679 | @end ifclear | |
1680 | @end ifset | |
1681 | @ifset GENERIC | |
1682 | On most machines, you can also use @code{$} in symbol names; exceptions | |
1683 | are noted in @ref{Machine Dependencies}. | |
1684 | @end ifset | |
1685 | No symbol may begin with a digit. Case is significant. | |
1686 | There is no length limit: all characters are significant. Symbols are | |
1687 | delimited by characters not in that set, or by the beginning of a file | |
1688 | (since the source program must end with a newline, the end of a file is | |
1689 | not a possible symbol delimiter). @xref{Symbols}. | |
1690 | @cindex length of symbols | |
1691 | ||
1692 | @node Statements | |
1693 | @section Statements | |
1694 | ||
1695 | @cindex statements, structure of | |
1696 | @cindex line separator character | |
1697 | @cindex statement separator character | |
1698 | @ifclear GENERIC | |
1699 | @ifclear abnormal-separator | |
1700 | A @dfn{statement} ends at a newline character (@samp{\n}) or at a | |
1701 | semicolon (@samp{;}). The newline or semicolon is considered part of | |
1702 | the preceding statement. Newlines and semicolons within character | |
1703 | constants are an exception: they do not end statements. | |
1704 | @end ifclear | |
1705 | @ifset abnormal-separator | |
1706 | @ifset A29K | |
1707 | A @dfn{statement} ends at a newline character (@samp{\n}) or an ``at'' | |
1708 | sign (@samp{@@}). The newline or at sign is considered part of the | |
1709 | preceding statement. Newlines and at signs within character constants | |
1710 | are an exception: they do not end statements. | |
1711 | @end ifset | |
1712 | @ifset HPPA | |
1713 | A @dfn{statement} ends at a newline character (@samp{\n}) or an exclamation | |
1714 | point (@samp{!}). The newline or exclamation point is considered part of the | |
1715 | preceding statement. Newlines and exclamation points within character | |
1716 | constants are an exception: they do not end statements. | |
1717 | @end ifset | |
1718 | @ifset H8 | |
1719 | A @dfn{statement} ends at a newline character (@samp{\n}); or (for the | |
1720 | H8/300) a dollar sign (@samp{$}); or (for the | |
1721 | Hitachi-SH or the | |
1722 | H8/500) a semicolon | |
1723 | (@samp{;}). The newline or separator character is considered part of | |
1724 | the preceding statement. Newlines and separators within character | |
1725 | constants are an exception: they do not end statements. | |
1726 | @end ifset | |
1727 | @end ifset | |
1728 | @end ifclear | |
1729 | @ifset GENERIC | |
1730 | A @dfn{statement} ends at a newline character (@samp{\n}) or line | |
1731 | separator character. (The line separator is usually @samp{;}, unless | |
1732 | this conflicts with the comment character; @pxref{Machine Dependencies}.) The | |
1733 | newline or separator character is considered part of the preceding | |
1734 | statement. Newlines and separators within character constants are an | |
1735 | exception: they do not end statements. | |
1736 | @end ifset | |
1737 | ||
1738 | @cindex newline, required at file end | |
1739 | @cindex EOF, newline must precede | |
1740 | It is an error to end any statement with end-of-file: the last | |
1741 | character of any input file should be a newline.@refill | |
1742 | ||
1743 | An empty statement is allowed, and may include whitespace. It is ignored. | |
1744 | ||
1745 | @cindex instructions and directives | |
1746 | @cindex directives and instructions | |
1747 | @c "key symbol" is not used elsewhere in the document; seems pedantic to | |
1748 | @c @defn{} it in that case, as was done previously... doc@cygnus.com, | |
1749 | @c 13feb91. | |
1750 | A statement begins with zero or more labels, optionally followed by a | |
1751 | key symbol which determines what kind of statement it is. The key | |
1752 | symbol determines the syntax of the rest of the statement. If the | |
1753 | symbol begins with a dot @samp{.} then the statement is an assembler | |
1754 | directive: typically valid for any computer. If the symbol begins with | |
1755 | a letter the statement is an assembly language @dfn{instruction}: it | |
1756 | assembles into a machine language instruction. | |
1757 | @ifset GENERIC | |
1758 | Different versions of @code{@value{AS}} for different computers | |
1759 | recognize different instructions. In fact, the same symbol may | |
1760 | represent a different instruction in a different computer's assembly | |
1761 | language.@refill | |
1762 | @end ifset | |
1763 | ||
1764 | @cindex @code{:} (label) | |
1765 | @cindex label (@code{:}) | |
1766 | A label is a symbol immediately followed by a colon (@code{:}). | |
1767 | Whitespace before a label or after a colon is permitted, but you may not | |
1768 | have whitespace between a label's symbol and its colon. @xref{Labels}. | |
1769 | ||
1770 | @ifset HPPA | |
1771 | For HPPA targets, labels need not be immediately followed by a colon, but | |
1772 | the definition of a label must begin in column zero. This also implies that | |
1773 | only one label may be defined on each line. | |
1774 | @end ifset | |
1775 | ||
1776 | @smallexample | |
1777 | label: .directive followed by something | |
1778 | another_label: # This is an empty statement. | |
1779 | instruction operand_1, operand_2, @dots{} | |
1780 | @end smallexample | |
1781 | ||
1782 | @node Constants | |
1783 | @section Constants | |
1784 | ||
1785 | @cindex constants | |
1786 | A constant is a number, written so that its value is known by | |
1787 | inspection, without knowing any context. Like this: | |
1788 | @smallexample | |
1789 | @group | |
1790 | .byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value. | |
1791 | .ascii "Ring the bell\7" # A string constant. | |
1792 | .octa 0x123456789abcdef0123456789ABCDEF0 # A bignum. | |
1793 | .float 0f-314159265358979323846264338327\ | |
1794 | 95028841971.693993751E-40 # - pi, a flonum. | |
1795 | @end group | |
1796 | @end smallexample | |
1797 | ||
1798 | @menu | |
1799 | * Characters:: Character Constants | |
1800 | * Numbers:: Number Constants | |
1801 | @end menu | |
1802 | ||
1803 | @node Characters | |
1804 | @subsection Character Constants | |
1805 | ||
1806 | @cindex character constants | |
1807 | @cindex constants, character | |
1808 | There are two kinds of character constants. A @dfn{character} stands | |
1809 | for one character in one byte and its value may be used in | |
1810 | numeric expressions. String constants (properly called string | |
1811 | @emph{literals}) are potentially many bytes and their values may not be | |
1812 | used in arithmetic expressions. | |
1813 | ||
1814 | @menu | |
1815 | * Strings:: Strings | |
1816 | * Chars:: Characters | |
1817 | @end menu | |
1818 | ||
1819 | @node Strings | |
1820 | @subsubsection Strings | |
1821 | ||
1822 | @cindex string constants | |
1823 | @cindex constants, string | |
1824 | A @dfn{string} is written between double-quotes. It may contain | |
1825 | double-quotes or null characters. The way to get special characters | |
1826 | into a string is to @dfn{escape} these characters: precede them with | |
1827 | a backslash @samp{\} character. For example @samp{\\} represents | |
1828 | one backslash: the first @code{\} is an escape which tells | |
1829 | @code{@value{AS}} to interpret the second character literally as a backslash | |
1830 | (which prevents @code{@value{AS}} from recognizing the second @code{\} as an | |
1831 | escape character). The complete list of escapes follows. | |
1832 | ||
1833 | @cindex escape codes, character | |
1834 | @cindex character escape codes | |
1835 | @table @kbd | |
1836 | @c @item \a | |
1837 | @c Mnemonic for ACKnowledge; for ASCII this is octal code 007. | |
1838 | @c | |
1839 | @cindex @code{\b} (backspace character) | |
1840 | @cindex backspace (@code{\b}) | |
1841 | @item \b | |
1842 | Mnemonic for backspace; for ASCII this is octal code 010. | |
1843 | ||
1844 | @c @item \e | |
1845 | @c Mnemonic for EOText; for ASCII this is octal code 004. | |
1846 | @c | |
1847 | @cindex @code{\f} (formfeed character) | |
1848 | @cindex formfeed (@code{\f}) | |
1849 | @item \f | |
1850 | Mnemonic for FormFeed; for ASCII this is octal code 014. | |
1851 | ||
1852 | @cindex @code{\n} (newline character) | |
1853 | @cindex newline (@code{\n}) | |
1854 | @item \n | |
1855 | Mnemonic for newline; for ASCII this is octal code 012. | |
1856 | ||
1857 | @c @item \p | |
1858 | @c Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}. | |
1859 | @c | |
1860 | @cindex @code{\r} (carriage return character) | |
1861 | @cindex carriage return (@code{\r}) | |
1862 | @item \r | |
1863 | Mnemonic for carriage-Return; for ASCII this is octal code 015. | |
1864 | ||
1865 | @c @item \s | |
1866 | @c Mnemonic for space; for ASCII this is octal code 040. Included for compliance with | |
1867 | @c other assemblers. | |
1868 | @c | |
1869 | @cindex @code{\t} (tab) | |
1870 | @cindex tab (@code{\t}) | |
1871 | @item \t | |
1872 | Mnemonic for horizontal Tab; for ASCII this is octal code 011. | |
1873 | ||
1874 | @c @item \v | |
1875 | @c Mnemonic for Vertical tab; for ASCII this is octal code 013. | |
1876 | @c @item \x @var{digit} @var{digit} @var{digit} | |
1877 | @c A hexadecimal character code. The numeric code is 3 hexadecimal digits. | |
1878 | @c | |
1879 | @cindex @code{\@var{ddd}} (octal character code) | |
1880 | @cindex octal character code (@code{\@var{ddd}}) | |
1881 | @item \ @var{digit} @var{digit} @var{digit} | |
1882 | An octal character code. The numeric code is 3 octal digits. | |
1883 | For compatibility with other Unix systems, 8 and 9 are accepted as digits: | |
1884 | for example, @code{\008} has the value 010, and @code{\009} the value 011. | |
1885 | ||
1886 | @cindex @code{\@var{xd...}} (hex character code) | |
1887 | @cindex hex character code (@code{\@var{xd...}}) | |
1888 | @item \@code{x} @var{hex-digits...} | |
1889 | A hex character code. All trailing hex digits are combined. Either upper or | |
1890 | lower case @code{x} works. | |
1891 | ||
1892 | @cindex @code{\\} (@samp{\} character) | |
1893 | @cindex backslash (@code{\\}) | |
1894 | @item \\ | |
1895 | Represents one @samp{\} character. | |
1896 | ||
1897 | @c @item \' | |
1898 | @c Represents one @samp{'} (accent acute) character. | |
1899 | @c This is needed in single character literals | |
1900 | @c (@xref{Characters,,Character Constants}.) to represent | |
1901 | @c a @samp{'}. | |
1902 | @c | |
1903 | @cindex @code{\"} (doublequote character) | |
1904 | @cindex doublequote (@code{\"}) | |
1905 | @item \" | |
1906 | Represents one @samp{"} character. Needed in strings to represent | |
1907 | this character, because an unescaped @samp{"} would end the string. | |
1908 | ||
1909 | @item \ @var{anything-else} | |
1910 | Any other character when escaped by @kbd{\} gives a warning, but | |
1911 | assembles as if the @samp{\} was not present. The idea is that if | |
1912 | you used an escape sequence you clearly didn't want the literal | |
1913 | interpretation of the following character. However @code{@value{AS}} has no | |
1914 | other interpretation, so @code{@value{AS}} knows it is giving you the wrong | |
1915 | code and warns you of the fact. | |
1916 | @end table | |
1917 | ||
1918 | Which characters are escapable, and what those escapes represent, | |
1919 | varies widely among assemblers. The current set is what we think | |
1920 | the BSD 4.2 assembler recognizes, and is a subset of what most C | |
1921 | compilers recognize. If you are in doubt, do not use an escape | |
1922 | sequence. | |
1923 | ||
1924 | @node Chars | |
1925 | @subsubsection Characters | |
1926 | ||
1927 | @cindex single character constant | |
1928 | @cindex character, single | |
1929 | @cindex constant, single character | |
1930 | A single character may be written as a single quote immediately | |
1931 | followed by that character. The same escapes apply to characters as | |
1932 | to strings. So if you want to write the character backslash, you | |
1933 | must write @kbd{'\\} where the first @code{\} escapes the second | |
1934 | @code{\}. As you can see, the quote is an acute accent, not a | |
1935 | grave accent. A newline | |
1936 | @ifclear GENERIC | |
1937 | @ifclear abnormal-separator | |
1938 | (or semicolon @samp{;}) | |
1939 | @end ifclear | |
1940 | @ifset abnormal-separator | |
1941 | @ifset A29K | |
1942 | (or at sign @samp{@@}) | |
1943 | @end ifset | |
1944 | @ifset H8 | |
1945 | (or dollar sign @samp{$}, for the H8/300; or semicolon @samp{;} for the | |
1946 | Hitachi SH or | |
1947 | H8/500) | |
1948 | @end ifset | |
1949 | @end ifset | |
1950 | @end ifclear | |
1951 | immediately following an acute accent is taken as a literal character | |
1952 | and does not count as the end of a statement. The value of a character | |
1953 | constant in a numeric expression is the machine's byte-wide code for | |
1954 | that character. @code{@value{AS}} assumes your character code is ASCII: | |
1955 | @kbd{'A} means 65, @kbd{'B} means 66, and so on. @refill | |
1956 | ||
1957 | @node Numbers | |
1958 | @subsection Number Constants | |
1959 | ||
1960 | @cindex constants, number | |
1961 | @cindex number constants | |
1962 | @code{@value{AS}} distinguishes three kinds of numbers according to how they | |
1963 | are stored in the target machine. @emph{Integers} are numbers that | |
1964 | would fit into an @code{int} in the C language. @emph{Bignums} are | |
1965 | integers, but they are stored in more than 32 bits. @emph{Flonums} | |
1966 | are floating point numbers, described below. | |
1967 | ||
1968 | @menu | |
1969 | * Integers:: Integers | |
1970 | * Bignums:: Bignums | |
1971 | * Flonums:: Flonums | |
1972 | @ifclear GENERIC | |
1973 | @ifset I960 | |
1974 | * Bit Fields:: Bit Fields | |
1975 | @end ifset | |
1976 | @end ifclear | |
1977 | @end menu | |
1978 | ||
1979 | @node Integers | |
1980 | @subsubsection Integers | |
1981 | @cindex integers | |
1982 | @cindex constants, integer | |
1983 | ||
1984 | @cindex binary integers | |
1985 | @cindex integers, binary | |
1986 | A binary integer is @samp{0b} or @samp{0B} followed by zero or more of | |
1987 | the binary digits @samp{01}. | |
1988 | ||
1989 | @cindex octal integers | |
1990 | @cindex integers, octal | |
1991 | An octal integer is @samp{0} followed by zero or more of the octal | |
1992 | digits (@samp{01234567}). | |
1993 | ||
1994 | @cindex decimal integers | |
1995 | @cindex integers, decimal | |
1996 | A decimal integer starts with a non-zero digit followed by zero or | |
1997 | more digits (@samp{0123456789}). | |
1998 | ||
1999 | @cindex hexadecimal integers | |
2000 | @cindex integers, hexadecimal | |
2001 | A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or | |
2002 | more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}. | |
2003 | ||
2004 | Integers have the usual values. To denote a negative integer, use | |
2005 | the prefix operator @samp{-} discussed under expressions | |
2006 | (@pxref{Prefix Ops,,Prefix Operators}). | |
2007 | ||
2008 | @node Bignums | |
2009 | @subsubsection Bignums | |
2010 | ||
2011 | @cindex bignums | |
2012 | @cindex constants, bignum | |
2013 | A @dfn{bignum} has the same syntax and semantics as an integer | |
2014 | except that the number (or its negative) takes more than 32 bits to | |
2015 | represent in binary. The distinction is made because in some places | |
2016 | integers are permitted while bignums are not. | |
2017 | ||
2018 | @node Flonums | |
2019 | @subsubsection Flonums | |
2020 | @cindex flonums | |
2021 | @cindex floating point numbers | |
2022 | @cindex constants, floating point | |
2023 | ||
2024 | @cindex precision, floating point | |
2025 | A @dfn{flonum} represents a floating point number. The translation is | |
2026 | indirect: a decimal floating point number from the text is converted by | |
2027 | @code{@value{AS}} to a generic binary floating point number of more than | |
2028 | sufficient precision. This generic floating point number is converted | |
2029 | to a particular computer's floating point format (or formats) by a | |
2030 | portion of @code{@value{AS}} specialized to that computer. | |
2031 | ||
2032 | A flonum is written by writing (in order) | |
2033 | @itemize @bullet | |
2034 | @item | |
2035 | The digit @samp{0}. | |
2036 | @ifset HPPA | |
2037 | (@samp{0} is optional on the HPPA.) | |
2038 | @end ifset | |
2039 | ||
2040 | @item | |
2041 | A letter, to tell @code{@value{AS}} the rest of the number is a flonum. | |
2042 | @ifset GENERIC | |
2043 | @kbd{e} is recommended. Case is not important. | |
2044 | @ignore | |
2045 | @c FIXME: verify if flonum syntax really this vague for most cases | |
2046 | (Any otherwise illegal letter works here, but that might be changed. Vax BSD | |
2047 | 4.2 assembler seems to allow any of @samp{defghDEFGH}.) | |
2048 | @end ignore | |
2049 | ||
2050 | On the H8/300, H8/500, | |
2051 | Hitachi SH, | |
2052 | and AMD 29K architectures, the letter must be | |
2053 | one of the letters @samp{DFPRSX} (in upper or lower case). | |
2054 | ||
2055 | On the ARC, the letter must be one of the letters @samp{DFRS} | |
2056 | (in upper or lower case). | |
2057 | ||
2058 | On the Intel 960 architecture, the letter must be | |
2059 | one of the letters @samp{DFT} (in upper or lower case). | |
2060 | ||
2061 | On the HPPA architecture, the letter must be @samp{E} (upper case only). | |
2062 | @end ifset | |
2063 | @ifclear GENERIC | |
2064 | @ifset A29K | |
2065 | One of the letters @samp{DFPRSX} (in upper or lower case). | |
2066 | @end ifset | |
2067 | @ifset ARC | |
2068 | One of the letters @samp{DFRS} (in upper or lower case). | |
2069 | @end ifset | |
2070 | @ifset H8 | |
2071 | One of the letters @samp{DFPRSX} (in upper or lower case). | |
2072 | @end ifset | |
2073 | @ifset HPPA | |
2074 | The letter @samp{E} (upper case only). | |
2075 | @end ifset | |
2076 | @ifset I960 | |
2077 | One of the letters @samp{DFT} (in upper or lower case). | |
2078 | @end ifset | |
2079 | @end ifclear | |
2080 | ||
2081 | @item | |
2082 | An optional sign: either @samp{+} or @samp{-}. | |
2083 | ||
2084 | @item | |
2085 | An optional @dfn{integer part}: zero or more decimal digits. | |
2086 | ||
2087 | @item | |
2088 | An optional @dfn{fractional part}: @samp{.} followed by zero | |
2089 | or more decimal digits. | |
2090 | ||
2091 | @item | |
2092 | An optional exponent, consisting of: | |
2093 | ||
2094 | @itemize @bullet | |
2095 | @item | |
2096 | An @samp{E} or @samp{e}. | |
2097 | @c I can't find a config where "EXP_CHARS" is other than 'eE', but in | |
2098 | @c principle this can perfectly well be different on different targets. | |
2099 | @item | |
2100 | Optional sign: either @samp{+} or @samp{-}. | |
2101 | @item | |
2102 | One or more decimal digits. | |
2103 | @end itemize | |
2104 | ||
2105 | @end itemize | |
2106 | ||
2107 | At least one of the integer part or the fractional part must be | |
2108 | present. The floating point number has the usual base-10 value. | |
2109 | ||
2110 | @code{@value{AS}} does all processing using integers. Flonums are computed | |
2111 | independently of any floating point hardware in the computer running | |
2112 | @code{@value{AS}}. | |
2113 | ||
2114 | @ifclear GENERIC | |
2115 | @ifset I960 | |
2116 | @c Bit fields are written as a general facility but are also controlled | |
2117 | @c by a conditional-compilation flag---which is as of now (21mar91) | |
2118 | @c turned on only by the i960 config of GAS. | |
2119 | @node Bit Fields | |
2120 | @subsubsection Bit Fields | |
2121 | ||
2122 | @cindex bit fields | |
2123 | @cindex constants, bit field | |
2124 | You can also define numeric constants as @dfn{bit fields}. | |
2125 | specify two numbers separated by a colon--- | |
2126 | @example | |
2127 | @var{mask}:@var{value} | |
2128 | @end example | |
2129 | @noindent | |
2130 | @code{@value{AS}} applies a bitwise @sc{and} between @var{mask} and | |
2131 | @var{value}. | |
2132 | ||
2133 | The resulting number is then packed | |
2134 | @ifset GENERIC | |
2135 | @c this conditional paren in case bit fields turned on elsewhere than 960 | |
2136 | (in host-dependent byte order) | |
2137 | @end ifset | |
2138 | into a field whose width depends on which assembler directive has the | |
2139 | bit-field as its argument. Overflow (a result from the bitwise and | |
2140 | requiring more binary digits to represent) is not an error; instead, | |
2141 | more constants are generated, of the specified width, beginning with the | |
2142 | least significant digits.@refill | |
2143 | ||
2144 | The directives @code{.byte}, @code{.hword}, @code{.int}, @code{.long}, | |
2145 | @code{.short}, and @code{.word} accept bit-field arguments. | |
2146 | @end ifset | |
2147 | @end ifclear | |
2148 | ||
2149 | @node Sections | |
2150 | @chapter Sections and Relocation | |
2151 | @cindex sections | |
2152 | @cindex relocation | |
2153 | ||
2154 | @menu | |
2155 | * Secs Background:: Background | |
2156 | * Ld Sections:: Linker Sections | |
2157 | * As Sections:: Assembler Internal Sections | |
2158 | * Sub-Sections:: Sub-Sections | |
2159 | * bss:: bss Section | |
2160 | @end menu | |
2161 | ||
2162 | @node Secs Background | |
2163 | @section Background | |
2164 | ||
2165 | Roughly, a section is a range of addresses, with no gaps; all data | |
2166 | ``in'' those addresses is treated the same for some particular purpose. | |
2167 | For example there may be a ``read only'' section. | |
2168 | ||
2169 | @cindex linker, and assembler | |
2170 | @cindex assembler, and linker | |
2171 | The linker @code{@value{LD}} reads many object files (partial programs) and | |
2172 | combines their contents to form a runnable program. When @code{@value{AS}} | |
2173 | emits an object file, the partial program is assumed to start at address 0. | |
2174 | @code{@value{LD}} assigns the final addresses for the partial program, so that | |
2175 | different partial programs do not overlap. This is actually an | |
2176 | oversimplification, but it suffices to explain how @code{@value{AS}} uses | |
2177 | sections. | |
2178 | ||
2179 | @code{@value{LD}} moves blocks of bytes of your program to their run-time | |
2180 | addresses. These blocks slide to their run-time addresses as rigid | |
2181 | units; their length does not change and neither does the order of bytes | |
2182 | within them. Such a rigid unit is called a @emph{section}. Assigning | |
2183 | run-time addresses to sections is called @dfn{relocation}. It includes | |
2184 | the task of adjusting mentions of object-file addresses so they refer to | |
2185 | the proper run-time addresses. | |
2186 | @ifset H8 | |
2187 | For the H8/300 and H8/500, | |
2188 | and for the Hitachi SH, | |
2189 | @code{@value{AS}} pads sections if needed to | |
2190 | ensure they end on a word (sixteen bit) boundary. | |
2191 | @end ifset | |
2192 | ||
2193 | @cindex standard assembler sections | |
2194 | An object file written by @code{@value{AS}} has at least three sections, any | |
2195 | of which may be empty. These are named @dfn{text}, @dfn{data} and | |
2196 | @dfn{bss} sections. | |
2197 | ||
2198 | @ifset COFF | |
2199 | @ifset GENERIC | |
2200 | When it generates COFF output, | |
2201 | @end ifset | |
2202 | @code{@value{AS}} can also generate whatever other named sections you specify | |
2203 | using the @samp{.section} directive (@pxref{Section,,@code{.section}}). | |
2204 | If you do not use any directives that place output in the @samp{.text} | |
2205 | or @samp{.data} sections, these sections still exist, but are empty. | |
2206 | @end ifset | |
2207 | ||
2208 | @ifset HPPA | |
2209 | @ifset GENERIC | |
2210 | When @code{@value{AS}} generates SOM or ELF output for the HPPA, | |
2211 | @end ifset | |
2212 | @code{@value{AS}} can also generate whatever other named sections you | |
2213 | specify using the @samp{.space} and @samp{.subspace} directives. See | |
2214 | @cite{HP9000 Series 800 Assembly Language Reference Manual} | |
2215 | (HP 92432-90001) for details on the @samp{.space} and @samp{.subspace} | |
2216 | assembler directives. | |
2217 | ||
2218 | @ifset SOM | |
2219 | Additionally, @code{@value{AS}} uses different names for the standard | |
2220 | text, data, and bss sections when generating SOM output. Program text | |
2221 | is placed into the @samp{$CODE$} section, data into @samp{$DATA$}, and | |
2222 | BSS into @samp{$BSS$}. | |
2223 | @end ifset | |
2224 | @end ifset | |
2225 | ||
2226 | Within the object file, the text section starts at address @code{0}, the | |
2227 | data section follows, and the bss section follows the data section. | |
2228 | ||
2229 | @ifset HPPA | |
2230 | When generating either SOM or ELF output files on the HPPA, the text | |
2231 | section starts at address @code{0}, the data section at address | |
2232 | @code{0x4000000}, and the bss section follows the data section. | |
2233 | @end ifset | |
2234 | ||
2235 | To let @code{@value{LD}} know which data changes when the sections are | |
2236 | relocated, and how to change that data, @code{@value{AS}} also writes to the | |
2237 | object file details of the relocation needed. To perform relocation | |
2238 | @code{@value{LD}} must know, each time an address in the object | |
2239 | file is mentioned: | |
2240 | @itemize @bullet | |
2241 | @item | |
2242 | Where in the object file is the beginning of this reference to | |
2243 | an address? | |
2244 | @item | |
2245 | How long (in bytes) is this reference? | |
2246 | @item | |
2247 | Which section does the address refer to? What is the numeric value of | |
2248 | @display | |
2249 | (@var{address}) @minus{} (@var{start-address of section})? | |
2250 | @end display | |
2251 | @item | |
2252 | Is the reference to an address ``Program-Counter relative''? | |
2253 | @end itemize | |
2254 | ||
2255 | @cindex addresses, format of | |
2256 | @cindex section-relative addressing | |
2257 | In fact, every address @code{@value{AS}} ever uses is expressed as | |
2258 | @display | |
2259 | (@var{section}) + (@var{offset into section}) | |
2260 | @end display | |
2261 | @noindent | |
2262 | Further, most expressions @code{@value{AS}} computes have this section-relative | |
2263 | nature. | |
2264 | @ifset SOM | |
2265 | (For some object formats, such as SOM for the HPPA, some expressions are | |
2266 | symbol-relative instead.) | |
2267 | @end ifset | |
2268 | ||
2269 | In this manual we use the notation @{@var{secname} @var{N}@} to mean ``offset | |
2270 | @var{N} into section @var{secname}.'' | |
2271 | ||
2272 | Apart from text, data and bss sections you need to know about the | |
2273 | @dfn{absolute} section. When @code{@value{LD}} mixes partial programs, | |
2274 | addresses in the absolute section remain unchanged. For example, address | |
2275 | @code{@{absolute 0@}} is ``relocated'' to run-time address 0 by | |
2276 | @code{@value{LD}}. Although the linker never arranges two partial programs' | |
2277 | data sections with overlapping addresses after linking, @emph{by definition} | |
2278 | their absolute sections must overlap. Address @code{@{absolute@ 239@}} in one | |
2279 | part of a program is always the same address when the program is running as | |
2280 | address @code{@{absolute@ 239@}} in any other part of the program. | |
2281 | ||
2282 | The idea of sections is extended to the @dfn{undefined} section. Any | |
2283 | address whose section is unknown at assembly time is by definition | |
2284 | rendered @{undefined @var{U}@}---where @var{U} is filled in later. | |
2285 | Since numbers are always defined, the only way to generate an undefined | |
2286 | address is to mention an undefined symbol. A reference to a named | |
2287 | common block would be such a symbol: its value is unknown at assembly | |
2288 | time so it has section @emph{undefined}. | |
2289 | ||
2290 | By analogy the word @emph{section} is used to describe groups of sections in | |
2291 | the linked program. @code{@value{LD}} puts all partial programs' text | |
2292 | sections in contiguous addresses in the linked program. It is | |
2293 | customary to refer to the @emph{text section} of a program, meaning all | |
2294 | the addresses of all partial programs' text sections. Likewise for | |
2295 | data and bss sections. | |
2296 | ||
2297 | Some sections are manipulated by @code{@value{LD}}; others are invented for | |
2298 | use of @code{@value{AS}} and have no meaning except during assembly. | |
2299 | ||
2300 | @node Ld Sections | |
2301 | @section Linker Sections | |
2302 | @code{@value{LD}} deals with just four kinds of sections, summarized below. | |
2303 | ||
2304 | @table @strong | |
2305 | ||
2306 | @ifset COFF | |
2307 | @cindex named sections | |
2308 | @cindex sections, named | |
2309 | @item named sections | |
2310 | @end ifset | |
2311 | @ifset aout-bout | |
2312 | @cindex text section | |
2313 | @cindex data section | |
2314 | @itemx text section | |
2315 | @itemx data section | |
2316 | @end ifset | |
2317 | These sections hold your program. @code{@value{AS}} and @code{@value{LD}} treat them as | |
2318 | separate but equal sections. Anything you can say of one section is | |
2319 | true another. | |
2320 | @ifset aout-bout | |
2321 | When the program is running, however, it is | |
2322 | customary for the text section to be unalterable. The | |
2323 | text section is often shared among processes: it contains | |
2324 | instructions, constants and the like. The data section of a running | |
2325 | program is usually alterable: for example, C variables would be stored | |
2326 | in the data section. | |
2327 | @end ifset | |
2328 | ||
2329 | @cindex bss section | |
2330 | @item bss section | |
2331 | This section contains zeroed bytes when your program begins running. It | |
2332 | is used to hold unitialized variables or common storage. The length of | |
2333 | each partial program's bss section is important, but because it starts | |
2334 | out containing zeroed bytes there is no need to store explicit zero | |
2335 | bytes in the object file. The bss section was invented to eliminate | |
2336 | those explicit zeros from object files. | |
2337 | ||
2338 | @cindex absolute section | |
2339 | @item absolute section | |
2340 | Address 0 of this section is always ``relocated'' to runtime address 0. | |
2341 | This is useful if you want to refer to an address that @code{@value{LD}} must | |
2342 | not change when relocating. In this sense we speak of absolute | |
2343 | addresses being ``unrelocatable'': they do not change during relocation. | |
2344 | ||
2345 | @cindex undefined section | |
2346 | @item undefined section | |
2347 | This ``section'' is a catch-all for address references to objects not in | |
2348 | the preceding sections. | |
2349 | @c FIXME: ref to some other doc on obj-file formats could go here. | |
2350 | @end table | |
2351 | ||
2352 | @cindex relocation example | |
2353 | An idealized example of three relocatable sections follows. | |
2354 | @ifset COFF | |
2355 | The example uses the traditional section names @samp{.text} and @samp{.data}. | |
2356 | @end ifset | |
2357 | Memory addresses are on the horizontal axis. | |
2358 | ||
2359 | @c TEXI2ROFF-KILL | |
2360 | @ifinfo | |
2361 | @c END TEXI2ROFF-KILL | |
2362 | @smallexample | |
2363 | +-----+----+--+ | |
2364 | partial program # 1: |ttttt|dddd|00| | |
2365 | +-----+----+--+ | |
2366 | ||
2367 | text data bss | |
2368 | seg. seg. seg. | |
2369 | ||
2370 | +---+---+---+ | |
2371 | partial program # 2: |TTT|DDD|000| | |
2372 | +---+---+---+ | |
2373 | ||
2374 | +--+---+-----+--+----+---+-----+~~ | |
2375 | linked program: | |TTT|ttttt| |dddd|DDD|00000| | |
2376 | +--+---+-----+--+----+---+-----+~~ | |
2377 | ||
2378 | addresses: 0 @dots{} | |
2379 | @end smallexample | |
2380 | @c TEXI2ROFF-KILL | |
2381 | @end ifinfo | |
2382 | @need 5000 | |
2383 | @tex | |
2384 | ||
2385 | \line{\it Partial program \#1: \hfil} | |
2386 | \line{\ibox{2.5cm}{\tt text}\ibox{2cm}{\tt data}\ibox{1cm}{\tt bss}\hfil} | |
2387 | \line{\boxit{2.5cm}{\tt ttttt}\boxit{2cm}{\tt dddd}\boxit{1cm}{\tt 00}\hfil} | |
2388 | ||
2389 | \line{\it Partial program \#2: \hfil} | |
2390 | \line{\ibox{1cm}{\tt text}\ibox{1.5cm}{\tt data}\ibox{1cm}{\tt bss}\hfil} | |
2391 | \line{\boxit{1cm}{\tt TTT}\boxit{1.5cm}{\tt DDDD}\boxit{1cm}{\tt 000}\hfil} | |
2392 | ||
2393 | \line{\it linked program: \hfil} | |
2394 | \line{\ibox{.5cm}{}\ibox{1cm}{\tt text}\ibox{2.5cm}{}\ibox{.75cm}{}\ibox{2cm}{\tt data}\ibox{1.5cm}{}\ibox{2cm}{\tt bss}\hfil} | |
2395 | \line{\boxit{.5cm}{}\boxit{1cm}{\tt TTT}\boxit{2.5cm}{\tt | |
2396 | ttttt}\boxit{.75cm}{}\boxit{2cm}{\tt dddd}\boxit{1.5cm}{\tt | |
2397 | DDDD}\boxit{2cm}{\tt 00000}\ \dots\hfil} | |
2398 | ||
2399 | \line{\it addresses: \hfil} | |
2400 | \line{0\dots\hfil} | |
2401 | ||
2402 | @end tex | |
2403 | @c END TEXI2ROFF-KILL | |
2404 | ||
2405 | @node As Sections | |
2406 | @section Assembler Internal Sections | |
2407 | ||
2408 | @cindex internal assembler sections | |
2409 | @cindex sections in messages, internal | |
2410 | These sections are meant only for the internal use of @code{@value{AS}}. They | |
2411 | have no meaning at run-time. You do not really need to know about these | |
2412 | sections for most purposes; but they can be mentioned in @code{@value{AS}} | |
2413 | warning messages, so it might be helpful to have an idea of their | |
2414 | meanings to @code{@value{AS}}. These sections are used to permit the | |
2415 | value of every expression in your assembly language program to be a | |
2416 | section-relative address. | |
2417 | ||
2418 | @table @b | |
2419 | @cindex assembler internal logic error | |
2420 | @item ASSEMBLER-INTERNAL-LOGIC-ERROR! | |
2421 | An internal assembler logic error has been found. This means there is a | |
2422 | bug in the assembler. | |
2423 | ||
2424 | @cindex expr (internal section) | |
2425 | @item expr section | |
2426 | The assembler stores complex expression internally as combinations of | |
2427 | symbols. When it needs to represent an expression as a symbol, it puts | |
2428 | it in the expr section. | |
2429 | @c FIXME item debug | |
2430 | @c FIXME item transfer[t] vector preload | |
2431 | @c FIXME item transfer[t] vector postload | |
2432 | @c FIXME item register | |
2433 | @end table | |
2434 | ||
2435 | @node Sub-Sections | |
2436 | @section Sub-Sections | |
2437 | ||
2438 | @cindex numbered subsections | |
2439 | @cindex grouping data | |
2440 | @ifset aout-bout | |
2441 | Assembled bytes | |
2442 | @ifset COFF | |
2443 | conventionally | |
2444 | @end ifset | |
2445 | fall into two sections: text and data. | |
2446 | @end ifset | |
2447 | You may have separate groups of | |
2448 | @ifset GENERIC | |
2449 | data in named sections | |
2450 | @end ifset | |
2451 | @ifclear GENERIC | |
2452 | @ifclear aout-bout | |
2453 | data in named sections | |
2454 | @end ifclear | |
2455 | @ifset aout-bout | |
2456 | text or data | |
2457 | @end ifset | |
2458 | @end ifclear | |
2459 | that you want to end up near to each other in the object file, even though they | |
2460 | are not contiguous in the assembler source. @code{@value{AS}} allows you to | |
2461 | use @dfn{subsections} for this purpose. Within each section, there can be | |
2462 | numbered subsections with values from 0 to 8192. Objects assembled into the | |
2463 | same subsection go into the object file together with other objects in the same | |
2464 | subsection. For example, a compiler might want to store constants in the text | |
2465 | section, but might not want to have them interspersed with the program being | |
2466 | assembled. In this case, the compiler could issue a @samp{.text 0} before each | |
2467 | section of code being output, and a @samp{.text 1} before each group of | |
2468 | constants being output. | |
2469 | ||
2470 | Subsections are optional. If you do not use subsections, everything | |
2471 | goes in subsection number zero. | |
2472 | ||
2473 | @ifset GENERIC | |
2474 | Each subsection is zero-padded up to a multiple of four bytes. | |
2475 | (Subsections may be padded a different amount on different flavors | |
2476 | of @code{@value{AS}}.) | |
2477 | @end ifset | |
2478 | @ifclear GENERIC | |
2479 | @ifset H8 | |
2480 | On the H8/300 and H8/500 platforms, each subsection is zero-padded to a word | |
2481 | boundary (two bytes). | |
2482 | The same is true on the Hitachi SH. | |
2483 | @end ifset | |
2484 | @ifset I960 | |
2485 | @c FIXME section padding (alignment)? | |
2486 | @c Rich Pixley says padding here depends on target obj code format; that | |
2487 | @c doesn't seem particularly useful to say without further elaboration, | |
2488 | @c so for now I say nothing about it. If this is a generic BFD issue, | |
2489 | @c these paragraphs might need to vanish from this manual, and be | |
2490 | @c discussed in BFD chapter of binutils (or some such). | |
2491 | @end ifset | |
2492 | @ifset A29K | |
2493 | On the AMD 29K family, no particular padding is added to section or | |
2494 | subsection sizes; @value{AS} forces no alignment on this platform. | |
2495 | @end ifset | |
2496 | @end ifclear | |
2497 | ||
2498 | Subsections appear in your object file in numeric order, lowest numbered | |
2499 | to highest. (All this to be compatible with other people's assemblers.) | |
2500 | The object file contains no representation of subsections; @code{@value{LD}} and | |
2501 | other programs that manipulate object files see no trace of them. | |
2502 | They just see all your text subsections as a text section, and all your | |
2503 | data subsections as a data section. | |
2504 | ||
2505 | To specify which subsection you want subsequent statements assembled | |
2506 | into, use a numeric argument to specify it, in a @samp{.text | |
2507 | @var{expression}} or a @samp{.data @var{expression}} statement. | |
2508 | @ifset COFF | |
2509 | @ifset GENERIC | |
2510 | When generating COFF output, you | |
2511 | @end ifset | |
2512 | @ifclear GENERIC | |
2513 | You | |
2514 | @end ifclear | |
2515 | can also use an extra subsection | |
2516 | argument with arbitrary named sections: @samp{.section @var{name}, | |
2517 | @var{expression}}. | |
2518 | @end ifset | |
2519 | @var{Expression} should be an absolute expression. | |
2520 | (@xref{Expressions}.) If you just say @samp{.text} then @samp{.text 0} | |
2521 | is assumed. Likewise @samp{.data} means @samp{.data 0}. Assembly | |
2522 | begins in @code{text 0}. For instance: | |
2523 | @smallexample | |
2524 | .text 0 # The default subsection is text 0 anyway. | |
2525 | .ascii "This lives in the first text subsection. *" | |
2526 | .text 1 | |
2527 | .ascii "But this lives in the second text subsection." | |
2528 | .data 0 | |
2529 | .ascii "This lives in the data section," | |
2530 | .ascii "in the first data subsection." | |
2531 | .text 0 | |
2532 | .ascii "This lives in the first text section," | |
2533 | .ascii "immediately following the asterisk (*)." | |
2534 | @end smallexample | |
2535 | ||
2536 | Each section has a @dfn{location counter} incremented by one for every byte | |
2537 | assembled into that section. Because subsections are merely a convenience | |
2538 | restricted to @code{@value{AS}} there is no concept of a subsection location | |
2539 | counter. There is no way to directly manipulate a location counter---but the | |
2540 | @code{.align} directive changes it, and any label definition captures its | |
2541 | current value. The location counter of the section where statements are being | |
2542 | assembled is said to be the @dfn{active} location counter. | |
2543 | ||
2544 | @node bss | |
2545 | @section bss Section | |
2546 | ||
2547 | @cindex bss section | |
2548 | @cindex common variable storage | |
2549 | The bss section is used for local common variable storage. | |
2550 | You may allocate address space in the bss section, but you may | |
2551 | not dictate data to load into it before your program executes. When | |
2552 | your program starts running, all the contents of the bss | |
2553 | section are zeroed bytes. | |
2554 | ||
2555 | The @code{.lcomm} pseudo-op defines a symbol in the bss section; see | |
2556 | @ref{Lcomm,,@code{.lcomm}}. | |
2557 | ||
2558 | The @code{.comm} pseudo-op may be used to declare a common symbol, which is | |
2559 | another form of uninitialized symbol; see @xref{Comm,,@code{.comm}}. | |
2560 | ||
2561 | @ifset GENERIC | |
2562 | When assembling for a target which supports multiple sections, such as ELF or | |
2563 | COFF, you may switch into the @code{.bss} section and define symbols as usual; | |
2564 | see @ref{Section,,@code{.section}}. You may only assemble zero values into the | |
2565 | section. Typically the section will only contain symbol definitions and | |
2566 | @code{.skip} directives (@pxref{Skip,,@code{.skip}}). | |
2567 | @end ifset | |
2568 | ||
2569 | @node Symbols | |
2570 | @chapter Symbols | |
2571 | ||
2572 | @cindex symbols | |
2573 | Symbols are a central concept: the programmer uses symbols to name | |
2574 | things, the linker uses symbols to link, and the debugger uses symbols | |
2575 | to debug. | |
2576 | ||
2577 | @quotation | |
2578 | @cindex debuggers, and symbol order | |
2579 | @emph{Warning:} @code{@value{AS}} does not place symbols in the object file in | |
2580 | the same order they were declared. This may break some debuggers. | |
2581 | @end quotation | |
2582 | ||
2583 | @menu | |
2584 | * Labels:: Labels | |
2585 | * Setting Symbols:: Giving Symbols Other Values | |
2586 | * Symbol Names:: Symbol Names | |
2587 | * Dot:: The Special Dot Symbol | |
2588 | * Symbol Attributes:: Symbol Attributes | |
2589 | @end menu | |
2590 | ||
2591 | @node Labels | |
2592 | @section Labels | |
2593 | ||
2594 | @cindex labels | |
2595 | A @dfn{label} is written as a symbol immediately followed by a colon | |
2596 | @samp{:}. The symbol then represents the current value of the | |
2597 | active location counter, and is, for example, a suitable instruction | |
2598 | operand. You are warned if you use the same symbol to represent two | |
2599 | different locations: the first definition overrides any other | |
2600 | definitions. | |
2601 | ||
2602 | @ifset HPPA | |
2603 | On the HPPA, the usual form for a label need not be immediately followed by a | |
2604 | colon, but instead must start in column zero. Only one label may be defined on | |
2605 | a single line. To work around this, the HPPA version of @code{@value{AS}} also | |
2606 | provides a special directive @code{.label} for defining labels more flexibly. | |
2607 | @end ifset | |
2608 | ||
2609 | @node Setting Symbols | |
2610 | @section Giving Symbols Other Values | |
2611 | ||
2612 | @cindex assigning values to symbols | |
2613 | @cindex symbol values, assigning | |
2614 | A symbol can be given an arbitrary value by writing a symbol, followed | |
2615 | by an equals sign @samp{=}, followed by an expression | |
2616 | (@pxref{Expressions}). This is equivalent to using the @code{.set} | |
2617 | directive. @xref{Set,,@code{.set}}. | |
2618 | ||
2619 | @node Symbol Names | |
2620 | @section Symbol Names | |
2621 | ||
2622 | @cindex symbol names | |
2623 | @cindex names, symbol | |
2624 | @ifclear SPECIAL-SYMS | |
2625 | Symbol names begin with a letter or with one of @samp{._}. On most | |
2626 | machines, you can also use @code{$} in symbol names; exceptions are | |
2627 | noted in @ref{Machine Dependencies}. That character may be followed by any | |
2628 | string of digits, letters, dollar signs (unless otherwise noted in | |
2629 | @ref{Machine Dependencies}), and underscores. | |
2630 | @end ifclear | |
2631 | @ifset A29K | |
2632 | For the AMD 29K family, @samp{?} is also allowed in the | |
2633 | body of a symbol name, though not at its beginning. | |
2634 | @end ifset | |
2635 | ||
2636 | @ifset SPECIAL-SYMS | |
2637 | @ifset H8 | |
2638 | Symbol names begin with a letter or with one of @samp{._}. On the | |
2639 | Hitachi SH or the | |
2640 | H8/500, you can also use @code{$} in symbol names. That character may | |
2641 | be followed by any string of digits, letters, dollar signs (save on the | |
2642 | H8/300), and underscores. | |
2643 | @end ifset | |
2644 | @end ifset | |
2645 | ||
2646 | Case of letters is significant: @code{foo} is a different symbol name | |
2647 | than @code{Foo}. | |
2648 | ||
2649 | Each symbol has exactly one name. Each name in an assembly language program | |
2650 | refers to exactly one symbol. You may use that symbol name any number of times | |
2651 | in a program. | |
2652 | ||
2653 | @subheading Local Symbol Names | |
2654 | ||
2655 | @cindex local symbol names | |
2656 | @cindex symbol names, local | |
2657 | @cindex temporary symbol names | |
2658 | @cindex symbol names, temporary | |
2659 | Local symbols help compilers and programmers use names temporarily. | |
2660 | There are ten local symbol names, which are re-used throughout the | |
2661 | program. You may refer to them using the names @samp{0} @samp{1} | |
2662 | @dots{} @samp{9}. To define a local symbol, write a label of the form | |
2663 | @samp{@b{N}:} (where @b{N} represents any digit). To refer to the most | |
2664 | recent previous definition of that symbol write @samp{@b{N}b}, using the | |
2665 | same digit as when you defined the label. To refer to the next | |
2666 | definition of a local label, write @samp{@b{N}f}---where @b{N} gives you | |
2667 | a choice of 10 forward references. The @samp{b} stands for | |
2668 | ``backwards'' and the @samp{f} stands for ``forwards''. | |
2669 | ||
2670 | Local symbols are not emitted by the current @sc{gnu} C compiler. | |
2671 | ||
2672 | There is no restriction on how you can use these labels, but | |
2673 | remember that at any point in the assembly you can refer to at most | |
2674 | 10 prior local labels and to at most 10 forward local labels. | |
2675 | ||
2676 | Local symbol names are only a notation device. They are immediately | |
2677 | transformed into more conventional symbol names before the assembler | |
2678 | uses them. The symbol names stored in the symbol table, appearing in | |
2679 | error messages and optionally emitted to the object file have these | |
2680 | parts: | |
2681 | ||
2682 | @table @code | |
2683 | @item L | |
2684 | All local labels begin with @samp{L}. Normally both @code{@value{AS}} and | |
2685 | @code{@value{LD}} forget symbols that start with @samp{L}. These labels are | |
2686 | used for symbols you are never intended to see. If you use the | |
2687 | @samp{-L} option then @code{@value{AS}} retains these symbols in the | |
2688 | object file. If you also instruct @code{@value{LD}} to retain these symbols, | |
2689 | you may use them in debugging. | |
2690 | ||
2691 | @item @var{digit} | |
2692 | If the label is written @samp{0:} then the digit is @samp{0}. | |
2693 | If the label is written @samp{1:} then the digit is @samp{1}. | |
2694 | And so on up through @samp{9:}. | |
2695 | ||
2696 | @item @kbd{C-A} | |
2697 | This unusual character is included so you do not accidentally invent | |
2698 | a symbol of the same name. The character has ASCII value | |
2699 | @samp{\001}. | |
2700 | ||
2701 | @item @emph{ordinal number} | |
2702 | This is a serial number to keep the labels distinct. The first | |
2703 | @samp{0:} gets the number @samp{1}; The 15th @samp{0:} gets the | |
2704 | number @samp{15}; @emph{etc.}. Likewise for the other labels @samp{1:} | |
2705 | through @samp{9:}. | |
2706 | @end table | |
2707 | ||
2708 | For instance, the first @code{1:} is named @code{L1@kbd{C-A}1}, the 44th | |
2709 | @code{3:} is named @code{L3@kbd{C-A}44}. | |
2710 | ||
2711 | @node Dot | |
2712 | @section The Special Dot Symbol | |
2713 | ||
2714 | @cindex dot (symbol) | |
2715 | @cindex @code{.} (symbol) | |
2716 | @cindex current address | |
2717 | @cindex location counter | |
2718 | The special symbol @samp{.} refers to the current address that | |
2719 | @code{@value{AS}} is assembling into. Thus, the expression @samp{melvin: | |
2720 | .long .} defines @code{melvin} to contain its own address. | |
2721 | Assigning a value to @code{.} is treated the same as a @code{.org} | |
2722 | directive. Thus, the expression @samp{.=.+4} is the same as saying | |
2723 | @ifclear no-space-dir | |
2724 | @samp{.space 4}. | |
2725 | @end ifclear | |
2726 | @ifset no-space-dir | |
2727 | @ifset A29K | |
2728 | @samp{.block 4}. | |
2729 | @end ifset | |
2730 | @end ifset | |
2731 | ||
2732 | @node Symbol Attributes | |
2733 | @section Symbol Attributes | |
2734 | ||
2735 | @cindex symbol attributes | |
2736 | @cindex attributes, symbol | |
2737 | Every symbol has, as well as its name, the attributes ``Value'' and | |
2738 | ``Type''. Depending on output format, symbols can also have auxiliary | |
2739 | attributes. | |
2740 | @ifset INTERNALS | |
2741 | The detailed definitions are in @file{a.out.h}. | |
2742 | @end ifset | |
2743 | ||
2744 | If you use a symbol without defining it, @code{@value{AS}} assumes zero for | |
2745 | all these attributes, and probably won't warn you. This makes the | |
2746 | symbol an externally defined symbol, which is generally what you | |
2747 | would want. | |
2748 | ||
2749 | @menu | |
2750 | * Symbol Value:: Value | |
2751 | * Symbol Type:: Type | |
2752 | @ifset aout-bout | |
2753 | @ifset GENERIC | |
2754 | * a.out Symbols:: Symbol Attributes: @code{a.out} | |
2755 | @end ifset | |
2756 | @ifclear GENERIC | |
2757 | @ifclear BOUT | |
2758 | * a.out Symbols:: Symbol Attributes: @code{a.out} | |
2759 | @end ifclear | |
2760 | @ifset BOUT | |
2761 | * a.out Symbols:: Symbol Attributes: @code{a.out}, @code{b.out} | |
2762 | @end ifset | |
2763 | @end ifclear | |
2764 | @end ifset | |
2765 | @ifset COFF | |
2766 | * COFF Symbols:: Symbol Attributes for COFF | |
2767 | @end ifset | |
2768 | @ifset SOM | |
2769 | * SOM Symbols:: Symbol Attributes for SOM | |
2770 | @end ifset | |
2771 | @end menu | |
2772 | ||
2773 | @node Symbol Value | |
2774 | @subsection Value | |
2775 | ||
2776 | @cindex value of a symbol | |
2777 | @cindex symbol value | |
2778 | The value of a symbol is (usually) 32 bits. For a symbol which labels a | |
2779 | location in the text, data, bss or absolute sections the value is the | |
2780 | number of addresses from the start of that section to the label. | |
2781 | Naturally for text, data and bss sections the value of a symbol changes | |
2782 | as @code{@value{LD}} changes section base addresses during linking. Absolute | |
2783 | symbols' values do not change during linking: that is why they are | |
2784 | called absolute. | |
2785 | ||
2786 | The value of an undefined symbol is treated in a special way. If it is | |
2787 | 0 then the symbol is not defined in this assembler source file, and | |
2788 | @code{@value{LD}} tries to determine its value from other files linked into the | |
2789 | same program. You make this kind of symbol simply by mentioning a symbol | |
2790 | name without defining it. A non-zero value represents a @code{.comm} | |
2791 | common declaration. The value is how much common storage to reserve, in | |
2792 | bytes (addresses). The symbol refers to the first address of the | |
2793 | allocated storage. | |
2794 | ||
2795 | @node Symbol Type | |
2796 | @subsection Type | |
2797 | ||
2798 | @cindex type of a symbol | |
2799 | @cindex symbol type | |
2800 | The type attribute of a symbol contains relocation (section) | |
2801 | information, any flag settings indicating that a symbol is external, and | |
2802 | (optionally), other information for linkers and debuggers. The exact | |
2803 | format depends on the object-code output format in use. | |
2804 | ||
2805 | @ifset aout-bout | |
2806 | @ifclear GENERIC | |
2807 | @ifset BOUT | |
2808 | @c The following avoids a "widow" subsection title. @group would be | |
2809 | @c better if it were available outside examples. | |
2810 | @need 1000 | |
2811 | @node a.out Symbols | |
2812 | @subsection Symbol Attributes: @code{a.out}, @code{b.out} | |
2813 | ||
2814 | @cindex @code{b.out} symbol attributes | |
2815 | @cindex symbol attributes, @code{b.out} | |
2816 | These symbol attributes appear only when @code{@value{AS}} is configured for | |
2817 | one of the Berkeley-descended object output formats---@code{a.out} or | |
2818 | @code{b.out}. | |
2819 | ||
2820 | @end ifset | |
2821 | @ifclear BOUT | |
2822 | @node a.out Symbols | |
2823 | @subsection Symbol Attributes: @code{a.out} | |
2824 | ||
2825 | @cindex @code{a.out} symbol attributes | |
2826 | @cindex symbol attributes, @code{a.out} | |
2827 | ||
2828 | @end ifclear | |
2829 | @end ifclear | |
2830 | @ifset GENERIC | |
2831 | @node a.out Symbols | |
2832 | @subsection Symbol Attributes: @code{a.out} | |
2833 | ||
2834 | @cindex @code{a.out} symbol attributes | |
2835 | @cindex symbol attributes, @code{a.out} | |
2836 | ||
2837 | @end ifset | |
2838 | @menu | |
2839 | * Symbol Desc:: Descriptor | |
2840 | * Symbol Other:: Other | |
2841 | @end menu | |
2842 | ||
2843 | @node Symbol Desc | |
2844 | @subsubsection Descriptor | |
2845 | ||
2846 | @cindex descriptor, of @code{a.out} symbol | |
2847 | This is an arbitrary 16-bit value. You may establish a symbol's | |
2848 | descriptor value by using a @code{.desc} statement | |
2849 | (@pxref{Desc,,@code{.desc}}). A descriptor value means nothing to | |
2850 | @code{@value{AS}}. | |
2851 | ||
2852 | @node Symbol Other | |
2853 | @subsubsection Other | |
2854 | ||
2855 | @cindex other attribute, of @code{a.out} symbol | |
2856 | This is an arbitrary 8-bit value. It means nothing to @code{@value{AS}}. | |
2857 | @end ifset | |
2858 | ||
2859 | @ifset COFF | |
2860 | @node COFF Symbols | |
2861 | @subsection Symbol Attributes for COFF | |
2862 | ||
2863 | @cindex COFF symbol attributes | |
2864 | @cindex symbol attributes, COFF | |
2865 | ||
2866 | The COFF format supports a multitude of auxiliary symbol attributes; | |
2867 | like the primary symbol attributes, they are set between @code{.def} and | |
2868 | @code{.endef} directives. | |
2869 | ||
2870 | @subsubsection Primary Attributes | |
2871 | ||
2872 | @cindex primary attributes, COFF symbols | |
2873 | The symbol name is set with @code{.def}; the value and type, | |
2874 | respectively, with @code{.val} and @code{.type}. | |
2875 | ||
2876 | @subsubsection Auxiliary Attributes | |
2877 | ||
2878 | @cindex auxiliary attributes, COFF symbols | |
2879 | The @code{@value{AS}} directives @code{.dim}, @code{.line}, @code{.scl}, | |
2880 | @code{.size}, and @code{.tag} can generate auxiliary symbol table | |
2881 | information for COFF. | |
2882 | @end ifset | |
2883 | ||
2884 | @ifset SOM | |
2885 | @node SOM Symbols | |
2886 | @subsection Symbol Attributes for SOM | |
2887 | ||
2888 | @cindex SOM symbol attributes | |
2889 | @cindex symbol attributes, SOM | |
2890 | ||
2891 | The SOM format for the HPPA supports a multitude of symbol attributes set with | |
2892 | the @code{.EXPORT} and @code{.IMPORT} directives. | |
2893 | ||
2894 | The attributes are described in @cite{HP9000 Series 800 Assembly | |
2895 | Language Reference Manual} (HP 92432-90001) under the @code{IMPORT} and | |
2896 | @code{EXPORT} assembler directive documentation. | |
2897 | @end ifset | |
2898 | ||
2899 | @node Expressions | |
2900 | @chapter Expressions | |
2901 | ||
2902 | @cindex expressions | |
2903 | @cindex addresses | |
2904 | @cindex numeric values | |
2905 | An @dfn{expression} specifies an address or numeric value. | |
2906 | Whitespace may precede and/or follow an expression. | |
2907 | ||
2908 | The result of an expression must be an absolute number, or else an offset into | |
2909 | a particular section. If an expression is not absolute, and there is not | |
2910 | enough information when @code{@value{AS}} sees the expression to know its | |
2911 | section, a second pass over the source program might be necessary to interpret | |
2912 | the expression---but the second pass is currently not implemented. | |
2913 | @code{@value{AS}} aborts with an error message in this situation. | |
2914 | ||
2915 | @menu | |
2916 | * Empty Exprs:: Empty Expressions | |
2917 | * Integer Exprs:: Integer Expressions | |
2918 | @end menu | |
2919 | ||
2920 | @node Empty Exprs | |
2921 | @section Empty Expressions | |
2922 | ||
2923 | @cindex empty expressions | |
2924 | @cindex expressions, empty | |
2925 | An empty expression has no value: it is just whitespace or null. | |
2926 | Wherever an absolute expression is required, you may omit the | |
2927 | expression, and @code{@value{AS}} assumes a value of (absolute) 0. This | |
2928 | is compatible with other assemblers. | |
2929 | ||
2930 | @node Integer Exprs | |
2931 | @section Integer Expressions | |
2932 | ||
2933 | @cindex integer expressions | |
2934 | @cindex expressions, integer | |
2935 | An @dfn{integer expression} is one or more @emph{arguments} delimited | |
2936 | by @emph{operators}. | |
2937 | ||
2938 | @menu | |
2939 | * Arguments:: Arguments | |
2940 | * Operators:: Operators | |
2941 | * Prefix Ops:: Prefix Operators | |
2942 | * Infix Ops:: Infix Operators | |
2943 | @end menu | |
2944 | ||
2945 | @node Arguments | |
2946 | @subsection Arguments | |
2947 | ||
2948 | @cindex expression arguments | |
2949 | @cindex arguments in expressions | |
2950 | @cindex operands in expressions | |
2951 | @cindex arithmetic operands | |
2952 | @dfn{Arguments} are symbols, numbers or subexpressions. In other | |
2953 | contexts arguments are sometimes called ``arithmetic operands''. In | |
2954 | this manual, to avoid confusing them with the ``instruction operands'' of | |
2955 | the machine language, we use the term ``argument'' to refer to parts of | |
2956 | expressions only, reserving the word ``operand'' to refer only to machine | |
2957 | instruction operands. | |
2958 | ||
2959 | Symbols are evaluated to yield @{@var{section} @var{NNN}@} where | |
2960 | @var{section} is one of text, data, bss, absolute, | |
2961 | or undefined. @var{NNN} is a signed, 2's complement 32 bit | |
2962 | integer. | |
2963 | ||
2964 | Numbers are usually integers. | |
2965 | ||
2966 | A number can be a flonum or bignum. In this case, you are warned | |
2967 | that only the low order 32 bits are used, and @code{@value{AS}} pretends | |
2968 | these 32 bits are an integer. You may write integer-manipulating | |
2969 | instructions that act on exotic constants, compatible with other | |
2970 | assemblers. | |
2971 | ||
2972 | @cindex subexpressions | |
2973 | Subexpressions are a left parenthesis @samp{(} followed by an integer | |
2974 | expression, followed by a right parenthesis @samp{)}; or a prefix | |
2975 | operator followed by an argument. | |
2976 | ||
2977 | @node Operators | |
2978 | @subsection Operators | |
2979 | ||
2980 | @cindex operators, in expressions | |
2981 | @cindex arithmetic functions | |
2982 | @cindex functions, in expressions | |
2983 | @dfn{Operators} are arithmetic functions, like @code{+} or @code{%}. Prefix | |
2984 | operators are followed by an argument. Infix operators appear | |
2985 | between their arguments. Operators may be preceded and/or followed by | |
2986 | whitespace. | |
2987 | ||
2988 | @node Prefix Ops | |
2989 | @subsection Prefix Operator | |
2990 | ||
2991 | @cindex prefix operators | |
2992 | @code{@value{AS}} has the following @dfn{prefix operators}. They each take | |
2993 | one argument, which must be absolute. | |
2994 | ||
2995 | @c the tex/end tex stuff surrounding this small table is meant to make | |
2996 | @c it align, on the printed page, with the similar table in the next | |
2997 | @c section (which is inside an enumerate). | |
2998 | @tex | |
2999 | \global\advance\leftskip by \itemindent | |
3000 | @end tex | |
3001 | ||
3002 | @table @code | |
3003 | @item - | |
3004 | @dfn{Negation}. Two's complement negation. | |
3005 | @item ~ | |
3006 | @dfn{Complementation}. Bitwise not. | |
3007 | @end table | |
3008 | ||
3009 | @tex | |
3010 | \global\advance\leftskip by -\itemindent | |
3011 | @end tex | |
3012 | ||
3013 | @node Infix Ops | |
3014 | @subsection Infix Operators | |
3015 | ||
3016 | @cindex infix operators | |
3017 | @cindex operators, permitted arguments | |
3018 | @dfn{Infix operators} take two arguments, one on either side. Operators | |
3019 | have precedence, but operations with equal precedence are performed left | |
3020 | to right. Apart from @code{+} or @code{-}, both arguments must be | |
3021 | absolute, and the result is absolute. | |
3022 | ||
3023 | @enumerate | |
3024 | @cindex operator precedence | |
3025 | @cindex precedence of operators | |
3026 | ||
3027 | @item | |
3028 | Highest Precedence | |
3029 | ||
3030 | @table @code | |
3031 | @item * | |
3032 | @dfn{Multiplication}. | |
3033 | ||
3034 | @item / | |
3035 | @dfn{Division}. Truncation is the same as the C operator @samp{/} | |
3036 | ||
3037 | @item % | |
3038 | @dfn{Remainder}. | |
3039 | ||
3040 | @item < | |
3041 | @itemx << | |
3042 | @dfn{Shift Left}. Same as the C operator @samp{<<}. | |
3043 | ||
3044 | @item > | |
3045 | @itemx >> | |
3046 | @dfn{Shift Right}. Same as the C operator @samp{>>}. | |
3047 | @end table | |
3048 | ||
3049 | @item | |
3050 | Intermediate precedence | |
3051 | ||
3052 | @table @code | |
3053 | @item | | |
3054 | ||
3055 | @dfn{Bitwise Inclusive Or}. | |
3056 | ||
3057 | @item & | |
3058 | @dfn{Bitwise And}. | |
3059 | ||
3060 | @item ^ | |
3061 | @dfn{Bitwise Exclusive Or}. | |
3062 | ||
3063 | @item ! | |
3064 | @dfn{Bitwise Or Not}. | |
3065 | @end table | |
3066 | ||
3067 | @item | |
3068 | Lowest Precedence | |
3069 | ||
3070 | @table @code | |
3071 | @cindex addition, permitted arguments | |
3072 | @cindex plus, permitted arguments | |
3073 | @cindex arguments for addition | |
3074 | @item + | |
3075 | @dfn{Addition}. If either argument is absolute, the result has the section of | |
3076 | the other argument. You may not add together arguments from different | |
3077 | sections. | |
3078 | ||
3079 | @cindex subtraction, permitted arguments | |
3080 | @cindex minus, permitted arguments | |
3081 | @cindex arguments for subtraction | |
3082 | @item - | |
3083 | @dfn{Subtraction}. If the right argument is absolute, the | |
3084 | result has the section of the left argument. | |
3085 | If both arguments are in the same section, the result is absolute. | |
3086 | You may not subtract arguments from different sections. | |
3087 | @c FIXME is there still something useful to say about undefined - undefined ? | |
3088 | @end table | |
3089 | @end enumerate | |
3090 | ||
3091 | In short, it's only meaningful to add or subtract the @emph{offsets} in an | |
3092 | address; you can only have a defined section in one of the two arguments. | |
3093 | ||
3094 | @node Pseudo Ops | |
3095 | @chapter Assembler Directives | |
3096 | ||
3097 | @cindex directives, machine independent | |
3098 | @cindex pseudo-ops, machine independent | |
3099 | @cindex machine independent directives | |
3100 | All assembler directives have names that begin with a period (@samp{.}). | |
3101 | The rest of the name is letters, usually in lower case. | |
3102 | ||
3103 | This chapter discusses directives that are available regardless of the | |
3104 | target machine configuration for the @sc{gnu} assembler. | |
3105 | @ifset GENERIC | |
3106 | Some machine configurations provide additional directives. | |
3107 | @xref{Machine Dependencies}. | |
3108 | @end ifset | |
3109 | @ifclear GENERIC | |
3110 | @ifset machine-directives | |
3111 | @xref{Machine Dependencies} for additional directives. | |
3112 | @end ifset | |
3113 | @end ifclear | |
3114 | ||
3115 | @menu | |
3116 | * Abort:: @code{.abort} | |
3117 | @ifset COFF | |
3118 | * ABORT:: @code{.ABORT} | |
3119 | @end ifset | |
3120 | ||
3121 | * Align:: @code{.align @var{abs-expr} , @var{abs-expr}} | |
3122 | * Ascii:: @code{.ascii "@var{string}"}@dots{} | |
3123 | * Asciz:: @code{.asciz "@var{string}"}@dots{} | |
3124 | * Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}} | |
3125 | * Byte:: @code{.byte @var{expressions}} | |
3126 | * Comm:: @code{.comm @var{symbol} , @var{length} } | |
3127 | * Data:: @code{.data @var{subsection}} | |
3128 | @ifset COFF | |
3129 | * Def:: @code{.def @var{name}} | |
3130 | @end ifset | |
3131 | @ifset aout-bout | |
3132 | * Desc:: @code{.desc @var{symbol}, @var{abs-expression}} | |
3133 | @end ifset | |
3134 | @ifset COFF | |
3135 | * Dim:: @code{.dim} | |
3136 | @end ifset | |
3137 | ||
3138 | * Double:: @code{.double @var{flonums}} | |
3139 | * Eject:: @code{.eject} | |
3140 | * Else:: @code{.else} | |
3fd9f047 | 3141 | * Elseif:: @code{.elseif} |
252b5132 RH |
3142 | * End:: @code{.end} |
3143 | @ifset COFF | |
3144 | * Endef:: @code{.endef} | |
3145 | @end ifset | |
3146 | ||
3147 | * Endfunc:: @code{.endfunc} | |
3148 | * Endif:: @code{.endif} | |
3149 | * Equ:: @code{.equ @var{symbol}, @var{expression}} | |
3150 | * Equiv:: @code{.equiv @var{symbol}, @var{expression}} | |
3151 | * Err:: @code{.err} | |
3152 | * Exitm:: @code{.exitm} | |
3153 | * Extern:: @code{.extern} | |
3154 | * Fail:: @code{.fail} | |
3155 | @ifclear no-file-dir | |
3156 | * File:: @code{.file @var{string}} | |
3157 | @end ifclear | |
3158 | ||
3159 | * Fill:: @code{.fill @var{repeat} , @var{size} , @var{value}} | |
3160 | * Float:: @code{.float @var{flonums}} | |
3161 | * Func:: @code{.func} | |
3162 | * Global:: @code{.global @var{symbol}}, @code{.globl @var{symbol}} | |
3163 | * hword:: @code{.hword @var{expressions}} | |
3164 | * Ident:: @code{.ident} | |
3165 | * If:: @code{.if @var{absolute expression}} | |
3166 | * Include:: @code{.include "@var{file}"} | |
3167 | * Int:: @code{.int @var{expressions}} | |
3168 | * Irp:: @code{.irp @var{symbol},@var{values}}@dots{} | |
3169 | * Irpc:: @code{.irpc @var{symbol},@var{values}}@dots{} | |
3170 | * Lcomm:: @code{.lcomm @var{symbol} , @var{length}} | |
3171 | * Lflags:: @code{.lflags} | |
3172 | @ifclear no-line-dir | |
3173 | * Line:: @code{.line @var{line-number}} | |
3174 | @end ifclear | |
3175 | ||
3176 | * Ln:: @code{.ln @var{line-number}} | |
3177 | * Linkonce:: @code{.linkonce [@var{type}]} | |
3178 | * List:: @code{.list} | |
3179 | * Long:: @code{.long @var{expressions}} | |
3180 | @ignore | |
3181 | * Lsym:: @code{.lsym @var{symbol}, @var{expression}} | |
3182 | @end ignore | |
3183 | ||
3184 | * Macro:: @code{.macro @var{name} @var{args}}@dots{} | |
3185 | * MRI:: @code{.mri @var{val}} | |
3186 | ||
3187 | * Nolist:: @code{.nolist} | |
3188 | * Octa:: @code{.octa @var{bignums}} | |
3189 | * Org:: @code{.org @var{new-lc} , @var{fill}} | |
3190 | * P2align:: @code{.p2align @var{abs-expr} , @var{abs-expr}} | |
3191 | * Print:: @code{.print @var{string}} | |
3192 | * Psize:: @code{.psize @var{lines}, @var{columns}} | |
3193 | * Purgem:: @code{.purgem @var{name}} | |
3194 | * Quad:: @code{.quad @var{bignums}} | |
3195 | * Rept:: @code{.rept @var{count}} | |
3196 | * Sbttl:: @code{.sbttl "@var{subheading}"} | |
3197 | @ifset COFF | |
3198 | * Scl:: @code{.scl @var{class}} | |
3199 | * Section:: @code{.section @var{name}, @var{subsection}} | |
3200 | @end ifset | |
3201 | ||
3202 | * Set:: @code{.set @var{symbol}, @var{expression}} | |
3203 | * Short:: @code{.short @var{expressions}} | |
3204 | * Single:: @code{.single @var{flonums}} | |
3205 | @ifset COFF | |
3206 | * Size:: @code{.size} | |
3207 | @end ifset | |
3208 | ||
3209 | * Skip:: @code{.skip @var{size} , @var{fill}} | |
3210 | * Sleb128:: @code{.sleb128 @var{expressions}} | |
3211 | * Space:: @code{.space @var{size} , @var{fill}} | |
3212 | @ifset have-stabs | |
3213 | * Stab:: @code{.stabd, .stabn, .stabs} | |
3214 | @end ifset | |
3215 | ||
3216 | * String:: @code{.string "@var{str}"} | |
3217 | * Struct:: @code{.struct @var{expression}} | |
3218 | @ifset ELF | |
3219 | * Symver:: @code{.symver @var{name},@var{name2@@nodename}} | |
3220 | @end ifset | |
3221 | @ifset COFF | |
3222 | * Tag:: @code{.tag @var{structname}} | |
3223 | @end ifset | |
3224 | ||
3225 | * Text:: @code{.text @var{subsection}} | |
3226 | * Title:: @code{.title "@var{heading}"} | |
3227 | @ifset COFF | |
3228 | * Type:: @code{.type @var{int}} | |
3229 | * Val:: @code{.val @var{addr}} | |
3230 | @end ifset | |
2e13b764 NC |
3231 | @ifset ELF |
3232 | * Visibility:: @code{.internal @var{name}, .hidden @var{name}, .protected @var{name}} | |
3233 | @end ifset | |
252b5132 RH |
3234 | |
3235 | * Uleb128:: @code{.uleb128 @var{expressions}} | |
3236 | * Word:: @code{.word @var{expressions}} | |
3237 | * Deprecated:: Deprecated Directives | |
3238 | @end menu | |
3239 | ||
3240 | @node Abort | |
3241 | @section @code{.abort} | |
3242 | ||
3243 | @cindex @code{abort} directive | |
3244 | @cindex stopping the assembly | |
3245 | This directive stops the assembly immediately. It is for | |
3246 | compatibility with other assemblers. The original idea was that the | |
3247 | assembly language source would be piped into the assembler. If the sender | |
3248 | of the source quit, it could use this directive tells @code{@value{AS}} to | |
3249 | quit also. One day @code{.abort} will not be supported. | |
3250 | ||
3251 | @ifset COFF | |
3252 | @node ABORT | |
3253 | @section @code{.ABORT} | |
3254 | ||
3255 | @cindex @code{ABORT} directive | |
3256 | When producing COFF output, @code{@value{AS}} accepts this directive as a | |
3257 | synonym for @samp{.abort}. | |
3258 | ||
3259 | @ifset BOUT | |
3260 | When producing @code{b.out} output, @code{@value{AS}} accepts this directive, | |
3261 | but ignores it. | |
3262 | @end ifset | |
3263 | @end ifset | |
3264 | ||
3265 | @node Align | |
3266 | @section @code{.align @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} | |
3267 | ||
3268 | @cindex padding the location counter | |
3269 | @cindex @code{align} directive | |
3270 | Pad the location counter (in the current subsection) to a particular storage | |
3271 | boundary. The first expression (which must be absolute) is the alignment | |
3272 | required, as described below. | |
3273 | ||
3274 | The second expression (also absolute) gives the fill value to be stored in the | |
3275 | padding bytes. It (and the comma) may be omitted. If it is omitted, the | |
3276 | padding bytes are normally zero. However, on some systems, if the section is | |
3277 | marked as containing code and the fill value is omitted, the space is filled | |
3278 | with no-op instructions. | |
3279 | ||
3280 | The third expression is also absolute, and is also optional. If it is present, | |
3281 | it is the maximum number of bytes that should be skipped by this alignment | |
3282 | directive. If doing the alignment would require skipping more bytes than the | |
3283 | specified maximum, then the alignment is not done at all. You can omit the | |
3284 | fill value (the second argument) entirely by simply using two commas after the | |
3285 | required alignment; this can be useful if you want the alignment to be filled | |
3286 | with no-op instructions when appropriate. | |
3287 | ||
3288 | The way the required alignment is specified varies from system to system. | |
3289 | For the a29k, hppa, m68k, m88k, w65, sparc, and Hitachi SH, and i386 using ELF | |
3290 | format, | |
3291 | the first expression is the | |
3292 | alignment request in bytes. For example @samp{.align 8} advances | |
3293 | the location counter until it is a multiple of 8. If the location counter | |
3294 | is already a multiple of 8, no change is needed. | |
3295 | ||
adcf07e6 NC |
3296 | For other systems, including the i386 using a.out format, and the arm and |
3297 | strongarm, it is the | |
252b5132 RH |
3298 | number of low-order zero bits the location counter must have after |
3299 | advancement. For example @samp{.align 3} advances the location | |
3300 | counter until it a multiple of 8. If the location counter is already a | |
3301 | multiple of 8, no change is needed. | |
3302 | ||
3303 | This inconsistency is due to the different behaviors of the various | |
3304 | native assemblers for these systems which GAS must emulate. | |
3305 | GAS also provides @code{.balign} and @code{.p2align} directives, | |
3306 | described later, which have a consistent behavior across all | |
3307 | architectures (but are specific to GAS). | |
3308 | ||
3309 | @node Ascii | |
3310 | @section @code{.ascii "@var{string}"}@dots{} | |
3311 | ||
3312 | @cindex @code{ascii} directive | |
3313 | @cindex string literals | |
3314 | @code{.ascii} expects zero or more string literals (@pxref{Strings}) | |
3315 | separated by commas. It assembles each string (with no automatic | |
3316 | trailing zero byte) into consecutive addresses. | |
3317 | ||
3318 | @node Asciz | |
3319 | @section @code{.asciz "@var{string}"}@dots{} | |
3320 | ||
3321 | @cindex @code{asciz} directive | |
3322 | @cindex zero-terminated strings | |
3323 | @cindex null-terminated strings | |
3324 | @code{.asciz} is just like @code{.ascii}, but each string is followed by | |
3325 | a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''. | |
3326 | ||
3327 | @node Balign | |
3328 | @section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} | |
3329 | ||
3330 | @cindex padding the location counter given number of bytes | |
3331 | @cindex @code{balign} directive | |
3332 | Pad the location counter (in the current subsection) to a particular | |
3333 | storage boundary. The first expression (which must be absolute) is the | |
3334 | alignment request in bytes. For example @samp{.balign 8} advances | |
3335 | the location counter until it is a multiple of 8. If the location counter | |
3336 | is already a multiple of 8, no change is needed. | |
3337 | ||
3338 | The second expression (also absolute) gives the fill value to be stored in the | |
3339 | padding bytes. It (and the comma) may be omitted. If it is omitted, the | |
3340 | padding bytes are normally zero. However, on some systems, if the section is | |
3341 | marked as containing code and the fill value is omitted, the space is filled | |
3342 | with no-op instructions. | |
3343 | ||
3344 | The third expression is also absolute, and is also optional. If it is present, | |
3345 | it is the maximum number of bytes that should be skipped by this alignment | |
3346 | directive. If doing the alignment would require skipping more bytes than the | |
3347 | specified maximum, then the alignment is not done at all. You can omit the | |
3348 | fill value (the second argument) entirely by simply using two commas after the | |
3349 | required alignment; this can be useful if you want the alignment to be filled | |
3350 | with no-op instructions when appropriate. | |
3351 | ||
3352 | @cindex @code{balignw} directive | |
3353 | @cindex @code{balignl} directive | |
3354 | The @code{.balignw} and @code{.balignl} directives are variants of the | |
3355 | @code{.balign} directive. The @code{.balignw} directive treats the fill | |
3356 | pattern as a two byte word value. The @code{.balignl} directives treats the | |
3357 | fill pattern as a four byte longword value. For example, @code{.balignw | |
3358 | 4,0x368d} will align to a multiple of 4. If it skips two bytes, they will be | |
3359 | filled in with the value 0x368d (the exact placement of the bytes depends upon | |
3360 | the endianness of the processor). If it skips 1 or 3 bytes, the fill value is | |
3361 | undefined. | |
3362 | ||
3363 | @node Byte | |
3364 | @section @code{.byte @var{expressions}} | |
3365 | ||
3366 | @cindex @code{byte} directive | |
3367 | @cindex integers, one byte | |
3368 | @code{.byte} expects zero or more expressions, separated by commas. | |
3369 | Each expression is assembled into the next byte. | |
3370 | ||
3371 | @node Comm | |
3372 | @section @code{.comm @var{symbol} , @var{length} } | |
3373 | ||
3374 | @cindex @code{comm} directive | |
3375 | @cindex symbol, common | |
3376 | @code{.comm} declares a common symbol named @var{symbol}. When linking, a | |
3377 | common symbol in one object file may be merged with a defined or common symbol | |
3378 | of the same name in another object file. If @code{@value{LD}} does not see a | |
3379 | definition for the symbol--just one or more common symbols--then it will | |
3380 | allocate @var{length} bytes of uninitialized memory. @var{length} must be an | |
3381 | absolute expression. If @code{@value{LD}} sees multiple common symbols with | |
3382 | the same name, and they do not all have the same size, it will allocate space | |
3383 | using the largest size. | |
3384 | ||
3385 | @ifset ELF | |
3386 | When using ELF, the @code{.comm} directive takes an optional third argument. | |
3387 | This is the desired alignment of the symbol, specified as a byte boundary (for | |
3388 | example, an alignment of 16 means that the least significant 4 bits of the | |
3389 | address should be zero). The alignment must be an absolute expression, and it | |
3390 | must be a power of two. If @code{@value{LD}} allocates uninitialized memory | |
3391 | for the common symbol, it will use the alignment when placing the symbol. If | |
3392 | no alignment is specified, @code{@value{AS}} will set the alignment to the | |
3393 | largest power of two less than or equal to the size of the symbol, up to a | |
3394 | maximum of 16. | |
3395 | @end ifset | |
3396 | ||
3397 | @ifset HPPA | |
3398 | The syntax for @code{.comm} differs slightly on the HPPA. The syntax is | |
3399 | @samp{@var{symbol} .comm, @var{length}}; @var{symbol} is optional. | |
3400 | @end ifset | |
3401 | ||
3402 | @node Data | |
3403 | @section @code{.data @var{subsection}} | |
3404 | ||
3405 | @cindex @code{data} directive | |
3406 | @code{.data} tells @code{@value{AS}} to assemble the following statements onto the | |
3407 | end of the data subsection numbered @var{subsection} (which is an | |
3408 | absolute expression). If @var{subsection} is omitted, it defaults | |
3409 | to zero. | |
3410 | ||
3411 | @ifset COFF | |
3412 | @node Def | |
3413 | @section @code{.def @var{name}} | |
3414 | ||
3415 | @cindex @code{def} directive | |
3416 | @cindex COFF symbols, debugging | |
3417 | @cindex debugging COFF symbols | |
3418 | Begin defining debugging information for a symbol @var{name}; the | |
3419 | definition extends until the @code{.endef} directive is encountered. | |
3420 | @ifset BOUT | |
3421 | ||
3422 | This directive is only observed when @code{@value{AS}} is configured for COFF | |
3423 | format output; when producing @code{b.out}, @samp{.def} is recognized, | |
3424 | but ignored. | |
3425 | @end ifset | |
3426 | @end ifset | |
3427 | ||
3428 | @ifset aout-bout | |
3429 | @node Desc | |
3430 | @section @code{.desc @var{symbol}, @var{abs-expression}} | |
3431 | ||
3432 | @cindex @code{desc} directive | |
3433 | @cindex COFF symbol descriptor | |
3434 | @cindex symbol descriptor, COFF | |
3435 | This directive sets the descriptor of the symbol (@pxref{Symbol Attributes}) | |
3436 | to the low 16 bits of an absolute expression. | |
3437 | ||
3438 | @ifset COFF | |
3439 | The @samp{.desc} directive is not available when @code{@value{AS}} is | |
3440 | configured for COFF output; it is only for @code{a.out} or @code{b.out} | |
3441 | object format. For the sake of compatibility, @code{@value{AS}} accepts | |
3442 | it, but produces no output, when configured for COFF. | |
3443 | @end ifset | |
3444 | @end ifset | |
3445 | ||
3446 | @ifset COFF | |
3447 | @node Dim | |
3448 | @section @code{.dim} | |
3449 | ||
3450 | @cindex @code{dim} directive | |
3451 | @cindex COFF auxiliary symbol information | |
3452 | @cindex auxiliary symbol information, COFF | |
3453 | This directive is generated by compilers to include auxiliary debugging | |
3454 | information in the symbol table. It is only permitted inside | |
3455 | @code{.def}/@code{.endef} pairs. | |
3456 | @ifset BOUT | |
3457 | ||
3458 | @samp{.dim} is only meaningful when generating COFF format output; when | |
3459 | @code{@value{AS}} is generating @code{b.out}, it accepts this directive but | |
3460 | ignores it. | |
3461 | @end ifset | |
3462 | @end ifset | |
3463 | ||
3464 | @node Double | |
3465 | @section @code{.double @var{flonums}} | |
3466 | ||
3467 | @cindex @code{double} directive | |
3468 | @cindex floating point numbers (double) | |
3469 | @code{.double} expects zero or more flonums, separated by commas. It | |
3470 | assembles floating point numbers. | |
3471 | @ifset GENERIC | |
3472 | The exact kind of floating point numbers emitted depends on how | |
3473 | @code{@value{AS}} is configured. @xref{Machine Dependencies}. | |
3474 | @end ifset | |
3475 | @ifclear GENERIC | |
3476 | @ifset IEEEFLOAT | |
3477 | On the @value{TARGET} family @samp{.double} emits 64-bit floating-point numbers | |
3478 | in @sc{ieee} format. | |
3479 | @end ifset | |
3480 | @end ifclear | |
3481 | ||
3482 | @node Eject | |
3483 | @section @code{.eject} | |
3484 | ||
3485 | @cindex @code{eject} directive | |
3486 | @cindex new page, in listings | |
3487 | @cindex page, in listings | |
3488 | @cindex listing control: new page | |
3489 | Force a page break at this point, when generating assembly listings. | |
3490 | ||
3491 | @node Else | |
3492 | @section @code{.else} | |
3493 | ||
3494 | @cindex @code{else} directive | |
3495 | @code{.else} is part of the @code{@value{AS}} support for conditional | |
3496 | assembly; @pxref{If,,@code{.if}}. It marks the beginning of a section | |
3497 | of code to be assembled if the condition for the preceding @code{.if} | |
3498 | was false. | |
3499 | ||
3fd9f047 TW |
3500 | @node Elseif |
3501 | @section @code{.elseif} | |
3502 | ||
3503 | @cindex @code{elseif} directive | |
3504 | @code{.elseif} is part of the @code{@value{AS}} support for conditional | |
3505 | assembly; @pxref{If,,@code{.if}}. It is shorthand for beginning a new | |
3506 | @code{.if} block that would otherwise fill the entire @code{.else} section. | |
3507 | ||
252b5132 RH |
3508 | @node End |
3509 | @section @code{.end} | |
3510 | ||
3511 | @cindex @code{end} directive | |
3512 | @code{.end} marks the end of the assembly file. @code{@value{AS}} does not | |
3513 | process anything in the file past the @code{.end} directive. | |
3514 | ||
3515 | @ifset COFF | |
3516 | @node Endef | |
3517 | @section @code{.endef} | |
3518 | ||
3519 | @cindex @code{endef} directive | |
3520 | This directive flags the end of a symbol definition begun with | |
3521 | @code{.def}. | |
3522 | @ifset BOUT | |
3523 | ||
3524 | @samp{.endef} is only meaningful when generating COFF format output; if | |
3525 | @code{@value{AS}} is configured to generate @code{b.out}, it accepts this | |
3526 | directive but ignores it. | |
3527 | @end ifset | |
3528 | @end ifset | |
3529 | ||
3530 | @node Endfunc | |
3531 | @section @code{.endfunc} | |
3532 | @cindex @code{endfunc} directive | |
3533 | @code{.endfunc} marks the end of a function specified with @code{.func}. | |
3534 | ||
3535 | @node Endif | |
3536 | @section @code{.endif} | |
3537 | ||
3538 | @cindex @code{endif} directive | |
3539 | @code{.endif} is part of the @code{@value{AS}} support for conditional assembly; | |
3540 | it marks the end of a block of code that is only assembled | |
3541 | conditionally. @xref{If,,@code{.if}}. | |
3542 | ||
3543 | @node Equ | |
3544 | @section @code{.equ @var{symbol}, @var{expression}} | |
3545 | ||
3546 | @cindex @code{equ} directive | |
3547 | @cindex assigning values to symbols | |
3548 | @cindex symbols, assigning values to | |
3549 | This directive sets the value of @var{symbol} to @var{expression}. | |
3550 | It is synonymous with @samp{.set}; @pxref{Set,,@code{.set}}. | |
3551 | ||
3552 | @ifset HPPA | |
3553 | The syntax for @code{equ} on the HPPA is | |
3554 | @samp{@var{symbol} .equ @var{expression}}. | |
3555 | @end ifset | |
3556 | ||
3557 | @node Equiv | |
3558 | @section @code{.equiv @var{symbol}, @var{expression}} | |
3559 | @cindex @code{equiv} directive | |
3560 | The @code{.equiv} directive is like @code{.equ} and @code{.set}, except that | |
3561 | the assembler will signal an error if @var{symbol} is already defined. | |
3562 | ||
3563 | Except for the contents of the error message, this is roughly equivalent to | |
3564 | @smallexample | |
3565 | .ifdef SYM | |
3566 | .err | |
3567 | .endif | |
3568 | .equ SYM,VAL | |
3569 | @end smallexample | |
3570 | ||
3571 | @node Err | |
3572 | @section @code{.err} | |
3573 | @cindex @code{err} directive | |
3574 | If @code{@value{AS}} assembles a @code{.err} directive, it will print an error | |
3575 | message and, unless the @code{-Z} option was used, it will not generate an | |
3576 | object file. This can be used to signal error an conditionally compiled code. | |
3577 | ||
3578 | @node Exitm | |
3579 | @section @code{.exitm} | |
3580 | Exit early from the current macro definition. @xref{Macro}. | |
3581 | ||
3582 | @node Extern | |
3583 | @section @code{.extern} | |
3584 | ||
3585 | @cindex @code{extern} directive | |
3586 | @code{.extern} is accepted in the source program---for compatibility | |
3587 | with other assemblers---but it is ignored. @code{@value{AS}} treats | |
3588 | all undefined symbols as external. | |
3589 | ||
3590 | @node Fail | |
3591 | @section @code{.fail @var{expression}} | |
3592 | ||
3593 | @cindex @code{fail} directive | |
3594 | Generates an error or a warning. If the value of the @var{expression} is 500 | |
3595 | or more, @code{@value{AS}} will print a warning message. If the value is less | |
3596 | than 500, @code{@value{AS}} will print an error message. The message will | |
3597 | include the value of @var{expression}. This can occasionally be useful inside | |
3598 | complex nested macros or conditional assembly. | |
3599 | ||
3600 | @ifclear no-file-dir | |
3601 | @node File | |
3602 | @section @code{.file @var{string}} | |
3603 | ||
3604 | @cindex @code{file} directive | |
3605 | @cindex logical file name | |
3606 | @cindex file name, logical | |
3607 | @code{.file} tells @code{@value{AS}} that we are about to start a new logical | |
3608 | file. @var{string} is the new file name. In general, the filename is | |
3609 | recognized whether or not it is surrounded by quotes @samp{"}; but if you wish | |
3610 | to specify an empty file name, you must give the quotes--@code{""}. This | |
3611 | statement may go away in future: it is only recognized to be compatible with | |
3612 | old @code{@value{AS}} programs. | |
3613 | @ifset A29K | |
3614 | In some configurations of @code{@value{AS}}, @code{.file} has already been | |
3615 | removed to avoid conflicts with other assemblers. @xref{Machine Dependencies}. | |
3616 | @end ifset | |
3617 | @end ifclear | |
3618 | ||
3619 | @node Fill | |
3620 | @section @code{.fill @var{repeat} , @var{size} , @var{value}} | |
3621 | ||
3622 | @cindex @code{fill} directive | |
3623 | @cindex writing patterns in memory | |
3624 | @cindex patterns, writing in memory | |
3625 | @var{result}, @var{size} and @var{value} are absolute expressions. | |
3626 | This emits @var{repeat} copies of @var{size} bytes. @var{Repeat} | |
3627 | may be zero or more. @var{Size} may be zero or more, but if it is | |
3628 | more than 8, then it is deemed to have the value 8, compatible with | |
3629 | other people's assemblers. The contents of each @var{repeat} bytes | |
3630 | is taken from an 8-byte number. The highest order 4 bytes are | |
3631 | zero. The lowest order 4 bytes are @var{value} rendered in the | |
3632 | byte-order of an integer on the computer @code{@value{AS}} is assembling for. | |
3633 | Each @var{size} bytes in a repetition is taken from the lowest order | |
3634 | @var{size} bytes of this number. Again, this bizarre behavior is | |
3635 | compatible with other people's assemblers. | |
3636 | ||
3637 | @var{size} and @var{value} are optional. | |
3638 | If the second comma and @var{value} are absent, @var{value} is | |
3639 | assumed zero. If the first comma and following tokens are absent, | |
3640 | @var{size} is assumed to be 1. | |
3641 | ||
3642 | @node Float | |
3643 | @section @code{.float @var{flonums}} | |
3644 | ||
3645 | @cindex floating point numbers (single) | |
3646 | @cindex @code{float} directive | |
3647 | This directive assembles zero or more flonums, separated by commas. It | |
3648 | has the same effect as @code{.single}. | |
3649 | @ifset GENERIC | |
3650 | The exact kind of floating point numbers emitted depends on how | |
3651 | @code{@value{AS}} is configured. | |
3652 | @xref{Machine Dependencies}. | |
3653 | @end ifset | |
3654 | @ifclear GENERIC | |
3655 | @ifset IEEEFLOAT | |
3656 | On the @value{TARGET} family, @code{.float} emits 32-bit floating point numbers | |
3657 | in @sc{ieee} format. | |
3658 | @end ifset | |
3659 | @end ifclear | |
3660 | ||
3661 | @node Func | |
3662 | @section @code{.func @var{name}[,@var{label}]} | |
3663 | @cindex @code{func} directive | |
3664 | @code{.func} emits debugging information to denote function @var{name}, and | |
3665 | is ignored unless the file is assembled with debugging enabled. | |
3666 | Only @samp{--gstabs} is currently supported. | |
3667 | @var{label} is the entry point of the function and if omitted @var{name} | |
3668 | prepended with the @samp{leading char} is used. | |
3669 | @samp{leading char} is usually @code{_} or nothing, depending on the target. | |
3670 | All functions are currently defined to have @code{void} return type. | |
3671 | The function must be terminated with @code{.endfunc}. | |
3672 | ||
3673 | @node Global | |
3674 | @section @code{.global @var{symbol}}, @code{.globl @var{symbol}} | |
3675 | ||
3676 | @cindex @code{global} directive | |
3677 | @cindex symbol, making visible to linker | |
3678 | @code{.global} makes the symbol visible to @code{@value{LD}}. If you define | |
3679 | @var{symbol} in your partial program, its value is made available to | |
3680 | other partial programs that are linked with it. Otherwise, | |
3681 | @var{symbol} takes its attributes from a symbol of the same name | |
3682 | from another file linked into the same program. | |
3683 | ||
3684 | Both spellings (@samp{.globl} and @samp{.global}) are accepted, for | |
3685 | compatibility with other assemblers. | |
3686 | ||
3687 | @ifset HPPA | |
3688 | On the HPPA, @code{.global} is not always enough to make it accessible to other | |
3689 | partial programs. You may need the HPPA-only @code{.EXPORT} directive as well. | |
3690 | @xref{HPPA Directives,, HPPA Assembler Directives}. | |
3691 | @end ifset | |
3692 | ||
3693 | @node hword | |
3694 | @section @code{.hword @var{expressions}} | |
3695 | ||
3696 | @cindex @code{hword} directive | |
3697 | @cindex integers, 16-bit | |
3698 | @cindex numbers, 16-bit | |
3699 | @cindex sixteen bit integers | |
3700 | This expects zero or more @var{expressions}, and emits | |
3701 | a 16 bit number for each. | |
3702 | ||
3703 | @ifset GENERIC | |
3704 | This directive is a synonym for @samp{.short}; depending on the target | |
3705 | architecture, it may also be a synonym for @samp{.word}. | |
3706 | @end ifset | |
3707 | @ifclear GENERIC | |
3708 | @ifset W32 | |
3709 | This directive is a synonym for @samp{.short}. | |
3710 | @end ifset | |
3711 | @ifset W16 | |
3712 | This directive is a synonym for both @samp{.short} and @samp{.word}. | |
3713 | @end ifset | |
3714 | @end ifclear | |
3715 | ||
3716 | @node Ident | |
3717 | @section @code{.ident} | |
3718 | ||
3719 | @cindex @code{ident} directive | |
3720 | This directive is used by some assemblers to place tags in object files. | |
3721 | @code{@value{AS}} simply accepts the directive for source-file | |
3722 | compatibility with such assemblers, but does not actually emit anything | |
3723 | for it. | |
3724 | ||
3725 | @node If | |
3726 | @section @code{.if @var{absolute expression}} | |
3727 | ||
3728 | @cindex conditional assembly | |
3729 | @cindex @code{if} directive | |
3730 | @code{.if} marks the beginning of a section of code which is only | |
3731 | considered part of the source program being assembled if the argument | |
3732 | (which must be an @var{absolute expression}) is non-zero. The end of | |
3733 | the conditional section of code must be marked by @code{.endif} | |
3734 | (@pxref{Endif,,@code{.endif}}); optionally, you may include code for the | |
3735 | alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}). | |
3fd9f047 TW |
3736 | If you have several conditions to check, @code{.elseif} may be used to avoid |
3737 | nesting blocks if/else within each subsequent @code{.else} block. | |
252b5132 RH |
3738 | |
3739 | The following variants of @code{.if} are also supported: | |
3740 | @table @code | |
3741 | @cindex @code{ifdef} directive | |
3742 | @item .ifdef @var{symbol} | |
3743 | Assembles the following section of code if the specified @var{symbol} | |
3744 | has been defined. | |
3745 | ||
3746 | @cindex @code{ifc} directive | |
3747 | @item .ifc @var{string1},@var{string2} | |
3748 | Assembles the following section of code if the two strings are the same. The | |
3749 | strings may be optionally quoted with single quotes. If they are not quoted, | |
3750 | the first string stops at the first comma, and the second string stops at the | |
3751 | end of the line. Strings which contain whitespace should be quoted. The | |
3752 | string comparison is case sensitive. | |
3753 | ||
3754 | @cindex @code{ifeq} directive | |
3755 | @item .ifeq @var{absolute expression} | |
3756 | Assembles the following section of code if the argument is zero. | |
3757 | ||
3758 | @cindex @code{ifeqs} directive | |
3759 | @item .ifeqs @var{string1},@var{string2} | |
3760 | Another form of @code{.ifc}. The strings must be quoted using double quotes. | |
3761 | ||
3762 | @cindex @code{ifge} directive | |
3763 | @item .ifge @var{absolute expression} | |
3764 | Assembles the following section of code if the argument is greater than or | |
3765 | equal to zero. | |
3766 | ||
3767 | @cindex @code{ifgt} directive | |
3768 | @item .ifgt @var{absolute expression} | |
3769 | Assembles the following section of code if the argument is greater than zero. | |
3770 | ||
3771 | @cindex @code{ifle} directive | |
3772 | @item .ifle @var{absolute expression} | |
3773 | Assembles the following section of code if the argument is less than or equal | |
3774 | to zero. | |
3775 | ||
3776 | @cindex @code{iflt} directive | |
3777 | @item .iflt @var{absolute expression} | |
3778 | Assembles the following section of code if the argument is less than zero. | |
3779 | ||
3780 | @cindex @code{ifnc} directive | |
3781 | @item .ifnc @var{string1},@var{string2}. | |
3782 | Like @code{.ifc}, but the sense of the test is reversed: this assembles the | |
3783 | following section of code if the two strings are not the same. | |
3784 | ||
3785 | @cindex @code{ifndef} directive | |
3786 | @cindex @code{ifnotdef} directive | |
3787 | @item .ifndef @var{symbol} | |
3788 | @itemx .ifnotdef @var{symbol} | |
3789 | Assembles the following section of code if the specified @var{symbol} | |
3790 | has not been defined. Both spelling variants are equivalent. | |
3791 | ||
3792 | @cindex @code{ifne} directive | |
3793 | @item .ifne @var{absolute expression} | |
3794 | Assembles the following section of code if the argument is not equal to zero | |
3795 | (in other words, this is equivalent to @code{.if}). | |
3796 | ||
3797 | @cindex @code{ifnes} directive | |
3798 | @item .ifnes @var{string1},@var{string2} | |
3799 | Like @code{.ifeqs}, but the sense of the test is reversed: this assembles the | |
3800 | following section of code if the two strings are not the same. | |
3801 | @end table | |
3802 | ||
3803 | @node Include | |
3804 | @section @code{.include "@var{file}"} | |
3805 | ||
3806 | @cindex @code{include} directive | |
3807 | @cindex supporting files, including | |
3808 | @cindex files, including | |
3809 | This directive provides a way to include supporting files at specified | |
3810 | points in your source program. The code from @var{file} is assembled as | |
3811 | if it followed the point of the @code{.include}; when the end of the | |
3812 | included file is reached, assembly of the original file continues. You | |
3813 | can control the search paths used with the @samp{-I} command-line option | |
3814 | (@pxref{Invoking,,Command-Line Options}). Quotation marks are required | |
3815 | around @var{file}. | |
3816 | ||
3817 | @node Int | |
3818 | @section @code{.int @var{expressions}} | |
3819 | ||
3820 | @cindex @code{int} directive | |
3821 | @cindex integers, 32-bit | |
3822 | Expect zero or more @var{expressions}, of any section, separated by commas. | |
3823 | For each expression, emit a number that, at run time, is the value of that | |
3824 | expression. The byte order and bit size of the number depends on what kind | |
3825 | of target the assembly is for. | |
3826 | ||
3827 | @ifclear GENERIC | |
3828 | @ifset H8 | |
3829 | On the H8/500 and most forms of the H8/300, @code{.int} emits 16-bit | |
3830 | integers. On the H8/300H and the Hitachi SH, however, @code{.int} emits | |
3831 | 32-bit integers. | |
3832 | @end ifset | |
3833 | @end ifclear | |
3834 | ||
3835 | @node Irp | |
3836 | @section @code{.irp @var{symbol},@var{values}}@dots{} | |
3837 | ||
3838 | @cindex @code{irp} directive | |
3839 | Evaluate a sequence of statements assigning different values to @var{symbol}. | |
3840 | The sequence of statements starts at the @code{.irp} directive, and is | |
3841 | terminated by an @code{.endr} directive. For each @var{value}, @var{symbol} is | |
3842 | set to @var{value}, and the sequence of statements is assembled. If no | |
3843 | @var{value} is listed, the sequence of statements is assembled once, with | |
3844 | @var{symbol} set to the null string. To refer to @var{symbol} within the | |
3845 | sequence of statements, use @var{\symbol}. | |
3846 | ||
3847 | For example, assembling | |
3848 | ||
3849 | @example | |
3850 | .irp param,1,2,3 | |
3851 | move d\param,sp@@- | |
3852 | .endr | |
3853 | @end example | |
3854 | ||
3855 | is equivalent to assembling | |
3856 | ||
3857 | @example | |
3858 | move d1,sp@@- | |
3859 | move d2,sp@@- | |
3860 | move d3,sp@@- | |
3861 | @end example | |
3862 | ||
3863 | @node Irpc | |
3864 | @section @code{.irpc @var{symbol},@var{values}}@dots{} | |
3865 | ||
3866 | @cindex @code{irpc} directive | |
3867 | Evaluate a sequence of statements assigning different values to @var{symbol}. | |
3868 | The sequence of statements starts at the @code{.irpc} directive, and is | |
3869 | terminated by an @code{.endr} directive. For each character in @var{value}, | |
3870 | @var{symbol} is set to the character, and the sequence of statements is | |
3871 | assembled. If no @var{value} is listed, the sequence of statements is | |
3872 | assembled once, with @var{symbol} set to the null string. To refer to | |
3873 | @var{symbol} within the sequence of statements, use @var{\symbol}. | |
3874 | ||
3875 | For example, assembling | |
3876 | ||
3877 | @example | |
3878 | .irpc param,123 | |
3879 | move d\param,sp@@- | |
3880 | .endr | |
3881 | @end example | |
3882 | ||
3883 | is equivalent to assembling | |
3884 | ||
3885 | @example | |
3886 | move d1,sp@@- | |
3887 | move d2,sp@@- | |
3888 | move d3,sp@@- | |
3889 | @end example | |
3890 | ||
3891 | @node Lcomm | |
3892 | @section @code{.lcomm @var{symbol} , @var{length}} | |
3893 | ||
3894 | @cindex @code{lcomm} directive | |
3895 | @cindex local common symbols | |
3896 | @cindex symbols, local common | |
3897 | Reserve @var{length} (an absolute expression) bytes for a local common | |
3898 | denoted by @var{symbol}. The section and value of @var{symbol} are | |
3899 | those of the new local common. The addresses are allocated in the bss | |
3900 | section, so that at run-time the bytes start off zeroed. @var{Symbol} | |
3901 | is not declared global (@pxref{Global,,@code{.global}}), so is normally | |
3902 | not visible to @code{@value{LD}}. | |
3903 | ||
3904 | @ifset GENERIC | |
3905 | Some targets permit a third argument to be used with @code{.lcomm}. This | |
3906 | argument specifies the desired alignment of the symbol in the bss section. | |
3907 | @end ifset | |
3908 | ||
3909 | @ifset HPPA | |
3910 | The syntax for @code{.lcomm} differs slightly on the HPPA. The syntax is | |
3911 | @samp{@var{symbol} .lcomm, @var{length}}; @var{symbol} is optional. | |
3912 | @end ifset | |
3913 | ||
3914 | @node Lflags | |
3915 | @section @code{.lflags} | |
3916 | ||
3917 | @cindex @code{lflags} directive (ignored) | |
3918 | @code{@value{AS}} accepts this directive, for compatibility with other | |
3919 | assemblers, but ignores it. | |
3920 | ||
3921 | @ifclear no-line-dir | |
3922 | @node Line | |
3923 | @section @code{.line @var{line-number}} | |
3924 | ||
3925 | @cindex @code{line} directive | |
3926 | @end ifclear | |
3927 | @ifset no-line-dir | |
3928 | @node Ln | |
3929 | @section @code{.ln @var{line-number}} | |
3930 | ||
3931 | @cindex @code{ln} directive | |
3932 | @end ifset | |
3933 | @cindex logical line number | |
3934 | @ifset aout-bout | |
3935 | Change the logical line number. @var{line-number} must be an absolute | |
3936 | expression. The next line has that logical line number. Therefore any other | |
3937 | statements on the current line (after a statement separator character) are | |
3938 | reported as on logical line number @var{line-number} @minus{} 1. One day | |
3939 | @code{@value{AS}} will no longer support this directive: it is recognized only | |
3940 | for compatibility with existing assembler programs. | |
3941 | ||
3942 | @ifset GENERIC | |
3943 | @ifset A29K | |
3944 | @emph{Warning:} In the AMD29K configuration of @value{AS}, this command is | |
3945 | not available; use the synonym @code{.ln} in that context. | |
3946 | @end ifset | |
3947 | @end ifset | |
3948 | @end ifset | |
3949 | ||
3950 | @ifclear no-line-dir | |
3951 | Even though this is a directive associated with the @code{a.out} or | |
3952 | @code{b.out} object-code formats, @code{@value{AS}} still recognizes it | |
3953 | when producing COFF output, and treats @samp{.line} as though it | |
3954 | were the COFF @samp{.ln} @emph{if} it is found outside a | |
3955 | @code{.def}/@code{.endef} pair. | |
3956 | ||
3957 | Inside a @code{.def}, @samp{.line} is, instead, one of the directives | |
3958 | used by compilers to generate auxiliary symbol information for | |
3959 | debugging. | |
3960 | @end ifclear | |
3961 | ||
3962 | @node Linkonce | |
3963 | @section @code{.linkonce [@var{type}]} | |
3964 | @cindex COMDAT | |
3965 | @cindex @code{linkonce} directive | |
3966 | @cindex common sections | |
3967 | Mark the current section so that the linker only includes a single copy of it. | |
3968 | This may be used to include the same section in several different object files, | |
3969 | but ensure that the linker will only include it once in the final output file. | |
3970 | The @code{.linkonce} pseudo-op must be used for each instance of the section. | |
3971 | Duplicate sections are detected based on the section name, so it should be | |
3972 | unique. | |
3973 | ||
3974 | This directive is only supported by a few object file formats; as of this | |
3975 | writing, the only object file format which supports it is the Portable | |
3976 | Executable format used on Windows NT. | |
3977 | ||
3978 | The @var{type} argument is optional. If specified, it must be one of the | |
3979 | following strings. For example: | |
3980 | @smallexample | |
3981 | .linkonce same_size | |
3982 | @end smallexample | |
3983 | Not all types may be supported on all object file formats. | |
3984 | ||
3985 | @table @code | |
3986 | @item discard | |
3987 | Silently discard duplicate sections. This is the default. | |
3988 | ||
3989 | @item one_only | |
3990 | Warn if there are duplicate sections, but still keep only one copy. | |
3991 | ||
3992 | @item same_size | |
3993 | Warn if any of the duplicates have different sizes. | |
3994 | ||
3995 | @item same_contents | |
3996 | Warn if any of the duplicates do not have exactly the same contents. | |
3997 | @end table | |
3998 | ||
3999 | @node Ln | |
4000 | @section @code{.ln @var{line-number}} | |
4001 | ||
4002 | @cindex @code{ln} directive | |
4003 | @ifclear no-line-dir | |
4004 | @samp{.ln} is a synonym for @samp{.line}. | |
4005 | @end ifclear | |
4006 | @ifset no-line-dir | |
4007 | Tell @code{@value{AS}} to change the logical line number. @var{line-number} | |
4008 | must be an absolute expression. The next line has that logical | |
4009 | line number, so any other statements on the current line (after a | |
4010 | statement separator character @code{;}) are reported as on logical | |
4011 | line number @var{line-number} @minus{} 1. | |
4012 | @ifset BOUT | |
4013 | ||
4014 | This directive is accepted, but ignored, when @code{@value{AS}} is | |
4015 | configured for @code{b.out}; its effect is only associated with COFF | |
4016 | output format. | |
4017 | @end ifset | |
4018 | @end ifset | |
4019 | ||
4020 | @node MRI | |
4021 | @section @code{.mri @var{val}} | |
4022 | ||
4023 | @cindex @code{mri} directive | |
4024 | @cindex MRI mode, temporarily | |
4025 | If @var{val} is non-zero, this tells @code{@value{AS}} to enter MRI mode. If | |
4026 | @var{val} is zero, this tells @code{@value{AS}} to exit MRI mode. This change | |
4027 | affects code assembled until the next @code{.mri} directive, or until the end | |
4028 | of the file. @xref{M, MRI mode, MRI mode}. | |
4029 | ||
4030 | @node List | |
4031 | @section @code{.list} | |
4032 | ||
4033 | @cindex @code{list} directive | |
4034 | @cindex listing control, turning on | |
4035 | Control (in conjunction with the @code{.nolist} directive) whether or | |
4036 | not assembly listings are generated. These two directives maintain an | |
4037 | internal counter (which is zero initially). @code{.list} increments the | |
4038 | counter, and @code{.nolist} decrements it. Assembly listings are | |
4039 | generated whenever the counter is greater than zero. | |
4040 | ||
4041 | By default, listings are disabled. When you enable them (with the | |
4042 | @samp{-a} command line option; @pxref{Invoking,,Command-Line Options}), | |
4043 | the initial value of the listing counter is one. | |
4044 | ||
4045 | @node Long | |
4046 | @section @code{.long @var{expressions}} | |
4047 | ||
4048 | @cindex @code{long} directive | |
4049 | @code{.long} is the same as @samp{.int}, @pxref{Int,,@code{.int}}. | |
4050 | ||
4051 | @ignore | |
4052 | @c no one seems to know what this is for or whether this description is | |
4053 | @c what it really ought to do | |
4054 | @node Lsym | |
4055 | @section @code{.lsym @var{symbol}, @var{expression}} | |
4056 | ||
4057 | @cindex @code{lsym} directive | |
4058 | @cindex symbol, not referenced in assembly | |
4059 | @code{.lsym} creates a new symbol named @var{symbol}, but does not put it in | |
4060 | the hash table, ensuring it cannot be referenced by name during the | |
4061 | rest of the assembly. This sets the attributes of the symbol to be | |
4062 | the same as the expression value: | |
4063 | @smallexample | |
4064 | @var{other} = @var{descriptor} = 0 | |
4065 | @var{type} = @r{(section of @var{expression})} | |
4066 | @var{value} = @var{expression} | |
4067 | @end smallexample | |
4068 | @noindent | |
4069 | The new symbol is not flagged as external. | |
4070 | @end ignore | |
4071 | ||
4072 | @node Macro | |
4073 | @section @code{.macro} | |
4074 | ||
4075 | @cindex macros | |
4076 | The commands @code{.macro} and @code{.endm} allow you to define macros that | |
4077 | generate assembly output. For example, this definition specifies a macro | |
4078 | @code{sum} that puts a sequence of numbers into memory: | |
4079 | ||
4080 | @example | |
4081 | .macro sum from=0, to=5 | |
4082 | .long \from | |
4083 | .if \to-\from | |
4084 | sum "(\from+1)",\to | |
4085 | .endif | |
4086 | .endm | |
4087 | @end example | |
4088 | ||
4089 | @noindent | |
4090 | With that definition, @samp{SUM 0,5} is equivalent to this assembly input: | |
4091 | ||
4092 | @example | |
4093 | .long 0 | |
4094 | .long 1 | |
4095 | .long 2 | |
4096 | .long 3 | |
4097 | .long 4 | |
4098 | .long 5 | |
4099 | @end example | |
4100 | ||
4101 | @ftable @code | |
4102 | @item .macro @var{macname} | |
4103 | @itemx .macro @var{macname} @var{macargs} @dots{} | |
4104 | @cindex @code{macro} directive | |
4105 | Begin the definition of a macro called @var{macname}. If your macro | |
4106 | definition requires arguments, specify their names after the macro name, | |
4107 | separated by commas or spaces. You can supply a default value for any | |
4108 | macro argument by following the name with @samp{=@var{deflt}}. For | |
4109 | example, these are all valid @code{.macro} statements: | |
4110 | ||
4111 | @table @code | |
4112 | @item .macro comm | |
4113 | Begin the definition of a macro called @code{comm}, which takes no | |
4114 | arguments. | |
4115 | ||
4116 | @item .macro plus1 p, p1 | |
4117 | @itemx .macro plus1 p p1 | |
4118 | Either statement begins the definition of a macro called @code{plus1}, | |
4119 | which takes two arguments; within the macro definition, write | |
4120 | @samp{\p} or @samp{\p1} to evaluate the arguments. | |
4121 | ||
4122 | @item .macro reserve_str p1=0 p2 | |
4123 | Begin the definition of a macro called @code{reserve_str}, with two | |
4124 | arguments. The first argument has a default value, but not the second. | |
4125 | After the definition is complete, you can call the macro either as | |
4126 | @samp{reserve_str @var{a},@var{b}} (with @samp{\p1} evaluating to | |
4127 | @var{a} and @samp{\p2} evaluating to @var{b}), or as @samp{reserve_str | |
4128 | ,@var{b}} (with @samp{\p1} evaluating as the default, in this case | |
4129 | @samp{0}, and @samp{\p2} evaluating to @var{b}). | |
4130 | @end table | |
4131 | ||
4132 | When you call a macro, you can specify the argument values either by | |
4133 | position, or by keyword. For example, @samp{sum 9,17} is equivalent to | |
4134 | @samp{sum to=17, from=9}. | |
4135 | ||
4136 | @item .endm | |
4137 | @cindex @code{endm} directive | |
4138 | Mark the end of a macro definition. | |
4139 | ||
4140 | @item .exitm | |
4141 | @cindex @code{exitm} directive | |
4142 | Exit early from the current macro definition. | |
4143 | ||
4144 | @cindex number of macros executed | |
4145 | @cindex macros, count executed | |
4146 | @item \@@ | |
4147 | @code{@value{AS}} maintains a counter of how many macros it has | |
4148 | executed in this pseudo-variable; you can copy that number to your | |
4149 | output with @samp{\@@}, but @emph{only within a macro definition}. | |
4150 | ||
4151 | @ignore | |
4152 | @item LOCAL @var{name} [ , @dots{} ] | |
4153 | @emph{Warning: @code{LOCAL} is only available if you select ``alternate | |
4154 | macro syntax'' with @samp{-a} or @samp{--alternate}.} @xref{Alternate,, | |
4155 | Alternate macro syntax}. | |
4156 | ||
4157 | Generate a string replacement for each of the @var{name} arguments, and | |
4158 | replace any instances of @var{name} in each macro expansion. The | |
4159 | replacement string is unique in the assembly, and different for each | |
4160 | separate macro expansion. @code{LOCAL} allows you to write macros that | |
4161 | define symbols, without fear of conflict between separate macro expansions. | |
4162 | @end ignore | |
4163 | @end ftable | |
4164 | ||
4165 | @node Nolist | |
4166 | @section @code{.nolist} | |
4167 | ||
4168 | @cindex @code{nolist} directive | |
4169 | @cindex listing control, turning off | |
4170 | Control (in conjunction with the @code{.list} directive) whether or | |
4171 | not assembly listings are generated. These two directives maintain an | |
4172 | internal counter (which is zero initially). @code{.list} increments the | |
4173 | counter, and @code{.nolist} decrements it. Assembly listings are | |
4174 | generated whenever the counter is greater than zero. | |
4175 | ||
4176 | @node Octa | |
4177 | @section @code{.octa @var{bignums}} | |
4178 | ||
4179 | @c FIXME: double size emitted for "octa" on i960, others? Or warn? | |
4180 | @cindex @code{octa} directive | |
4181 | @cindex integer, 16-byte | |
4182 | @cindex sixteen byte integer | |
4183 | This directive expects zero or more bignums, separated by commas. For each | |
4184 | bignum, it emits a 16-byte integer. | |
4185 | ||
4186 | The term ``octa'' comes from contexts in which a ``word'' is two bytes; | |
4187 | hence @emph{octa}-word for 16 bytes. | |
4188 | ||
4189 | @node Org | |
4190 | @section @code{.org @var{new-lc} , @var{fill}} | |
4191 | ||
4192 | @cindex @code{org} directive | |
4193 | @cindex location counter, advancing | |
4194 | @cindex advancing location counter | |
4195 | @cindex current address, advancing | |
4196 | Advance the location counter of the current section to | |
4197 | @var{new-lc}. @var{new-lc} is either an absolute expression or an | |
4198 | expression with the same section as the current subsection. That is, | |
4199 | you can't use @code{.org} to cross sections: if @var{new-lc} has the | |
4200 | wrong section, the @code{.org} directive is ignored. To be compatible | |
4201 | with former assemblers, if the section of @var{new-lc} is absolute, | |
4202 | @code{@value{AS}} issues a warning, then pretends the section of @var{new-lc} | |
4203 | is the same as the current subsection. | |
4204 | ||
4205 | @code{.org} may only increase the location counter, or leave it | |
4206 | unchanged; you cannot use @code{.org} to move the location counter | |
4207 | backwards. | |
4208 | ||
4209 | @c double negative used below "not undefined" because this is a specific | |
4210 | @c reference to "undefined" (as SEG_UNKNOWN is called in this manual) | |
4211 | @c section. doc@cygnus.com 18feb91 | |
4212 | Because @code{@value{AS}} tries to assemble programs in one pass, @var{new-lc} | |
4213 | may not be undefined. If you really detest this restriction we eagerly await | |
4214 | a chance to share your improved assembler. | |
4215 | ||
4216 | Beware that the origin is relative to the start of the section, not | |
4217 | to the start of the subsection. This is compatible with other | |
4218 | people's assemblers. | |
4219 | ||
4220 | When the location counter (of the current subsection) is advanced, the | |
4221 | intervening bytes are filled with @var{fill} which should be an | |
4222 | absolute expression. If the comma and @var{fill} are omitted, | |
4223 | @var{fill} defaults to zero. | |
4224 | ||
4225 | @node P2align | |
4226 | @section @code{.p2align[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} | |
4227 | ||
4228 | @cindex padding the location counter given a power of two | |
4229 | @cindex @code{p2align} directive | |
4230 | Pad the location counter (in the current subsection) to a particular | |
4231 | storage boundary. The first expression (which must be absolute) is the | |
4232 | number of low-order zero bits the location counter must have after | |
4233 | advancement. For example @samp{.p2align 3} advances the location | |
4234 | counter until it a multiple of 8. If the location counter is already a | |
4235 | multiple of 8, no change is needed. | |
4236 | ||
4237 | The second expression (also absolute) gives the fill value to be stored in the | |
4238 | padding bytes. It (and the comma) may be omitted. If it is omitted, the | |
4239 | padding bytes are normally zero. However, on some systems, if the section is | |
4240 | marked as containing code and the fill value is omitted, the space is filled | |
4241 | with no-op instructions. | |
4242 | ||
4243 | The third expression is also absolute, and is also optional. If it is present, | |
4244 | it is the maximum number of bytes that should be skipped by this alignment | |
4245 | directive. If doing the alignment would require skipping more bytes than the | |
4246 | specified maximum, then the alignment is not done at all. You can omit the | |
4247 | fill value (the second argument) entirely by simply using two commas after the | |
4248 | required alignment; this can be useful if you want the alignment to be filled | |
4249 | with no-op instructions when appropriate. | |
4250 | ||
4251 | @cindex @code{p2alignw} directive | |
4252 | @cindex @code{p2alignl} directive | |
4253 | The @code{.p2alignw} and @code{.p2alignl} directives are variants of the | |
4254 | @code{.p2align} directive. The @code{.p2alignw} directive treats the fill | |
4255 | pattern as a two byte word value. The @code{.p2alignl} directives treats the | |
4256 | fill pattern as a four byte longword value. For example, @code{.p2alignw | |
4257 | 2,0x368d} will align to a multiple of 4. If it skips two bytes, they will be | |
4258 | filled in with the value 0x368d (the exact placement of the bytes depends upon | |
4259 | the endianness of the processor). If it skips 1 or 3 bytes, the fill value is | |
4260 | undefined. | |
4261 | ||
4262 | @node Print | |
4263 | @section @code{.print @var{string}} | |
4264 | ||
4265 | @cindex @code{print} directive | |
4266 | @code{@value{AS}} will print @var{string} on the standard output during | |
4267 | assembly. You must put @var{string} in double quotes. | |
4268 | ||
4269 | @node Psize | |
4270 | @section @code{.psize @var{lines} , @var{columns}} | |
4271 | ||
4272 | @cindex @code{psize} directive | |
4273 | @cindex listing control: paper size | |
4274 | @cindex paper size, for listings | |
4275 | Use this directive to declare the number of lines---and, optionally, the | |
4276 | number of columns---to use for each page, when generating listings. | |
4277 | ||
4278 | If you do not use @code{.psize}, listings use a default line-count | |
4279 | of 60. You may omit the comma and @var{columns} specification; the | |
4280 | default width is 200 columns. | |
4281 | ||
4282 | @code{@value{AS}} generates formfeeds whenever the specified number of | |
4283 | lines is exceeded (or whenever you explicitly request one, using | |
4284 | @code{.eject}). | |
4285 | ||
4286 | If you specify @var{lines} as @code{0}, no formfeeds are generated save | |
4287 | those explicitly specified with @code{.eject}. | |
4288 | ||
4289 | @node Purgem | |
4290 | @section @code{.purgem @var{name}} | |
4291 | ||
4292 | @cindex @code{purgem} directive | |
4293 | Undefine the macro @var{name}, so that later uses of the string will not be | |
4294 | expanded. @xref{Macro}. | |
4295 | ||
4296 | @node Quad | |
4297 | @section @code{.quad @var{bignums}} | |
4298 | ||
4299 | @cindex @code{quad} directive | |
4300 | @code{.quad} expects zero or more bignums, separated by commas. For | |
4301 | each bignum, it emits | |
4302 | @ifclear bignum-16 | |
4303 | an 8-byte integer. If the bignum won't fit in 8 bytes, it prints a | |
4304 | warning message; and just takes the lowest order 8 bytes of the bignum. | |
4305 | @cindex eight-byte integer | |
4306 | @cindex integer, 8-byte | |
4307 | ||
4308 | The term ``quad'' comes from contexts in which a ``word'' is two bytes; | |
4309 | hence @emph{quad}-word for 8 bytes. | |
4310 | @end ifclear | |
4311 | @ifset bignum-16 | |
4312 | a 16-byte integer. If the bignum won't fit in 16 bytes, it prints a | |
4313 | warning message; and just takes the lowest order 16 bytes of the bignum. | |
4314 | @cindex sixteen-byte integer | |
4315 | @cindex integer, 16-byte | |
4316 | @end ifset | |
4317 | ||
4318 | @node Rept | |
4319 | @section @code{.rept @var{count}} | |
4320 | ||
4321 | @cindex @code{rept} directive | |
4322 | Repeat the sequence of lines between the @code{.rept} directive and the next | |
4323 | @code{.endr} directive @var{count} times. | |
4324 | ||
4325 | For example, assembling | |
4326 | ||
4327 | @example | |
4328 | .rept 3 | |
4329 | .long 0 | |
4330 | .endr | |
4331 | @end example | |
4332 | ||
4333 | is equivalent to assembling | |
4334 | ||
4335 | @example | |
4336 | .long 0 | |
4337 | .long 0 | |
4338 | .long 0 | |
4339 | @end example | |
4340 | ||
4341 | @node Sbttl | |
4342 | @section @code{.sbttl "@var{subheading}"} | |
4343 | ||
4344 | @cindex @code{sbttl} directive | |
4345 | @cindex subtitles for listings | |
4346 | @cindex listing control: subtitle | |
4347 | Use @var{subheading} as the title (third line, immediately after the | |
4348 | title line) when generating assembly listings. | |
4349 | ||
4350 | This directive affects subsequent pages, as well as the current page if | |
4351 | it appears within ten lines of the top of a page. | |
4352 | ||
4353 | @ifset COFF | |
4354 | @node Scl | |
4355 | @section @code{.scl @var{class}} | |
4356 | ||
4357 | @cindex @code{scl} directive | |
4358 | @cindex symbol storage class (COFF) | |
4359 | @cindex COFF symbol storage class | |
4360 | Set the storage-class value for a symbol. This directive may only be | |
4361 | used inside a @code{.def}/@code{.endef} pair. Storage class may flag | |
4362 | whether a symbol is static or external, or it may record further | |
4363 | symbolic debugging information. | |
4364 | @ifset BOUT | |
4365 | ||
4366 | The @samp{.scl} directive is primarily associated with COFF output; when | |
4367 | configured to generate @code{b.out} output format, @code{@value{AS}} | |
4368 | accepts this directive but ignores it. | |
4369 | @end ifset | |
4370 | @end ifset | |
4371 | ||
4372 | @node Section | |
4373 | @section @code{.section @var{name}} | |
4374 | ||
4375 | @cindex @code{section} directive | |
4376 | @cindex named section | |
4377 | Use the @code{.section} directive to assemble the following code into a section | |
4378 | named @var{name}. | |
4379 | ||
4380 | This directive is only supported for targets that actually support arbitrarily | |
4381 | named sections; on @code{a.out} targets, for example, it is not accepted, even | |
4382 | with a standard @code{a.out} section name. | |
4383 | ||
4384 | @ifset COFF | |
4385 | For COFF targets, the @code{.section} directive is used in one of the following | |
4386 | ways: | |
4387 | @smallexample | |
4388 | .section @var{name}[, "@var{flags}"] | |
4389 | .section @var{name}[, @var{subsegment}] | |
4390 | @end smallexample | |
4391 | ||
4392 | If the optional argument is quoted, it is taken as flags to use for the | |
4393 | section. Each flag is a single character. The following flags are recognized: | |
4394 | @table @code | |
4395 | @item b | |
4396 | bss section (uninitialized data) | |
4397 | @item n | |
4398 | section is not loaded | |
4399 | @item w | |
4400 | writable section | |
4401 | @item d | |
4402 | data section | |
4403 | @item r | |
4404 | read-only section | |
4405 | @item x | |
4406 | executable section | |
2dcc60be ILT |
4407 | @item s |
4408 | shared section (meaningful for PE targets) | |
252b5132 RH |
4409 | @end table |
4410 | ||
4411 | If no flags are specified, the default flags depend upon the section name. If | |
4412 | the section name is not recognized, the default will be for the section to be | |
4413 | loaded and writable. | |
4414 | ||
4415 | If the optional argument to the @code{.section} directive is not quoted, it is | |
4416 | taken as a subsegment number (@pxref{Sub-Sections}). | |
4417 | @end ifset | |
4418 | ||
4419 | @ifset ELF | |
4420 | For ELF targets, the @code{.section} directive is used like this: | |
4421 | @smallexample | |
4422 | .section @var{name}[, "@var{flags}"[, @@@var{type}]] | |
4423 | @end smallexample | |
4424 | The optional @var{flags} argument is a quoted string which may contain any | |
4425 | combintion of the following characters: | |
4426 | @table @code | |
4427 | @item a | |
4428 | section is allocatable | |
4429 | @item w | |
4430 | section is writable | |
4431 | @item x | |
4432 | section is executable | |
4433 | @end table | |
4434 | ||
4435 | The optional @var{type} argument may contain one of the following constants: | |
4436 | @table @code | |
4437 | @item @@progbits | |
4438 | section contains data | |
4439 | @item @@nobits | |
4440 | section does not contain data (i.e., section only occupies space) | |
4441 | @end table | |
4442 | ||
4443 | If no flags are specified, the default flags depend upon the section name. If | |
4444 | the section name is not recognized, the default will be for the section to have | |
4445 | none of the above flags: it will not be allocated in memory, nor writable, nor | |
4446 | executable. The section will contain data. | |
4447 | ||
4448 | For ELF targets, the assembler supports another type of @code{.section} | |
4449 | directive for compatibility with the Solaris assembler: | |
4450 | @smallexample | |
4451 | .section "@var{name}"[, @var{flags}...] | |
4452 | @end smallexample | |
4453 | Note that the section name is quoted. There may be a sequence of comma | |
4454 | separated flags: | |
4455 | @table @code | |
4456 | @item #alloc | |
4457 | section is allocatable | |
4458 | @item #write | |
4459 | section is writable | |
4460 | @item #execinstr | |
4461 | section is executable | |
4462 | @end table | |
4463 | @end ifset | |
4464 | ||
4465 | @node Set | |
4466 | @section @code{.set @var{symbol}, @var{expression}} | |
4467 | ||
4468 | @cindex @code{set} directive | |
4469 | @cindex symbol value, setting | |
4470 | Set the value of @var{symbol} to @var{expression}. This | |
4471 | changes @var{symbol}'s value and type to conform to | |
4472 | @var{expression}. If @var{symbol} was flagged as external, it remains | |
4473 | flagged (@pxref{Symbol Attributes}). | |
4474 | ||
4475 | You may @code{.set} a symbol many times in the same assembly. | |
4476 | ||
4477 | If you @code{.set} a global symbol, the value stored in the object | |
4478 | file is the last value stored into it. | |
4479 | ||
4480 | @ifset HPPA | |
4481 | The syntax for @code{set} on the HPPA is | |
4482 | @samp{@var{symbol} .set @var{expression}}. | |
4483 | @end ifset | |
4484 | ||
4485 | @node Short | |
4486 | @section @code{.short @var{expressions}} | |
4487 | ||
4488 | @cindex @code{short} directive | |
4489 | @ifset GENERIC | |
4490 | @code{.short} is normally the same as @samp{.word}. | |
4491 | @xref{Word,,@code{.word}}. | |
4492 | ||
4493 | In some configurations, however, @code{.short} and @code{.word} generate | |
4494 | numbers of different lengths; @pxref{Machine Dependencies}. | |
4495 | @end ifset | |
4496 | @ifclear GENERIC | |
4497 | @ifset W16 | |
4498 | @code{.short} is the same as @samp{.word}. @xref{Word,,@code{.word}}. | |
4499 | @end ifset | |
4500 | @ifset W32 | |
4501 | This expects zero or more @var{expressions}, and emits | |
4502 | a 16 bit number for each. | |
4503 | @end ifset | |
4504 | @end ifclear | |
4505 | ||
4506 | @node Single | |
4507 | @section @code{.single @var{flonums}} | |
4508 | ||
4509 | @cindex @code{single} directive | |
4510 | @cindex floating point numbers (single) | |
4511 | This directive assembles zero or more flonums, separated by commas. It | |
4512 | has the same effect as @code{.float}. | |
4513 | @ifset GENERIC | |
4514 | The exact kind of floating point numbers emitted depends on how | |
4515 | @code{@value{AS}} is configured. @xref{Machine Dependencies}. | |
4516 | @end ifset | |
4517 | @ifclear GENERIC | |
4518 | @ifset IEEEFLOAT | |
4519 | On the @value{TARGET} family, @code{.single} emits 32-bit floating point | |
4520 | numbers in @sc{ieee} format. | |
4521 | @end ifset | |
4522 | @end ifclear | |
4523 | ||
4524 | @ifset COFF | |
4525 | @node Size | |
4526 | @section @code{.size} | |
4527 | ||
4528 | @cindex @code{size} directive | |
4529 | This directive is generated by compilers to include auxiliary debugging | |
4530 | information in the symbol table. It is only permitted inside | |
4531 | @code{.def}/@code{.endef} pairs. | |
4532 | @ifset BOUT | |
4533 | ||
4534 | @samp{.size} is only meaningful when generating COFF format output; when | |
4535 | @code{@value{AS}} is generating @code{b.out}, it accepts this directive but | |
4536 | ignores it. | |
4537 | @end ifset | |
4538 | @end ifset | |
4539 | ||
4540 | @node Sleb128 | |
4541 | @section @code{.sleb128 @var{expressions}} | |
4542 | ||
4543 | @cindex @code{sleb128} directive | |
4544 | @var{sleb128} stands for ``signed little endian base 128.'' This is a | |
4545 | compact, variable length representation of numbers used by the DWARF | |
4546 | symbolic debugging format. @xref{Uleb128,@code{.uleb128}}. | |
4547 | ||
4548 | @ifclear no-space-dir | |
4549 | @node Skip | |
4550 | @section @code{.skip @var{size} , @var{fill}} | |
4551 | ||
4552 | @cindex @code{skip} directive | |
4553 | @cindex filling memory | |
4554 | This directive emits @var{size} bytes, each of value @var{fill}. Both | |
4555 | @var{size} and @var{fill} are absolute expressions. If the comma and | |
4556 | @var{fill} are omitted, @var{fill} is assumed to be zero. This is the same as | |
4557 | @samp{.space}. | |
4558 | ||
4559 | @node Space | |
4560 | @section @code{.space @var{size} , @var{fill}} | |
4561 | ||
4562 | @cindex @code{space} directive | |
4563 | @cindex filling memory | |
4564 | This directive emits @var{size} bytes, each of value @var{fill}. Both | |
4565 | @var{size} and @var{fill} are absolute expressions. If the comma | |
4566 | and @var{fill} are omitted, @var{fill} is assumed to be zero. This is the same | |
4567 | as @samp{.skip}. | |
4568 | ||
4569 | @ifset HPPA | |
4570 | @quotation | |
4571 | @emph{Warning:} @code{.space} has a completely different meaning for HPPA | |
4572 | targets; use @code{.block} as a substitute. See @cite{HP9000 Series 800 | |
4573 | Assembly Language Reference Manual} (HP 92432-90001) for the meaning of the | |
4574 | @code{.space} directive. @xref{HPPA Directives,,HPPA Assembler Directives}, | |
4575 | for a summary. | |
4576 | @end quotation | |
4577 | @end ifset | |
4578 | @end ifclear | |
4579 | ||
4580 | @ifset A29K | |
4581 | @ifclear GENERIC | |
4582 | @node Space | |
4583 | @section @code{.space} | |
4584 | @cindex @code{space} directive | |
4585 | @end ifclear | |
4586 | On the AMD 29K, this directive is ignored; it is accepted for | |
4587 | compatibility with other AMD 29K assemblers. | |
4588 | ||
4589 | @quotation | |
4590 | @emph{Warning:} In most versions of the @sc{gnu} assembler, the directive | |
4591 | @code{.space} has the effect of @code{.block} @xref{Machine Dependencies}. | |
4592 | @end quotation | |
4593 | @end ifset | |
4594 | ||
4595 | @ifset have-stabs | |
4596 | @node Stab | |
4597 | @section @code{.stabd, .stabn, .stabs} | |
4598 | ||
4599 | @cindex symbolic debuggers, information for | |
4600 | @cindex @code{stab@var{x}} directives | |
4601 | There are three directives that begin @samp{.stab}. | |
4602 | All emit symbols (@pxref{Symbols}), for use by symbolic debuggers. | |
4603 | The symbols are not entered in the @code{@value{AS}} hash table: they | |
4604 | cannot be referenced elsewhere in the source file. | |
4605 | Up to five fields are required: | |
4606 | ||
4607 | @table @var | |
4608 | @item string | |
4609 | This is the symbol's name. It may contain any character except | |
4610 | @samp{\000}, so is more general than ordinary symbol names. Some | |
4611 | debuggers used to code arbitrarily complex structures into symbol names | |
4612 | using this field. | |
4613 | ||
4614 | @item type | |
4615 | An absolute expression. The symbol's type is set to the low 8 bits of | |
4616 | this expression. Any bit pattern is permitted, but @code{@value{LD}} | |
4617 | and debuggers choke on silly bit patterns. | |
4618 | ||
4619 | @item other | |
4620 | An absolute expression. The symbol's ``other'' attribute is set to the | |
4621 | low 8 bits of this expression. | |
4622 | ||
4623 | @item desc | |
4624 | An absolute expression. The symbol's descriptor is set to the low 16 | |
4625 | bits of this expression. | |
4626 | ||
4627 | @item value | |
4628 | An absolute expression which becomes the symbol's value. | |
4629 | @end table | |
4630 | ||
4631 | If a warning is detected while reading a @code{.stabd}, @code{.stabn}, | |
4632 | or @code{.stabs} statement, the symbol has probably already been created; | |
4633 | you get a half-formed symbol in your object file. This is | |
4634 | compatible with earlier assemblers! | |
4635 | ||
4636 | @table @code | |
4637 | @cindex @code{stabd} directive | |
4638 | @item .stabd @var{type} , @var{other} , @var{desc} | |
4639 | ||
4640 | The ``name'' of the symbol generated is not even an empty string. | |
4641 | It is a null pointer, for compatibility. Older assemblers used a | |
4642 | null pointer so they didn't waste space in object files with empty | |
4643 | strings. | |
4644 | ||
4645 | The symbol's value is set to the location counter, | |
4646 | relocatably. When your program is linked, the value of this symbol | |
4647 | is the address of the location counter when the @code{.stabd} was | |
4648 | assembled. | |
4649 | ||
4650 | @cindex @code{stabn} directive | |
4651 | @item .stabn @var{type} , @var{other} , @var{desc} , @var{value} | |
4652 | The name of the symbol is set to the empty string @code{""}. | |
4653 | ||
4654 | @cindex @code{stabs} directive | |
4655 | @item .stabs @var{string} , @var{type} , @var{other} , @var{desc} , @var{value} | |
4656 | All five fields are specified. | |
4657 | @end table | |
4658 | @end ifset | |
4659 | @c end have-stabs | |
4660 | ||
4661 | @node String | |
4662 | @section @code{.string} "@var{str}" | |
4663 | ||
4664 | @cindex string, copying to object file | |
4665 | @cindex @code{string} directive | |
4666 | ||
4667 | Copy the characters in @var{str} to the object file. You may specify more than | |
4668 | one string to copy, separated by commas. Unless otherwise specified for a | |
4669 | particular machine, the assembler marks the end of each string with a 0 byte. | |
4670 | You can use any of the escape sequences described in @ref{Strings,,Strings}. | |
4671 | ||
4672 | @node Struct | |
4673 | @section @code{.struct @var{expression}} | |
4674 | ||
4675 | @cindex @code{struct} directive | |
4676 | Switch to the absolute section, and set the section offset to @var{expression}, | |
4677 | which must be an absolute expression. You might use this as follows: | |
4678 | @smallexample | |
4679 | .struct 0 | |
4680 | field1: | |
4681 | .struct field1 + 4 | |
4682 | field2: | |
4683 | .struct field2 + 4 | |
4684 | field3: | |
4685 | @end smallexample | |
4686 | This would define the symbol @code{field1} to have the value 0, the symbol | |
4687 | @code{field2} to have the value 4, and the symbol @code{field3} to have the | |
4688 | value 8. Assembly would be left in the absolute section, and you would need to | |
4689 | use a @code{.section} directive of some sort to change to some other section | |
4690 | before further assembly. | |
4691 | ||
4692 | @ifset ELF | |
4693 | @node Symver | |
4694 | @section @code{.symver} | |
4695 | @cindex @code{symver} directive | |
4696 | @cindex symbol versioning | |
4697 | @cindex versions of symbols | |
4698 | Use the @code{.symver} directive to bind symbols to specific version nodes | |
4699 | within a source file. This is only supported on ELF platforms, and is | |
4700 | typically used when assembling files to be linked into a shared library. | |
4701 | There are cases where it may make sense to use this in objects to be bound | |
4702 | into an application itself so as to override a versioned symbol from a | |
4703 | shared library. | |
4704 | ||
4705 | For ELF targets, the @code{.symver} directive is used like this: | |
4706 | @smallexample | |
4707 | .symver @var{name}, @var{name2@@nodename} | |
4708 | @end smallexample | |
4709 | In this case, the symbol @var{name} must exist and be defined within the file | |
4710 | being assembled. The @code{.versym} directive effectively creates a symbol | |
4711 | alias with the name @var{name2@@nodename}, and in fact the main reason that we | |
4712 | just don't try and create a regular alias is that the @var{@@} character isn't | |
4713 | permitted in symbol names. The @var{name2} part of the name is the actual name | |
4714 | of the symbol by which it will be externally referenced. The name @var{name} | |
4715 | itself is merely a name of convenience that is used so that it is possible to | |
4716 | have definitions for multiple versions of a function within a single source | |
4717 | file, and so that the compiler can unambiguously know which version of a | |
4718 | function is being mentioned. The @var{nodename} portion of the alias should be | |
4719 | the name of a node specified in the version script supplied to the linker when | |
4720 | building a shared library. If you are attempting to override a versioned | |
4721 | symbol from a shared library, then @var{nodename} should correspond to the | |
4722 | nodename of the symbol you are trying to override. | |
4723 | @end ifset | |
4724 | ||
4725 | @ifset COFF | |
4726 | @node Tag | |
4727 | @section @code{.tag @var{structname}} | |
4728 | ||
4729 | @cindex COFF structure debugging | |
4730 | @cindex structure debugging, COFF | |
4731 | @cindex @code{tag} directive | |
4732 | This directive is generated by compilers to include auxiliary debugging | |
4733 | information in the symbol table. It is only permitted inside | |
4734 | @code{.def}/@code{.endef} pairs. Tags are used to link structure | |
4735 | definitions in the symbol table with instances of those structures. | |
4736 | @ifset BOUT | |
4737 | ||
4738 | @samp{.tag} is only used when generating COFF format output; when | |
4739 | @code{@value{AS}} is generating @code{b.out}, it accepts this directive but | |
4740 | ignores it. | |
4741 | @end ifset | |
4742 | @end ifset | |
4743 | ||
4744 | @node Text | |
4745 | @section @code{.text @var{subsection}} | |
4746 | ||
4747 | @cindex @code{text} directive | |
4748 | Tells @code{@value{AS}} to assemble the following statements onto the end of | |
4749 | the text subsection numbered @var{subsection}, which is an absolute | |
4750 | expression. If @var{subsection} is omitted, subsection number zero | |
4751 | is used. | |
4752 | ||
4753 | @node Title | |
4754 | @section @code{.title "@var{heading}"} | |
4755 | ||
4756 | @cindex @code{title} directive | |
4757 | @cindex listing control: title line | |
4758 | Use @var{heading} as the title (second line, immediately after the | |
4759 | source file name and pagenumber) when generating assembly listings. | |
4760 | ||
4761 | This directive affects subsequent pages, as well as the current page if | |
4762 | it appears within ten lines of the top of a page. | |
4763 | ||
4764 | @ifset COFF | |
4765 | @node Type | |
4766 | @section @code{.type @var{int}} | |
4767 | ||
4768 | @cindex COFF symbol type | |
4769 | @cindex symbol type, COFF | |
4770 | @cindex @code{type} directive | |
4771 | This directive, permitted only within @code{.def}/@code{.endef} pairs, | |
4772 | records the integer @var{int} as the type attribute of a symbol table entry. | |
4773 | @ifset BOUT | |
4774 | ||
4775 | @samp{.type} is associated only with COFF format output; when | |
4776 | @code{@value{AS}} is configured for @code{b.out} output, it accepts this | |
4777 | directive but ignores it. | |
4778 | @end ifset | |
4779 | @end ifset | |
4780 | ||
4781 | @ifset COFF | |
4782 | @node Val | |
4783 | @section @code{.val @var{addr}} | |
4784 | ||
4785 | @cindex @code{val} directive | |
4786 | @cindex COFF value attribute | |
4787 | @cindex value attribute, COFF | |
4788 | This directive, permitted only within @code{.def}/@code{.endef} pairs, | |
4789 | records the address @var{addr} as the value attribute of a symbol table | |
4790 | entry. | |
4791 | @ifset BOUT | |
4792 | ||
4793 | @samp{.val} is used only for COFF output; when @code{@value{AS}} is | |
4794 | configured for @code{b.out}, it accepts this directive but ignores it. | |
4795 | @end ifset | |
4796 | @end ifset | |
4797 | ||
4798 | @node Uleb128 | |
4799 | @section @code{.uleb128 @var{expressions}} | |
4800 | ||
4801 | @cindex @code{uleb128} directive | |
4802 | @var{uleb128} stands for ``unsigned little endian base 128.'' This is a | |
4803 | compact, variable length representation of numbers used by the DWARF | |
4804 | symbolic debugging format. @xref{Sleb128,@code{.sleb128}}. | |
4805 | ||
2e13b764 NC |
4806 | @ifset ELF |
4807 | @node Visibility | |
4808 | @section @code{.internal}, @code{.hidden}, @code{.protected} | |
4809 | @cindex @code{internal} directive | |
4810 | @cindex @code{hidden} directive | |
4811 | @cindex @code{protected} directive | |
4812 | @cindex symbol visibility | |
4813 | ||
4814 | These directives can be used to set the visibility of a specified symbol. By | |
4815 | default a symbol's visibility is set by its binding (local, global or weak), | |
4816 | but these directives can be used to override that. | |
4817 | ||
4818 | A visibility of @code{protected} means that any references to the symbol from | |
4819 | within the component that defines the symbol must be resolved to the definition | |
4820 | in that component, even if a definition in another component would normally | |
4821 | preempt this. | |
4822 | ||
4823 | A visibility of @code{hidden} means that the symbol is not visible to other | |
4824 | components. Such a symbol is always considered to be protected as well. | |
4825 | ||
4826 | A visibility of @code{internal} is the same as a visibility of @code{hidden}, | |
4827 | except that some extra, processor specific processing must also be performed | |
4828 | upon the symbol. | |
4829 | ||
4830 | For ELF targets, the directives are used like this: | |
4831 | ||
4832 | @smallexample | |
4833 | .internal @var{name} | |
4834 | .hidden @var{name} | |
4835 | .protected @var{name} | |
4836 | @end smallexample | |
4837 | ||
4838 | @end ifset | |
4839 | ||
252b5132 RH |
4840 | @node Word |
4841 | @section @code{.word @var{expressions}} | |
4842 | ||
4843 | @cindex @code{word} directive | |
4844 | This directive expects zero or more @var{expressions}, of any section, | |
4845 | separated by commas. | |
4846 | @ifclear GENERIC | |
4847 | @ifset W32 | |
4848 | For each expression, @code{@value{AS}} emits a 32-bit number. | |
4849 | @end ifset | |
4850 | @ifset W16 | |
4851 | For each expression, @code{@value{AS}} emits a 16-bit number. | |
4852 | @end ifset | |
4853 | @end ifclear | |
4854 | @ifset GENERIC | |
4855 | ||
4856 | The size of the number emitted, and its byte order, | |
4857 | depend on what target computer the assembly is for. | |
4858 | @end ifset | |
4859 | ||
4860 | @c on amd29k, i960, sparc the "special treatment to support compilers" doesn't | |
4861 | @c happen---32-bit addressability, period; no long/short jumps. | |
4862 | @ifset DIFF-TBL-KLUGE | |
4863 | @cindex difference tables altered | |
4864 | @cindex altered difference tables | |
4865 | @quotation | |
4866 | @emph{Warning: Special Treatment to support Compilers} | |
4867 | @end quotation | |
4868 | ||
4869 | @ifset GENERIC | |
4870 | Machines with a 32-bit address space, but that do less than 32-bit | |
4871 | addressing, require the following special treatment. If the machine of | |
4872 | interest to you does 32-bit addressing (or doesn't require it; | |
4873 | @pxref{Machine Dependencies}), you can ignore this issue. | |
4874 | ||
4875 | @end ifset | |
4876 | In order to assemble compiler output into something that works, | |
4877 | @code{@value{AS}} occasionlly does strange things to @samp{.word} directives. | |
4878 | Directives of the form @samp{.word sym1-sym2} are often emitted by | |
4879 | compilers as part of jump tables. Therefore, when @code{@value{AS}} assembles a | |
4880 | directive of the form @samp{.word sym1-sym2}, and the difference between | |
4881 | @code{sym1} and @code{sym2} does not fit in 16 bits, @code{@value{AS}} | |
4882 | creates a @dfn{secondary jump table}, immediately before the next label. | |
4883 | This secondary jump table is preceded by a short-jump to the | |
4884 | first byte after the secondary table. This short-jump prevents the flow | |
4885 | of control from accidentally falling into the new table. Inside the | |
4886 | table is a long-jump to @code{sym2}. The original @samp{.word} | |
4887 | contains @code{sym1} minus the address of the long-jump to | |
4888 | @code{sym2}. | |
4889 | ||
4890 | If there were several occurrences of @samp{.word sym1-sym2} before the | |
4891 | secondary jump table, all of them are adjusted. If there was a | |
4892 | @samp{.word sym3-sym4}, that also did not fit in sixteen bits, a | |
4893 | long-jump to @code{sym4} is included in the secondary jump table, | |
4894 | and the @code{.word} directives are adjusted to contain @code{sym3} | |
4895 | minus the address of the long-jump to @code{sym4}; and so on, for as many | |
4896 | entries in the original jump table as necessary. | |
4897 | ||
4898 | @ifset INTERNALS | |
4899 | @emph{This feature may be disabled by compiling @code{@value{AS}} with the | |
4900 | @samp{-DWORKING_DOT_WORD} option.} This feature is likely to confuse | |
4901 | assembly language programmers. | |
4902 | @end ifset | |
4903 | @end ifset | |
4904 | @c end DIFF-TBL-KLUGE | |
4905 | ||
4906 | @node Deprecated | |
4907 | @section Deprecated Directives | |
4908 | ||
4909 | @cindex deprecated directives | |
4910 | @cindex obsolescent directives | |
4911 | One day these directives won't work. | |
4912 | They are included for compatibility with older assemblers. | |
4913 | @table @t | |
4914 | @item .abort | |
4915 | @item .line | |
4916 | @end table | |
4917 | ||
4918 | @ifset GENERIC | |
4919 | @node Machine Dependencies | |
4920 | @chapter Machine Dependent Features | |
4921 | ||
4922 | @cindex machine dependencies | |
4923 | The machine instruction sets are (almost by definition) different on | |
4924 | each machine where @code{@value{AS}} runs. Floating point representations | |
4925 | vary as well, and @code{@value{AS}} often supports a few additional | |
4926 | directives or command-line options for compatibility with other | |
4927 | assemblers on a particular platform. Finally, some versions of | |
4928 | @code{@value{AS}} support special pseudo-instructions for branch | |
4929 | optimization. | |
4930 | ||
4931 | This chapter discusses most of these differences, though it does not | |
4932 | include details on any machine's instruction set. For details on that | |
4933 | subject, see the hardware manufacturer's manual. | |
4934 | ||
4935 | @menu | |
4936 | @ifset A29K | |
4937 | * AMD29K-Dependent:: AMD 29K Dependent Features | |
4938 | @end ifset | |
4939 | @ifset ARC | |
4940 | * ARC-Dependent:: ARC Dependent Features | |
4941 | @end ifset | |
4942 | @ifset ARM | |
4943 | * ARM-Dependent:: ARM Dependent Features | |
4944 | @end ifset | |
4945 | @ifset D10V | |
4946 | * D10V-Dependent:: D10V Dependent Features | |
4947 | @end ifset | |
4948 | @ifset D30V | |
4949 | * D30V-Dependent:: D30V Dependent Features | |
4950 | @end ifset | |
4951 | @ifset H8/300 | |
4952 | * H8/300-Dependent:: Hitachi H8/300 Dependent Features | |
4953 | @end ifset | |
4954 | @ifset H8/500 | |
4955 | * H8/500-Dependent:: Hitachi H8/500 Dependent Features | |
4956 | @end ifset | |
4957 | @ifset HPPA | |
4958 | * HPPA-Dependent:: HPPA Dependent Features | |
4959 | @end ifset | |
5b93d8bb AM |
4960 | @ifset I370 |
4961 | * ESA/390-Dependent:: IBM ESA/390 Dependent Features | |
4962 | @end ifset | |
252b5132 RH |
4963 | @ifset I80386 |
4964 | * i386-Dependent:: Intel 80386 Dependent Features | |
4965 | @end ifset | |
4966 | @ifset I960 | |
4967 | * i960-Dependent:: Intel 80960 Dependent Features | |
4968 | @end ifset | |
ec694b89 NC |
4969 | @ifset M32R |
4970 | * M32R-Dependent:: M32R Dependent Features | |
4971 | @end ifset | |
252b5132 RH |
4972 | @ifset M680X0 |
4973 | * M68K-Dependent:: M680x0 Dependent Features | |
4974 | @end ifset | |
4975 | @ifset MIPS | |
4976 | * MIPS-Dependent:: MIPS Dependent Features | |
4977 | @end ifset | |
4978 | @ifset SH | |
4979 | * SH-Dependent:: Hitachi SH Dependent Features | |
4980 | @end ifset | |
041dd5a9 ILT |
4981 | @ifset PJ |
4982 | * PJ-Dependent:: picoJava Dependent Features | |
4983 | @end ifset | |
252b5132 RH |
4984 | @ifset SPARC |
4985 | * Sparc-Dependent:: SPARC Dependent Features | |
4986 | @end ifset | |
4987 | @ifset V850 | |
4988 | * V850-Dependent:: V850 Dependent Features | |
4989 | @end ifset | |
4990 | @ifset Z8000 | |
4991 | * Z8000-Dependent:: Z8000 Dependent Features | |
4992 | @end ifset | |
4993 | @ifset VAX | |
4994 | * Vax-Dependent:: VAX Dependent Features | |
4995 | @end ifset | |
4996 | @end menu | |
4997 | ||
4998 | @lowersections | |
4999 | @end ifset | |
5000 | ||
5001 | @c The following major nodes are *sections* in the GENERIC version, *chapters* | |
5002 | @c in single-cpu versions. This is mainly achieved by @lowersections. There is a | |
5003 | @c peculiarity: to preserve cross-references, there must be a node called | |
5004 | @c "Machine Dependencies". Hence the conditional nodenames in each | |
5005 | @c major node below. Node defaulting in makeinfo requires adjacency of | |
5006 | @c node and sectioning commands; hence the repetition of @chapter BLAH | |
5007 | @c in both conditional blocks. | |
5008 | ||
5009 | @ifset ARC | |
5010 | @ifset GENERIC | |
5011 | @page | |
5012 | @node ARC-Dependent | |
5013 | @chapter ARC Dependent Features | |
5014 | @end ifset | |
5015 | @ifclear GENERIC | |
5016 | @node Machine Dependencies | |
5017 | @chapter ARC Dependent Features | |
5018 | @end ifclear | |
5019 | ||
5020 | @cindex ARC support | |
5021 | @menu | |
5022 | * ARC-Opts:: Options | |
5023 | * ARC-Float:: Floating Point | |
5024 | * ARC-Directives:: Sparc Machine Directives | |
5025 | @end menu | |
5026 | ||
5027 | @node ARC-Opts | |
5028 | @section Options | |
5029 | ||
5030 | @cindex options for ARC | |
5031 | @cindex ARC options | |
5032 | @cindex architectures, ARC | |
5033 | @cindex ARC architectures | |
5034 | The ARC chip family includes several successive levels (or other | |
5035 | variants) of chip, using the same core instruction set, but including | |
5036 | a few additional instructions at each level. | |
5037 | ||
5038 | By default, @code{@value{AS}} assumes the core instruction set (ARC | |
5039 | base). The @code{.cpu} pseudo-op is intended to be used to select | |
5040 | the variant. | |
5041 | ||
5042 | @table @code | |
5043 | @cindex @code{-mbig-endian} option (ARC) | |
5044 | @cindex @code{-mlittle-endian} option (ARC) | |
5045 | @cindex ARC big-endian output | |
5046 | @cindex ARC little-endian output | |
5047 | @cindex big-endian output, ARC | |
5048 | @cindex little-endian output, ARC | |
5049 | @item -mbig-endian | |
5050 | @itemx -mlittle-endian | |
5051 | Any @sc{arc} configuration of @code{@value{AS}} can select big-endian or | |
5052 | little-endian output at run time (unlike most other @sc{gnu} development | |
5053 | tools, which must be configured for one or the other). Use | |
5054 | @samp{-mbig-endian} to select big-endian output, and @samp{-mlittle-endian} | |
5055 | for little-endian. | |
5056 | @end table | |
5057 | ||
5058 | @node ARC-Float | |
5059 | @section Floating Point | |
5060 | ||
5061 | @cindex floating point, ARC (@sc{ieee}) | |
5062 | @cindex ARC floating point (@sc{ieee}) | |
5063 | The ARC cpu family currently does not have hardware floating point | |
5064 | support. Software floating point support is provided by @code{GCC} | |
5065 | and uses @sc{ieee} floating-point numbers. | |
5066 | ||
5067 | @node ARC-Directives | |
5068 | @section ARC Machine Directives | |
5069 | ||
5070 | @cindex ARC machine directives | |
5071 | @cindex machine directives, ARC | |
5072 | The ARC version of @code{@value{AS}} supports the following additional | |
5073 | machine directives: | |
5074 | ||
5075 | @table @code | |
5076 | @item .cpu | |
5077 | @cindex @code{cpu} directive, SPARC | |
5078 | This must be followed by the desired cpu. | |
5079 | The ARC is intended to be customizable, @code{.cpu} is used to | |
5080 | select the desired variant [though currently there are none]. | |
5081 | ||
5082 | @end table | |
5083 | ||
5084 | @end ifset | |
5085 | ||
5086 | @ifset A29K | |
5087 | @include c-a29k.texi | |
5088 | @end ifset | |
5089 | ||
5090 | @ifset ARM | |
5091 | @include c-arm.texi | |
5092 | @end ifset | |
5093 | ||
5094 | @ifset Hitachi-all | |
5095 | @ifclear GENERIC | |
5096 | @node Machine Dependencies | |
5097 | @chapter Machine Dependent Features | |
5098 | ||
5099 | The machine instruction sets are different on each Hitachi chip family, | |
5100 | and there are also some syntax differences among the families. This | |
5101 | chapter describes the specific @code{@value{AS}} features for each | |
5102 | family. | |
5103 | ||
5104 | @menu | |
5105 | * H8/300-Dependent:: Hitachi H8/300 Dependent Features | |
5106 | * H8/500-Dependent:: Hitachi H8/500 Dependent Features | |
5107 | * SH-Dependent:: Hitachi SH Dependent Features | |
5108 | @end menu | |
5109 | @lowersections | |
5110 | @end ifclear | |
5111 | @end ifset | |
5112 | ||
5113 | @ifset D10V | |
5114 | @include c-d10v.texi | |
5115 | @end ifset | |
5116 | ||
5117 | @ifset D30V | |
5118 | @include c-d30v.texi | |
5119 | @end ifset | |
5120 | ||
5121 | @ifset H8/300 | |
5122 | @include c-h8300.texi | |
5123 | @end ifset | |
5124 | ||
5125 | @ifset H8/500 | |
5126 | @include c-h8500.texi | |
5127 | @end ifset | |
5128 | ||
5129 | @ifset HPPA | |
5130 | @include c-hppa.texi | |
5131 | @end ifset | |
5132 | ||
5b93d8bb AM |
5133 | @ifset I370 |
5134 | @include c-i370.texi | |
5135 | @end ifset | |
5136 | ||
252b5132 RH |
5137 | @ifset I80386 |
5138 | @include c-i386.texi | |
5139 | @end ifset | |
5140 | ||
5141 | @ifset I960 | |
5142 | @include c-i960.texi | |
5143 | @end ifset | |
5144 | ||
ec694b89 NC |
5145 | @ifset M32R |
5146 | @include c-m32r.texi | |
5147 | @end ifset | |
252b5132 RH |
5148 | |
5149 | @ifset M680X0 | |
5150 | @include c-m68k.texi | |
5151 | @end ifset | |
5152 | ||
5153 | @ifset MIPS | |
5154 | @include c-mips.texi | |
5155 | @end ifset | |
5156 | ||
5157 | @ifset NS32K | |
5158 | @include c-ns32k.texi | |
5159 | @end ifset | |
5160 | ||
041dd5a9 ILT |
5161 | @ifset PJ |
5162 | @include c-pj.texi | |
5163 | @end ifset | |
5164 | ||
252b5132 RH |
5165 | @ifset SH |
5166 | @include c-sh.texi | |
5167 | @end ifset | |
5168 | ||
5169 | @ifset SPARC | |
5170 | @include c-sparc.texi | |
5171 | @end ifset | |
5172 | ||
5173 | @ifset Z8000 | |
5174 | @include c-z8k.texi | |
5175 | @end ifset | |
5176 | ||
5177 | @ifset VAX | |
5178 | @include c-vax.texi | |
5179 | @end ifset | |
5180 | ||
5181 | @ifset V850 | |
5182 | @include c-v850.texi | |
5183 | @end ifset | |
5184 | ||
5185 | @ifset GENERIC | |
5186 | @c reverse effect of @down at top of generic Machine-Dep chapter | |
5187 | @raisesections | |
5188 | @end ifset | |
5189 | ||
5190 | @node Reporting Bugs | |
5191 | @chapter Reporting Bugs | |
5192 | @cindex bugs in assembler | |
5193 | @cindex reporting bugs in assembler | |
5194 | ||
5195 | Your bug reports play an essential role in making @code{@value{AS}} reliable. | |
5196 | ||
5197 | Reporting a bug may help you by bringing a solution to your problem, or it may | |
5198 | not. But in any case the principal function of a bug report is to help the | |
5199 | entire community by making the next version of @code{@value{AS}} work better. | |
5200 | Bug reports are your contribution to the maintenance of @code{@value{AS}}. | |
5201 | ||
5202 | In order for a bug report to serve its purpose, you must include the | |
5203 | information that enables us to fix the bug. | |
5204 | ||
5205 | @menu | |
5206 | * Bug Criteria:: Have you found a bug? | |
5207 | * Bug Reporting:: How to report bugs | |
5208 | @end menu | |
5209 | ||
5210 | @node Bug Criteria | |
5211 | @section Have you found a bug? | |
5212 | @cindex bug criteria | |
5213 | ||
5214 | If you are not sure whether you have found a bug, here are some guidelines: | |
5215 | ||
5216 | @itemize @bullet | |
5217 | @cindex fatal signal | |
5218 | @cindex assembler crash | |
5219 | @cindex crash of assembler | |
5220 | @item | |
5221 | If the assembler gets a fatal signal, for any input whatever, that is a | |
5222 | @code{@value{AS}} bug. Reliable assemblers never crash. | |
5223 | ||
5224 | @cindex error on valid input | |
5225 | @item | |
5226 | If @code{@value{AS}} produces an error message for valid input, that is a bug. | |
5227 | ||
5228 | @cindex invalid input | |
5229 | @item | |
5230 | If @code{@value{AS}} does not produce an error message for invalid input, that | |
5231 | is a bug. However, you should note that your idea of ``invalid input'' might | |
5232 | be our idea of ``an extension'' or ``support for traditional practice''. | |
5233 | ||
5234 | @item | |
5235 | If you are an experienced user of assemblers, your suggestions for improvement | |
5236 | of @code{@value{AS}} are welcome in any case. | |
5237 | @end itemize | |
5238 | ||
5239 | @node Bug Reporting | |
5240 | @section How to report bugs | |
5241 | @cindex bug reports | |
5242 | @cindex assembler bugs, reporting | |
5243 | ||
5244 | A number of companies and individuals offer support for @sc{gnu} products. If | |
5245 | you obtained @code{@value{AS}} from a support organization, we recommend you | |
5246 | contact that organization first. | |
5247 | ||
5248 | You can find contact information for many support companies and | |
5249 | individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs | |
5250 | distribution. | |
5251 | ||
5252 | In any event, we also recommend that you send bug reports for @code{@value{AS}} | |
5253 | to @samp{bug-gnu-utils@@gnu.org}. | |
5254 | ||
5255 | The fundamental principle of reporting bugs usefully is this: | |
5256 | @strong{report all the facts}. If you are not sure whether to state a | |
5257 | fact or leave it out, state it! | |
5258 | ||
5259 | Often people omit facts because they think they know what causes the problem | |
5260 | and assume that some details do not matter. Thus, you might assume that the | |
5261 | name of a symbol you use in an example does not matter. Well, probably it does | |
5262 | not, but one cannot be sure. Perhaps the bug is a stray memory reference which | |
5263 | happens to fetch from the location where that name is stored in memory; | |
5264 | perhaps, if the name were different, the contents of that location would fool | |
5265 | the assembler into doing the right thing despite the bug. Play it safe and | |
5266 | give a specific, complete example. That is the easiest thing for you to do, | |
5267 | and the most helpful. | |
5268 | ||
5269 | Keep in mind that the purpose of a bug report is to enable us to fix the bug if | |
5270 | it is new to us. Therefore, always write your bug reports on the assumption | |
5271 | that the bug has not been reported previously. | |
5272 | ||
5273 | Sometimes people give a few sketchy facts and ask, ``Does this ring a | |
5274 | bell?'' Those bug reports are useless, and we urge everyone to | |
5275 | @emph{refuse to respond to them} except to chide the sender to report | |
5276 | bugs properly. | |
5277 | ||
5278 | To enable us to fix the bug, you should include all these things: | |
5279 | ||
5280 | @itemize @bullet | |
5281 | @item | |
5282 | The version of @code{@value{AS}}. @code{@value{AS}} announces it if you start | |
5283 | it with the @samp{--version} argument. | |
5284 | ||
5285 | Without this, we will not know whether there is any point in looking for | |
5286 | the bug in the current version of @code{@value{AS}}. | |
5287 | ||
5288 | @item | |
5289 | Any patches you may have applied to the @code{@value{AS}} source. | |
5290 | ||
5291 | @item | |
5292 | The type of machine you are using, and the operating system name and | |
5293 | version number. | |
5294 | ||
5295 | @item | |
5296 | What compiler (and its version) was used to compile @code{@value{AS}}---e.g. | |
5297 | ``@code{gcc-2.7}''. | |
5298 | ||
5299 | @item | |
5300 | The command arguments you gave the assembler to assemble your example and | |
5301 | observe the bug. To guarantee you will not omit something important, list them | |
5302 | all. A copy of the Makefile (or the output from make) is sufficient. | |
5303 | ||
5304 | If we were to try to guess the arguments, we would probably guess wrong | |
5305 | and then we might not encounter the bug. | |
5306 | ||
5307 | @item | |
5308 | A complete input file that will reproduce the bug. If the bug is observed when | |
5309 | the assembler is invoked via a compiler, send the assembler source, not the | |
5310 | high level language source. Most compilers will produce the assembler source | |
5311 | when run with the @samp{-S} option. If you are using @code{@value{GCC}}, use | |
5312 | the options @samp{-v --save-temps}; this will save the assembler source in a | |
5313 | file with an extension of @file{.s}, and also show you exactly how | |
5314 | @code{@value{AS}} is being run. | |
5315 | ||
5316 | @item | |
5317 | A description of what behavior you observe that you believe is | |
5318 | incorrect. For example, ``It gets a fatal signal.'' | |
5319 | ||
5320 | Of course, if the bug is that @code{@value{AS}} gets a fatal signal, then we | |
5321 | will certainly notice it. But if the bug is incorrect output, we might not | |
5322 | notice unless it is glaringly wrong. You might as well not give us a chance to | |
5323 | make a mistake. | |
5324 | ||
5325 | Even if the problem you experience is a fatal signal, you should still say so | |
5326 | explicitly. Suppose something strange is going on, such as, your copy of | |
5327 | @code{@value{AS}} is out of synch, or you have encountered a bug in the C | |
5328 | library on your system. (This has happened!) Your copy might crash and ours | |
5329 | would not. If you told us to expect a crash, then when ours fails to crash, we | |
5330 | would know that the bug was not happening for us. If you had not told us to | |
5331 | expect a crash, then we would not be able to draw any conclusion from our | |
5332 | observations. | |
5333 | ||
5334 | @item | |
5335 | If you wish to suggest changes to the @code{@value{AS}} source, send us context | |
5336 | diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p} | |
5337 | option. Always send diffs from the old file to the new file. If you even | |
5338 | discuss something in the @code{@value{AS}} source, refer to it by context, not | |
5339 | by line number. | |
5340 | ||
5341 | The line numbers in our development sources will not match those in your | |
5342 | sources. Your line numbers would convey no useful information to us. | |
5343 | @end itemize | |
5344 | ||
5345 | Here are some things that are not necessary: | |
5346 | ||
5347 | @itemize @bullet | |
5348 | @item | |
5349 | A description of the envelope of the bug. | |
5350 | ||
5351 | Often people who encounter a bug spend a lot of time investigating | |
5352 | which changes to the input file will make the bug go away and which | |
5353 | changes will not affect it. | |
5354 | ||
5355 | This is often time consuming and not very useful, because the way we | |
5356 | will find the bug is by running a single example under the debugger | |
5357 | with breakpoints, not by pure deduction from a series of examples. | |
5358 | We recommend that you save your time for something else. | |
5359 | ||
5360 | Of course, if you can find a simpler example to report @emph{instead} | |
5361 | of the original one, that is a convenience for us. Errors in the | |
5362 | output will be easier to spot, running under the debugger will take | |
5363 | less time, and so on. | |
5364 | ||
5365 | However, simplification is not vital; if you do not want to do this, | |
5366 | report the bug anyway and send us the entire test case you used. | |
5367 | ||
5368 | @item | |
5369 | A patch for the bug. | |
5370 | ||
5371 | A patch for the bug does help us if it is a good one. But do not omit | |
5372 | the necessary information, such as the test case, on the assumption that | |
5373 | a patch is all we need. We might see problems with your patch and decide | |
5374 | to fix the problem another way, or we might not understand it at all. | |
5375 | ||
5376 | Sometimes with a program as complicated as @code{@value{AS}} it is very hard to | |
5377 | construct an example that will make the program follow a certain path through | |
5378 | the code. If you do not send us the example, we will not be able to construct | |
5379 | one, so we will not be able to verify that the bug is fixed. | |
5380 | ||
5381 | And if we cannot understand what bug you are trying to fix, or why your | |
5382 | patch should be an improvement, we will not install it. A test case will | |
5383 | help us to understand. | |
5384 | ||
5385 | @item | |
5386 | A guess about what the bug is or what it depends on. | |
5387 | ||
5388 | Such guesses are usually wrong. Even we cannot guess right about such | |
5389 | things without first using the debugger to find the facts. | |
5390 | @end itemize | |
5391 | ||
5392 | @node Acknowledgements | |
5393 | @chapter Acknowledgements | |
5394 | ||
5395 | If you have contributed to @code{@value{AS}} and your name isn't listed here, | |
5396 | it is not meant as a slight. We just don't know about it. Send mail to the | |
5397 | maintainer, and we'll correct the situation. Currently | |
5398 | @c (January 1994), | |
5399 | the maintainer is Ken Raeburn (email address @code{raeburn@@cygnus.com}). | |
5400 | ||
5401 | Dean Elsner wrote the original @sc{gnu} assembler for the VAX.@footnote{Any | |
5402 | more details?} | |
5403 | ||
5404 | Jay Fenlason maintained GAS for a while, adding support for GDB-specific debug | |
5405 | information and the 68k series machines, most of the preprocessing pass, and | |
5406 | extensive changes in @file{messages.c}, @file{input-file.c}, @file{write.c}. | |
5407 | ||
5408 | K. Richard Pixley maintained GAS for a while, adding various enhancements and | |
5409 | many bug fixes, including merging support for several processors, breaking GAS | |
5410 | up to handle multiple object file format back ends (including heavy rewrite, | |
5411 | testing, an integration of the coff and b.out back ends), adding configuration | |
5412 | including heavy testing and verification of cross assemblers and file splits | |
5413 | and renaming, converted GAS to strictly ANSI C including full prototypes, added | |
5414 | support for m680[34]0 and cpu32, did considerable work on i960 including a COFF | |
5415 | port (including considerable amounts of reverse engineering), a SPARC opcode | |
5416 | file rewrite, DECstation, rs6000, and hp300hpux host ports, updated ``know'' | |
5417 | assertions and made them work, much other reorganization, cleanup, and lint. | |
5418 | ||
5419 | Ken Raeburn wrote the high-level BFD interface code to replace most of the code | |
5420 | in format-specific I/O modules. | |
5421 | ||
5422 | The original VMS support was contributed by David L. Kashtan. Eric Youngdale | |
5423 | has done much work with it since. | |
5424 | ||
5425 | The Intel 80386 machine description was written by Eliot Dresselhaus. | |
5426 | ||
5427 | Minh Tran-Le at IntelliCorp contributed some AIX 386 support. | |
5428 | ||
5429 | The Motorola 88k machine description was contributed by Devon Bowen of Buffalo | |
5430 | University and Torbjorn Granlund of the Swedish Institute of Computer Science. | |
5431 | ||
5432 | Keith Knowles at the Open Software Foundation wrote the original MIPS back end | |
5433 | (@file{tc-mips.c}, @file{tc-mips.h}), and contributed Rose format support | |
5434 | (which hasn't been merged in yet). Ralph Campbell worked with the MIPS code to | |
5435 | support a.out format. | |
5436 | ||
5437 | Support for the Zilog Z8k and Hitachi H8/300 and H8/500 processors (tc-z8k, | |
5438 | tc-h8300, tc-h8500), and IEEE 695 object file format (obj-ieee), was written by | |
5439 | Steve Chamberlain of Cygnus Support. Steve also modified the COFF back end to | |
5440 | use BFD for some low-level operations, for use with the H8/300 and AMD 29k | |
5441 | targets. | |
5442 | ||
5443 | John Gilmore built the AMD 29000 support, added @code{.include} support, and | |
5444 | simplified the configuration of which versions accept which directives. He | |
5445 | updated the 68k machine description so that Motorola's opcodes always produced | |
5446 | fixed-size instructions (e.g. @code{jsr}), while synthetic instructions | |
5447 | remained shrinkable (@code{jbsr}). John fixed many bugs, including true tested | |
5448 | cross-compilation support, and one bug in relaxation that took a week and | |
5449 | required the proverbial one-bit fix. | |
5450 | ||
5451 | Ian Lance Taylor of Cygnus Support merged the Motorola and MIT syntax for the | |
5452 | 68k, completed support for some COFF targets (68k, i386 SVR3, and SCO Unix), | |
5453 | added support for MIPS ECOFF and ELF targets, wrote the initial RS/6000 and | |
5454 | PowerPC assembler, and made a few other minor patches. | |
5455 | ||
5456 | Steve Chamberlain made @code{@value{AS}} able to generate listings. | |
5457 | ||
5458 | Hewlett-Packard contributed support for the HP9000/300. | |
5459 | ||
5460 | Jeff Law wrote GAS and BFD support for the native HPPA object format (SOM) | |
5461 | along with a fairly extensive HPPA testsuite (for both SOM and ELF object | |
5462 | formats). This work was supported by both the Center for Software Science at | |
5463 | the University of Utah and Cygnus Support. | |
5464 | ||
5465 | Support for ELF format files has been worked on by Mark Eichin of Cygnus | |
5466 | Support (original, incomplete implementation for SPARC), Pete Hoogenboom and | |
5467 | Jeff Law at the University of Utah (HPPA mainly), Michael Meissner of the Open | |
5468 | Software Foundation (i386 mainly), and Ken Raeburn of Cygnus Support (sparc, | |
5469 | and some initial 64-bit support). | |
5470 | ||
5b93d8bb AM |
5471 | Linas Vepstas added GAS support for the ESA/390 "IBM 370" architecture. |
5472 | ||
252b5132 RH |
5473 | Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote GAS and BFD |
5474 | support for openVMS/Alpha. | |
5475 | ||
5476 | Several engineers at Cygnus Support have also provided many small bug fixes and | |
5477 | configuration enhancements. | |
5478 | ||
5479 | Many others have contributed large or small bugfixes and enhancements. If | |
5480 | you have contributed significant work and are not mentioned on this list, and | |
5481 | want to be, let us know. Some of the history has been lost; we are not | |
5482 | intentionally leaving anyone out. | |
5483 | ||
5484 | @node Index | |
5485 | @unnumbered Index | |
5486 | ||
5487 | @printindex cp | |
5488 | ||
5489 | @contents | |
5490 | @bye | |
5491 | @c Local Variables: | |
5492 | @c fill-column: 79 | |
5493 | @c End: |