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