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