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