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