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