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