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