Gas Doc: Update example of how .altmacro affects the interpretation of macro arguments.
[binutils-gdb.git] / gas / doc / as.texi
blob42db11e91daf10f33d0f4302abb28de46cdda79e
1 \input texinfo @c                               -*-Texinfo-*-
2 @c  Copyright (C) 1991-2024 Free Software Foundation, Inc.
3 @c UPDATE!!  On future updates--
4 @c   (1)   check for new machine-dep cmdline options in
5 @c         md_parse_option definitions in config/tc-*.c
6 @c   (2)   for platform-specific directives, examine md_pseudo_op
7 @c         in config/tc-*.c
8 @c   (3)   for object-format specific directives, examine obj_pseudo_op
9 @c         in config/obj-*.c
10 @c   (4)   portable directives in potable[] in read.c
11 @c %**start of header
12 @setfilename as.info
13 @c ---config---
14 @macro gcctabopt{body}
15 @code{\body\}
16 @end macro
17 @c defaults, config file may override:
18 @set have-stabs
19 @c ---
20 @c man begin NAME
21 @c ---
22 @include asconfig.texi
23 @include bfdver.texi
24 @c ---
25 @c man end
26 @c ---
27 @c common OR combinations of conditions
28 @ifset COFF
29 @set COFF-ELF
30 @end ifset
31 @ifset ELF
32 @set COFF-ELF
33 @end ifset
34 @ifset AOUT
35 @set aout
36 @end ifset
37 @ifset ARM/Thumb
38 @set ARM
39 @end ifset
40 @ifset Blackfin
41 @set Blackfin
42 @end ifset
43 @ifset BPF
44 @set BPF
45 @end ifset
46 @ifset H8/300
47 @set H8
48 @end ifset
49 @ifset SH
50 @set H8
51 @end ifset
52 @ifset HPPA
53 @set abnormal-separator
54 @end ifset
55 @c ------------
56 @ifset GENERIC
57 @settitle Using @value{AS}
58 @end ifset
59 @ifclear GENERIC
60 @settitle Using @value{AS} (@value{TARGET})
61 @end ifclear
62 @setchapternewpage odd
63 @c %**end of header
65 @c @smallbook
66 @c @set SMALL
67 @c WARE! Some of the machine-dependent sections contain tables of machine
68 @c instructions.  Except in multi-column format, these tables look silly.
69 @c Unfortunately, Texinfo doesn't have a general-purpose multi-col format, so
70 @c the multi-col format is faked within @example sections.
72 @c Again unfortunately, the natural size that fits on a page, for these tables,
73 @c is different depending on whether or not smallbook is turned on.
74 @c This matters, because of order: text flow switches columns at each page
75 @c break.
77 @c The format faked in this source works reasonably well for smallbook,
78 @c not well for the default large-page format.  This manual expects that if you
79 @c turn on @smallbook, you will also uncomment the "@set SMALL" to enable the
80 @c tables in question.  You can turn on one without the other at your
81 @c discretion, of course.
82 @ifinfo
83 @set SMALL
84 @c the insn tables look just as silly in info files regardless of smallbook,
85 @c might as well show 'em anyways.
86 @end ifinfo
88 @ifnottex
89 @dircategory Software development
90 @direntry
91 * As: (as).                     The GNU assembler.
92 * Gas: (as).                    The GNU assembler.
93 @end direntry
94 @end ifnottex
96 @finalout
97 @syncodeindex ky cp
99 @copying
100 This file documents the GNU Assembler "@value{AS}".
102 @c man begin COPYRIGHT
103 Copyright @copyright{} 1991-2024 Free Software Foundation, Inc.
105 Permission is granted to copy, distribute and/or modify this document
106 under the terms of the GNU Free Documentation License, Version 1.3
107 or any later version published by the Free Software Foundation;
108 with no Invariant Sections, with no Front-Cover Texts, and with no
109 Back-Cover Texts.  A copy of the license is included in the
110 section entitled ``GNU Free Documentation License''.
112 @c man end
113 @end copying
115 @titlepage
116 @title Using @value{AS}
117 @subtitle The @sc{gnu} Assembler
118 @ifclear GENERIC
119 @subtitle for the @value{TARGET} family
120 @end ifclear
121 @ifset VERSION_PACKAGE
122 @sp 1
123 @subtitle @value{VERSION_PACKAGE}
124 @end ifset
125 @sp 1
126 @subtitle Version @value{VERSION}
127 @sp 1
128 @sp 13
129 The Free Software Foundation Inc.@: thanks The Nice Computer
130 Company of Australia for loaning Dean Elsner to write the
131 first (Vax) version of @command{as} for Project @sc{gnu}.
132 The proprietors, management and staff of TNCCA thank FSF for
133 distracting the boss while they got some work
134 done.
135 @sp 3
136 @author Dean Elsner, Jay Fenlason & friends
137 @page
138 @tex
139 {\parskip=0pt
140 \hfill {\it Using {\tt @value{AS}}}\par
141 \hfill Edited by Cygnus Support\par
143 %"boxit" macro for figures:
144 %Modified from Knuth's ``boxit'' macro from TeXbook (answer to exercise 21.3)
145 \gdef\boxit#1#2{\vbox{\hrule\hbox{\vrule\kern3pt
146      \vbox{\parindent=0pt\parskip=0pt\hsize=#1\kern3pt\strut\hfil
147 #2\hfil\strut\kern3pt}\kern3pt\vrule}\hrule}}%box with visible outline
148 \gdef\ibox#1#2{\hbox to #1{#2\hfil}\kern8pt}% invisible box
149 @end tex
151 @vskip 0pt plus 1filll
152 Copyright @copyright{} 1991-2024 Free Software Foundation, Inc.
154       Permission is granted to copy, distribute and/or modify this document
155       under the terms of the GNU Free Documentation License, Version 1.3
156       or any later version published by the Free Software Foundation;
157       with no Invariant Sections, with no Front-Cover Texts, and with no
158       Back-Cover Texts.  A copy of the license is included in the
159       section entitled ``GNU Free Documentation License''.
161 @end titlepage
162 @contents
164 @ifnottex
165 @node Top
166 @top Using @value{AS}
168 This file is a user guide to the @sc{gnu} assembler @command{@value{AS}}
169 @ifset VERSION_PACKAGE
170 @value{VERSION_PACKAGE}
171 @end ifset
172 version @value{VERSION}.
173 @ifclear GENERIC
174 This version of the file describes @command{@value{AS}} configured to generate
175 code for @value{TARGET} architectures.
176 @end ifclear
178 This document is distributed under the terms of the GNU Free
179 Documentation License.  A copy of the license is included in the
180 section entitled ``GNU Free Documentation License''.
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 @ifset ELF
191 * Object Attributes::           Object Attributes
192 @end ifset
193 * Machine Dependencies::        Machine Dependent Features
194 * Reporting Bugs::              Reporting Bugs
195 * Acknowledgements::            Who Did What
196 * GNU Free Documentation License::  GNU Free Documentation License
197 * AS Index::                    AS Index
198 @end menu
199 @end ifnottex
201 @node Overview
202 @chapter Overview
203 @iftex
204 This manual is a user guide to the @sc{gnu} assembler @command{@value{AS}}.
205 @ifclear GENERIC
206 This version of the manual describes @command{@value{AS}} configured to generate
207 code for @value{TARGET} architectures.
208 @end ifclear
209 @end iftex
211 @cindex invocation summary
212 @cindex option summary
213 @cindex summary of options
214 Here is a brief summary of how to invoke @command{@value{AS}}.  For details,
215 see @ref{Invoking,,Command-Line Options}.
217 @c man title AS the portable GNU assembler.
219 @ignore
220 @c man begin SEEALSO
221 gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
222 @c man end
223 @end ignore
225 @c We don't use deffn and friends for the following because they seem
226 @c to be limited to one line for the header.
227 @smallexample
228 @c man begin SYNOPSIS
229 @value{AS} [@b{-a}[@b{cdghilns}][=@var{file}]]
230  [@b{--alternate}]
231  [@b{--compress-debug-sections}] [@b{--nocompress-debug-sections}]
232  [@b{-D}]
233  [@b{--dump-config}]
234  [@b{--debug-prefix-map} @var{old}=@var{new}]
235  [@b{--defsym} @var{sym}=@var{val}]
236  [@b{--elf-stt-common=[no|yes]}]
237  [@b{--emulation}=@var{name}]
238  [@b{-f}]
239  [@b{-g}] [@b{--gstabs}] [@b{--gstabs+}]
240  [@b{--gdwarf-<N>}] [@b{--gdwarf-sections}]
241  [@b{--gdwarf-cie-version}=@var{VERSION}]
242  [@b{--generate-missing-build-notes=[no|yes]}]
243  [@b{--gsframe}]
244  [@b{--hash-size}=@var{N}]
245  [@b{--help}] [@b{--target-help}]
246  [@b{-I} @var{dir}]
247  [@b{-J}]
248  [@b{-K}]
249  [@b{--keep-locals}]
250  [@b{-L}]
251  [@b{--listing-lhs-width}=@var{NUM}]
252  [@b{--listing-lhs-width2}=@var{NUM}]
253  [@b{--listing-rhs-width}=@var{NUM}]
254  [@b{--listing-cont-lines}=@var{NUM}]
255  [@b{--multibyte-handling=[allow|warn|warn-sym-only]}]
256  [@b{--no-pad-sections}]
257  [@b{-o} @var{objfile}] [@b{-R}]
258  [@b{--scfi=experimental}]
259  [@b{--sectname-subst}]
260  [@b{--size-check=[error|warning]}]
261  [@b{--statistics}]
262  [@b{-v}] [@b{-version}] [@b{--version}]
263  [@b{-W}] [@b{--warn}] [@b{--fatal-warnings}] [@b{-w}] [@b{-x}]
264  [@b{-Z}] [@b{@@@var{FILE}}]
265  [@var{target-options}]
266  [@b{--}|@var{files} @dots{}]
268 @c man end
269 @c Target dependent options are listed below.  Keep the list sorted.
270 @c Add an empty line for separation.
271 @c man begin TARGET
272 @ifset AARCH64
274 @emph{Target AArch64 options:}
275    [@b{-EB}|@b{-EL}]
276    [@b{-mabi}=@var{ABI}]
277 @end ifset
278 @ifset ALPHA
280 @emph{Target Alpha options:}
281    [@b{-m@var{cpu}}]
282    [@b{-mdebug} | @b{-no-mdebug}]
283    [@b{-replace} | @b{-noreplace}]
284    [@b{-relax}] [@b{-g}] [@b{-G@var{size}}]
285    [@b{-F}] [@b{-32addr}]
286 @end ifset
287 @ifset ARC
289 @emph{Target ARC options:}
290    [@b{-mcpu=@var{cpu}}]
291    [@b{-mA6}|@b{-mARC600}|@b{-mARC601}|@b{-mA7}|@b{-mARC700}|@b{-mEM}|@b{-mHS}]
292    [@b{-mcode-density}]
293    [@b{-mrelax}]
294    [@b{-EB}|@b{-EL}]
295 @end ifset
296 @ifset ARM
298 @emph{Target ARM options:}
299 @c Don't document the deprecated options
300    [@b{-mcpu}=@var{processor}[+@var{extension}@dots{}]]
301    [@b{-march}=@var{architecture}[+@var{extension}@dots{}]]
302    [@b{-mfpu}=@var{floating-point-format}]
303    [@b{-mfloat-abi}=@var{abi}]
304    [@b{-meabi}=@var{ver}]
305    [@b{-mthumb}]
306    [@b{-EB}|@b{-EL}]
307    [@b{-mapcs-32}|@b{-mapcs-26}|@b{-mapcs-float}|
308     @b{-mapcs-reentrant}]
309    [@b{-mthumb-interwork}] [@b{-k}]
310 @end ifset
311 @ifset Blackfin
313 @emph{Target Blackfin options:}
314    [@b{-mcpu}=@var{processor}[-@var{sirevision}]]
315    [@b{-mfdpic}]
316    [@b{-mno-fdpic}]
317    [@b{-mnopic}]
318 @end ifset
319 @ifset BPF
321 @emph{Target BPF options:}
322    [@b{-EL}] [@b{-EB}]
323 @end ifset
324 @ifset CRIS
326 @emph{Target CRIS options:}
327    [@b{--underscore} | @b{--no-underscore}]
328    [@b{--pic}] [@b{-N}]
329    [@b{--emulation=criself} | @b{--emulation=crisaout}]
330    [@b{--march=v0_v10} | @b{--march=v10} | @b{--march=v32} | @b{--march=common_v10_v32}]
331 @c Deprecated -- deliberately not documented.
332 @c [@b{-h}] [@b{-H}]
333 @end ifset
334 @ifset CSKY
336 @emph{Target C-SKY options:}
337    [@b{-march=@var{arch}}] [@b{-mcpu=@var{cpu}}]
338    [@b{-EL}] [@b{-mlittle-endian}] [@b{-EB}] [@b{-mbig-endian}]
339    [@b{-fpic}] [@b{-pic}]
340    [@b{-mljump}] [@b{-mno-ljump}]
341    [@b{-force2bsr}] [@b{-mforce2bsr}] [@b{-no-force2bsr}] [@b{-mno-force2bsr}]
342    [@b{-jsri2bsr}] [@b{-mjsri2bsr}] [@b{-no-jsri2bsr }] [@b{-mno-jsri2bsr}]
343    [@b{-mnolrw }] [@b{-mno-lrw}]
344    [@b{-melrw}] [@b{-mno-elrw}]
345    [@b{-mlaf }] [@b{-mliterals-after-func}]
346    [@b{-mno-laf}] [@b{-mno-literals-after-func}]
347    [@b{-mlabr}] [@b{-mliterals-after-br}]
348    [@b{-mno-labr}] [@b{-mnoliterals-after-br}]
349    [@b{-mistack}] [@b{-mno-istack}]
350    [@b{-mhard-float}] [@b{-mmp}] [@b{-mcp}] [@b{-mcache}]
351    [@b{-msecurity}] [@b{-mtrust}]
352    [@b{-mdsp}] [@b{-medsp}] [@b{-mvdsp}]
353 @end ifset
354 @ifset D10V
356 @emph{Target D10V options:}
357    [@b{-O}]
358 @end ifset
359 @ifset D30V
361 @emph{Target D30V options:}
362    [@b{-O}|@b{-n}|@b{-N}]
363 @end ifset
364 @ifset EPIPHANY
366 @emph{Target EPIPHANY options:}
367    [@b{-mepiphany}|@b{-mepiphany16}]
368 @end ifset
369 @ifset H8
371 @emph{Target H8/300 options:}
372    [-h-tick-hex]
373 @end ifset
374 @ifset HPPA
375 @c HPPA has no machine-dependent assembler options (yet).
376 @end ifset
377 @ifset I80386
379 @emph{Target i386 options:}
380    [@b{--32}|@b{--x32}|@b{--64}] [@b{-n}]
381    [@b{-march}=@var{CPU}[+@var{EXTENSION}@dots{}]] [@b{-mtune}=@var{CPU}]
382 @end ifset
383 @ifset IA64
385 @emph{Target IA-64 options:}
386    [@b{-mconstant-gp}|@b{-mauto-pic}]
387    [@b{-milp32}|@b{-milp64}|@b{-mlp64}|@b{-mp64}]
388    [@b{-mle}|@b{mbe}]
389    [@b{-mtune=itanium1}|@b{-mtune=itanium2}]
390    [@b{-munwind-check=warning}|@b{-munwind-check=error}]
391    [@b{-mhint.b=ok}|@b{-mhint.b=warning}|@b{-mhint.b=error}]
392    [@b{-x}|@b{-xexplicit}] [@b{-xauto}] [@b{-xdebug}]
393 @end ifset
394 @ifset IP2K
396 @emph{Target IP2K options:}
397    [@b{-mip2022}|@b{-mip2022ext}]
398 @end ifset
399 @ifset LOONGARCH
401 @emph{Target LOONGARCH options:}
402    [@b{-fpic}|@b{-fPIC}|@b{-fno-pic}]
403 @end ifset
404 @ifset M32C
406 @emph{Target M32C options:}
407    [@b{-m32c}|@b{-m16c}] [-relax] [-h-tick-hex]
408 @end ifset
409 @ifset M32R
411 @emph{Target M32R options:}
412    [@b{--m32rx}|@b{--[no-]warn-explicit-parallel-conflicts}|
413    @b{--W[n]p}]
414 @end ifset
415 @ifset M680X0
417 @emph{Target M680X0 options:}
418    [@b{-l}] [@b{-m68000}|@b{-m68010}|@b{-m68020}|@dots{}]
419 @end ifset
420 @ifset M68HC11
422 @emph{Target M68HC11 options:}
423    [@b{-m68hc11}|@b{-m68hc12}|@b{-m68hcs12}|@b{-mm9s12x}|@b{-mm9s12xg}]
424    [@b{-mshort}|@b{-mlong}]
425    [@b{-mshort-double}|@b{-mlong-double}]
426    [@b{--force-long-branches}] [@b{--short-branches}]
427    [@b{--strict-direct-mode}] [@b{--print-insn-syntax}]
428    [@b{--print-opcodes}] [@b{--generate-example}]
429 @end ifset
430 @ifset MCORE
432 @emph{Target MCORE options:}
433    [@b{-jsri2bsr}] [@b{-sifilter}] [@b{-relax}]
434    [@b{-mcpu=[210|340]}]
435 @end ifset
436 @ifset METAG
438 @emph{Target Meta options:}
439    [@b{-mcpu=@var{cpu}}] [@b{-mfpu=@var{cpu}}] [@b{-mdsp=@var{cpu}}]
440 @end ifset
441 @ifset MICROBLAZE
442 @emph{Target MICROBLAZE options:}
443    [@b{-mlittle-endian}] [@b{-mbig-endian}]
444 @end ifset
445 @ifset MIPS
447 @emph{Target MIPS options:}
448    [@b{-nocpp}] [@b{-EL}] [@b{-EB}] [@b{-O}[@var{optimization level}]]
449    [@b{-g}[@var{debug level}]] [@b{-G} @var{num}] [@b{-KPIC}] [@b{-call_shared}]
450    [@b{-non_shared}] [@b{-xgot} [@b{-mvxworks-pic}]
451    [@b{-mabi}=@var{ABI}] [@b{-32}] [@b{-n32}] [@b{-64}] [@b{-mfp32}] [@b{-mgp32}]
452    [@b{-mfp64}] [@b{-mgp64}] [@b{-mfpxx}]
453    [@b{-modd-spreg}] [@b{-mno-odd-spreg}]
454    [@b{-march}=@var{CPU}] [@b{-mtune}=@var{CPU}] [@b{-mips1}] [@b{-mips2}]
455    [@b{-mips3}] [@b{-mips4}] [@b{-mips5}] [@b{-mips32}] [@b{-mips32r2}]
456    [@b{-mips32r3}] [@b{-mips32r5}] [@b{-mips32r6}] [@b{-mips64}] [@b{-mips64r2}]
457    [@b{-mips64r3}] [@b{-mips64r5}] [@b{-mips64r6}]
458    [@b{-construct-floats}] [@b{-no-construct-floats}]
459    [@b{-mignore-branch-isa}] [@b{-mno-ignore-branch-isa}]
460    [@b{-mnan=@var{encoding}}]
461    [@b{-trap}] [@b{-no-break}] [@b{-break}] [@b{-no-trap}]
462    [@b{-mips16}] [@b{-no-mips16}]
463    [@b{-mmips16e2}] [@b{-mno-mips16e2}]
464    [@b{-mmicromips}] [@b{-mno-micromips}]
465    [@b{-msmartmips}] [@b{-mno-smartmips}]
466    [@b{-mips3d}] [@b{-no-mips3d}]
467    [@b{-mdmx}] [@b{-no-mdmx}]
468    [@b{-mdsp}] [@b{-mno-dsp}]
469    [@b{-mdspr2}] [@b{-mno-dspr2}]
470    [@b{-mdspr3}] [@b{-mno-dspr3}]
471    [@b{-mmsa}] [@b{-mno-msa}]
472    [@b{-mxpa}] [@b{-mno-xpa}]
473    [@b{-mmt}] [@b{-mno-mt}]
474    [@b{-mmcu}] [@b{-mno-mcu}]
475    [@b{-mcrc}] [@b{-mno-crc}]
476    [@b{-mginv}] [@b{-mno-ginv}]
477    [@b{-mloongson-mmi}] [@b{-mno-loongson-mmi}]
478    [@b{-mloongson-cam}] [@b{-mno-loongson-cam}]
479    [@b{-mloongson-ext}] [@b{-mno-loongson-ext}]
480    [@b{-mloongson-ext2}] [@b{-mno-loongson-ext2}]
481    [@b{-minsn32}] [@b{-mno-insn32}]
482    [@b{-mfix7000}] [@b{-mno-fix7000}]
483    [@b{-mfix-rm7000}] [@b{-mno-fix-rm7000}]
484    [@b{-mfix-vr4120}] [@b{-mno-fix-vr4120}]
485    [@b{-mfix-vr4130}] [@b{-mno-fix-vr4130}]
486    [@b{-mfix-r5900}] [@b{-mno-fix-r5900}]
487    [@b{-mdebug}] [@b{-no-mdebug}]
488    [@b{-mpdr}] [@b{-mno-pdr}]
489 @end ifset
490 @ifset MMIX
492 @emph{Target MMIX options:}
493    [@b{--fixed-special-register-names}] [@b{--globalize-symbols}]
494    [@b{--gnu-syntax}] [@b{--relax}] [@b{--no-predefined-symbols}]
495    [@b{--no-expand}] [@b{--no-merge-gregs}] [@b{-x}]
496    [@b{--linker-allocated-gregs}]
497 @end ifset
498 @ifset NIOSII
500 @emph{Target Nios II options:}
501    [@b{-relax-all}] [@b{-relax-section}] [@b{-no-relax}]
502    [@b{-EB}] [@b{-EL}]
503 @end ifset
504 @ifset NDS32
506 @emph{Target NDS32 options:}
507     [@b{-EL}] [@b{-EB}] [@b{-O}] [@b{-Os}] [@b{-mcpu=@var{cpu}}]
508     [@b{-misa=@var{isa}}] [@b{-mabi=@var{abi}}] [@b{-mall-ext}]
509     [@b{-m[no-]16-bit}]  [@b{-m[no-]perf-ext}] [@b{-m[no-]perf2-ext}]
510     [@b{-m[no-]string-ext}] [@b{-m[no-]dsp-ext}] [@b{-m[no-]mac}] [@b{-m[no-]div}]
511     [@b{-m[no-]audio-isa-ext}] [@b{-m[no-]fpu-sp-ext}] [@b{-m[no-]fpu-dp-ext}]
512     [@b{-m[no-]fpu-fma}] [@b{-mfpu-freg=@var{FREG}}] [@b{-mreduced-regs}]
513     [@b{-mfull-regs}] [@b{-m[no-]dx-regs}] [@b{-mpic}] [@b{-mno-relax}]
514     [@b{-mb2bb}]
515 @end ifset
516 @ifset OPENRISC
517 @c OpenRISC has no machine-dependent assembler options.
518 @end ifset
519 @ifset PDP11
521 @emph{Target PDP11 options:}
522    [@b{-mpic}|@b{-mno-pic}] [@b{-mall}] [@b{-mno-extensions}]
523    [@b{-m}@var{extension}|@b{-mno-}@var{extension}]
524    [@b{-m}@var{cpu}] [@b{-m}@var{machine}]
525 @end ifset
526 @ifset PJ
528 @emph{Target picoJava options:}
529    [@b{-mb}|@b{-me}]
530 @end ifset
531 @ifset PPC
533 @emph{Target PowerPC options:}
534    [@b{-a32}|@b{-a64}]
535    [@b{-mpwrx}|@b{-mpwr2}|@b{-mpwr}|@b{-m601}|@b{-mppc}|@b{-mppc32}|@b{-m603}|@b{-m604}|@b{-m403}|@b{-m405}|
536     @b{-m440}|@b{-m464}|@b{-m476}|@b{-m7400}|@b{-m7410}|@b{-m7450}|@b{-m7455}|@b{-m750cl}|@b{-mgekko}|
537     @b{-mbroadway}|@b{-mppc64}|@b{-m620}|@b{-me500}|@b{-e500x2}|@b{-me500mc}|@b{-me500mc64}|@b{-me5500}|
538     @b{-me6500}|@b{-mppc64bridge}|@b{-mbooke}|@b{-mpower4}|@b{-mpwr4}|@b{-mpower5}|@b{-mpwr5}|@b{-mpwr5x}|
539     @b{-mpower6}|@b{-mpwr6}|@b{-mpower7}|@b{-mpwr7}|@b{-mpower8}|@b{-mpwr8}|@b{-mpower9}|@b{-mpwr9}@b{-ma2}|
540     @b{-mcell}|@b{-mspe}|@b{-mspe2}|@b{-mtitan}|@b{-me300}|@b{-mcom}]
541    [@b{-many}] [@b{-maltivec}|@b{-mvsx}|@b{-mhtm}|@b{-mvle}]
542    [@b{-mregnames}|@b{-mno-regnames}]
543    [@b{-mrelocatable}|@b{-mrelocatable-lib}|@b{-K PIC}] [@b{-memb}]
544    [@b{-mlittle}|@b{-mlittle-endian}|@b{-le}|@b{-mbig}|@b{-mbig-endian}|@b{-be}]
545    [@b{-msolaris}|@b{-mno-solaris}]
546    [@b{-nops=@var{count}}]
547 @end ifset
548 @ifset PRU
550 @emph{Target PRU options:}
551    [@b{-link-relax}]
552    [@b{-mnolink-relax}]
553    [@b{-mno-warn-regname-label}]
554 @end ifset
555 @ifset RISCV
557 @emph{Target RISC-V options:}
558    [@b{-fpic}|@b{-fPIC}|@b{-fno-pic}]
559    [@b{-march}=@var{ISA}]
560    [@b{-mabi}=@var{ABI}]
561    [@b{-mlittle-endian}|@b{-mbig-endian}]
562 @end ifset
563 @ifset RL78
565 @emph{Target RL78 options:}
566    [@b{-mg10}]
567    [@b{-m32bit-doubles}|@b{-m64bit-doubles}]
568 @end ifset
569 @ifset RX
571 @emph{Target RX options:}
572    [@b{-mlittle-endian}|@b{-mbig-endian}]
573    [@b{-m32bit-doubles}|@b{-m64bit-doubles}]
574    [@b{-muse-conventional-section-names}]
575    [@b{-msmall-data-limit}]
576    [@b{-mpid}]
577    [@b{-mrelax}]
578    [@b{-mint-register=@var{number}}]
579    [@b{-mgcc-abi}|@b{-mrx-abi}]
580 @end ifset
581 @ifset S390
583 @emph{Target s390 options:}
584    [@b{-m31}|@b{-m64}] [@b{-mesa}|@b{-mzarch}] [@b{-march}=@var{CPU}]
585    [@b{-mregnames}|@b{-mno-regnames}]
586    [@b{-mwarn-areg-zero}]
587    [@b{-mwarn-regtype-mismatch=strict}
588     @b{-mwarn-regtype-mismatch=relaxed}
589     @b{-mwarn-regtype-mismatch=no}
590     @b{-mno-warn-regtype-mismatch}]
591 @end ifset
592 @ifset SCORE
594 @emph{Target SCORE options:}
595    [@b{-EB}][@b{-EL}][@b{-FIXDD}][@b{-NWARN}]
596    [@b{-SCORE5}][@b{-SCORE5U}][@b{-SCORE7}][@b{-SCORE3}]
597    [@b{-march=score7}][@b{-march=score3}]
598    [@b{-USE_R1}][@b{-KPIC}][@b{-O0}][@b{-G} @var{num}][@b{-V}]
599 @end ifset
600 @ifset SPARC
602 @emph{Target SPARC options:}
603 @c The order here is important.  See c-sparc.texi.
604    [@b{-Av6}|@b{-Av7}|@b{-Av8}|@b{-Aleon}|@b{-Asparclet}|@b{-Asparclite}
605     @b{-Av8plus}|@b{-Av8plusa}|@b{-Av8plusb}|@b{-Av8plusc}|@b{-Av8plusd}
606     @b{-Av8plusv}|@b{-Av8plusm}|@b{-Av9}|@b{-Av9a}|@b{-Av9b}|@b{-Av9c}
607     @b{-Av9d}|@b{-Av9e}|@b{-Av9v}|@b{-Av9m}|@b{-Asparc}|@b{-Asparcvis}
608     @b{-Asparcvis2}|@b{-Asparcfmaf}|@b{-Asparcima}|@b{-Asparcvis3}
609     @b{-Asparcvisr}|@b{-Asparc5}]
610    [@b{-xarch=v8plus}|@b{-xarch=v8plusa}]|@b{-xarch=v8plusb}|@b{-xarch=v8plusc}
611     @b{-xarch=v8plusd}|@b{-xarch=v8plusv}|@b{-xarch=v8plusm}|@b{-xarch=v9}
612     @b{-xarch=v9a}|@b{-xarch=v9b}|@b{-xarch=v9c}|@b{-xarch=v9d}|@b{-xarch=v9e}
613     @b{-xarch=v9v}|@b{-xarch=v9m}|@b{-xarch=sparc}|@b{-xarch=sparcvis}
614     @b{-xarch=sparcvis2}|@b{-xarch=sparcfmaf}|@b{-xarch=sparcima}
615     @b{-xarch=sparcvis3}|@b{-xarch=sparcvisr}|@b{-xarch=sparc5}
616     @b{-bump}]
617    [@b{-32}|@b{-64}]
618    [@b{--enforce-aligned-data}][@b{--dcti-couples-detect}]
619 @end ifset
620 @ifset TIC54X
622 @emph{Target TIC54X options:}
623  [@b{-mcpu=54[123589]}|@b{-mcpu=54[56]lp}] [@b{-mfar-mode}|@b{-mf}]
624  [@b{-merrors-to-file} @var{<filename>}|@b{-me} @var{<filename>}]
625 @end ifset
626 @ifset TIC6X
628 @emph{Target TIC6X options:}
629    [@b{-march=@var{arch}}] [@b{-mbig-endian}|@b{-mlittle-endian}]
630    [@b{-mdsbt}|@b{-mno-dsbt}] [@b{-mpid=no}|@b{-mpid=near}|@b{-mpid=far}]
631    [@b{-mpic}|@b{-mno-pic}]
632 @end ifset
633 @ifset TILEGX
635 @emph{Target TILE-Gx options:}
636    [@b{-m32}|@b{-m64}][@b{-EB}][@b{-EL}]
637 @end ifset
638 @ifset TILEPRO
639 @c TILEPro has no machine-dependent assembler options
640 @end ifset
641 @ifset VISIUM
643 @emph{Target Visium options:}
644    [@b{-mtune=@var{arch}}]
645 @end ifset
646 @ifset XTENSA
648 @emph{Target Xtensa options:}
649  [@b{--[no-]text-section-literals}] [@b{--[no-]auto-litpools}]
650  [@b{--[no-]absolute-literals}]
651  [@b{--[no-]target-align}] [@b{--[no-]longcalls}]
652  [@b{--[no-]transform}]
653  [@b{--rename-section} @var{oldname}=@var{newname}]
654  [@b{--[no-]trampolines}]
655  [@b{--abi-windowed}|@b{--abi-call0}]
656 @end ifset
657 @ifset Z80
659 @emph{Target Z80 options:}
660   [@b{-march=@var{CPU}@var{[-EXT]}@var{[+EXT]}}]
661   [@b{-local-prefix=}@var{PREFIX}]
662   [@b{-colonless}]
663   [@b{-sdcc}]
664   [@b{-fp-s=}@var{FORMAT}]
665   [@b{-fp-d=}@var{FORMAT}]
666 @end ifset
667 @ifset Z8000
669 @c Z8000 has no machine-dependent assembler options
670 @end ifset
672 @c man end
673 @end smallexample
675 @c man begin OPTIONS
677 @table @gcctabopt
678 @include at-file.texi
680 @item -a[cdghilmns]
681 Turn on listings, in any of a variety of ways:
683 @table @gcctabopt
684 @item -ac
685 omit false conditionals
687 @item -ad
688 omit debugging directives
690 @item -ag
691 include general information, like @value{AS} version and options passed
693 @item -ah
694 include high-level source
696 @item -al
697 include assembly
699 @item -ali
700 include assembly with ginsn
702 @item -am
703 include macro expansions
705 @item -an
706 omit forms processing
708 @item -as
709 include symbols
711 @item =file
712 set the name of the listing file
713 @end table
715 You may combine these options; for example, use @samp{-aln} for assembly
716 listing without forms processing.  The @samp{=file} option, if used, must be
717 the last one.  By itself, @samp{-a} defaults to @samp{-ahls}.
719 @item --alternate
720 Begin in alternate macro mode.
721 @ifclear man
722 @xref{Altmacro,,@code{.altmacro}}.
723 @end ifclear
725 @item --compress-debug-sections
726 Compress DWARF debug sections using zlib with SHF_COMPRESSED from the
727 ELF ABI.  The resulting object file may not be compatible with older
728 linkers and object file utilities.  Note if compression would make a
729 given section @emph{larger} then it is not compressed.
731 @ifset ELF
732 @cindex @samp{--compress-debug-sections=} option
733 @item --compress-debug-sections=none
734 @itemx --compress-debug-sections=zlib
735 @itemx --compress-debug-sections=zlib-gnu
736 @itemx --compress-debug-sections=zlib-gabi
737 @itemx --compress-debug-sections=zstd
738 These options control how DWARF debug sections are compressed.
739 @option{--compress-debug-sections=none} is equivalent to
740 @option{--nocompress-debug-sections}.
741 @option{--compress-debug-sections=zlib} and
742 @option{--compress-debug-sections=zlib-gabi} are equivalent to
743 @option{--compress-debug-sections}.
744 @option{--compress-debug-sections=zlib-gnu} compresses DWARF debug sections
745 using the obsoleted zlib-gnu format.  The debug sections are renamed to begin
746 with @samp{.zdebug}.
747 @option{--compress-debug-sections=zstd} compresses DWARF debug
748 sections using zstd.  Note - if compression would actually make a section
749 @emph{larger}, then it is not compressed nor renamed.
751 @end ifset
753 @item --nocompress-debug-sections
754 Do not compress DWARF debug sections.  This is usually the default for all
755 targets except the x86/x86_64, but a configure time option can be used to
756 override this.
758 @item -D
759 Enable debugging in target specific backends, if supported.  Otherwise ignored.
760 Even if ignored, this option is accepted for script compatibility with calls to
761 other assemblers.
763 @item --debug-prefix-map @var{old}=@var{new}
764 When assembling files in directory @file{@var{old}}, record debugging
765 information describing them as in @file{@var{new}} instead.
767 @item --defsym @var{sym}=@var{value}
768 Define the symbol @var{sym} to be @var{value} before assembling the input file.
769 @var{value} must be an integer constant.  As in C, a leading @samp{0x}
770 indicates a hexadecimal value, and a leading @samp{0} indicates an octal
771 value.  The value of the symbol can be overridden inside a source file via the
772 use of a @code{.set} pseudo-op.
774 @item --dump-config
775 Displays how the assembler is configured and then exits.
777 @ifset ELF
778 @item --elf-stt-common=no
779 @itemx --elf-stt-common=yes
780 These options control whether the ELF assembler should generate common
781 symbols with the @code{STT_COMMON} type.  The default can be controlled
782 by a configure option @option{--enable-elf-stt-common}.
783 @end ifset
785 @item --emulation=@var{name}
786 If the assembler is configured to support multiple different target
787 configurations then this option can be used to select the desired form.
789 @item -f
790 ``fast''---skip whitespace and comment preprocessing (assume source is
791 compiler output).
793 @item -g
794 @itemx --gen-debug
795 Generate debugging information for each assembler source line using whichever
796 debug format is preferred by the target.  This currently means either STABS,
797 ECOFF or DWARF2.  When the debug format is DWARF then a @code{.debug_info} and
798 @code{.debug_line} section is only emitted when the assembly file doesn't
799 generate one itself.
801 @item --gstabs
802 Generate stabs debugging information for each assembler line.  This
803 may help debugging assembler code, if the debugger can handle it.
805 @item --gstabs+
806 Generate stabs debugging information for each assembler line, with GNU
807 extensions that probably only gdb can handle, and that could make other
808 debuggers crash or refuse to read your program.  This
809 may help debugging assembler code.  Currently the only GNU extension is
810 the location of the current working directory at assembling time.
812 @item --gdwarf-2
813 Generate DWARF2 debugging information for each assembler line.  This
814 may help debugging assembler code, if the debugger can handle it.  Note---this
815 option is only supported by some targets, not all of them.
817 @item --gdwarf-3
818 This option is the same as the @option{--gdwarf-2} option, except that it
819 allows for the possibility of the generation of extra debug information as per
820 version 3 of the DWARF specification.  Note - enabling this option does not
821 guarantee the generation of any extra information, the choice to do so is on a
822 per target basis.
824 @item --gdwarf-4
825 This option is the same as the @option{--gdwarf-2} option, except that it
826 allows for the possibility of the generation of extra debug information as per
827 version 4 of the DWARF specification.  Note - enabling this option does not
828 guarantee the generation of any extra information, the choice to do so is on a
829 per target basis.
831 @item --gdwarf-5
832 This option is the same as the @option{--gdwarf-2} option, except that it
833 allows for the possibility of the generation of extra debug information as per
834 version 5 of the DWARF specification.  Note - enabling this option does not
835 guarantee the generation of any extra information, the choice to do so is on a
836 per target basis.
838 @item --gdwarf-sections
839 Instead of creating a .debug_line section, create a series of
840 .debug_line.@var{foo} sections where @var{foo} is the name of the
841 corresponding code section.  For example a code section called @var{.text.func}
842 will have its dwarf line number information placed into a section called
843 @var{.debug_line.text.func}.  If the code section is just called @var{.text}
844 then debug line section will still be called just @var{.debug_line} without any
845 suffix.
847 @item --gdwarf-cie-version=@var{version}
848 Control which version of DWARF Common Information Entries (CIEs) are produced.
849 When this flag is not specified the default is version 1, though some targets
850 can modify this default.  Other possible values for @var{version} are 3 or 4.
852 @ifset ELF
853 @item --generate-missing-build-notes=yes
854 @itemx --generate-missing-build-notes=no
855 These options control whether the ELF assembler should generate GNU Build
856 attribute notes if none are present in the input sources.
857 The default can be controlled by the @option{--enable-generate-build-notes}
858 configure option.
860 @item --gsframe
861 @itemx --gsframe
862 Create @var{.sframe} section from CFI directives.
864 @end ifset
866 @item --hash-size @var{N}
867 Ignored.  Supported for command line compatibility with other assemblers.
869 @item --help
870 Print a summary of the command-line options and exit.
872 @item --target-help
873 Print a summary of all target specific options and exit.
875 @item -I @var{dir}
876 Add directory @var{dir} to the search list for @code{.include} directives.
878 @item -J
879 Don't warn about signed overflow.
881 @item -K
882 @ifclear DIFF-TBL-KLUGE
883 This option is accepted but has no effect on the @value{TARGET} family.
884 @end ifclear
885 @ifset DIFF-TBL-KLUGE
886 Issue warnings when difference tables altered for long displacements.
887 @end ifset
889 @item -L
890 @itemx --keep-locals
891 Keep (in the symbol table) local symbols.  These symbols start with
892 system-specific local label prefixes, typically @samp{.L} for ELF systems
893 or @samp{L} for traditional a.out systems.
894 @ifclear man
895 @xref{Symbol Names}.
896 @end ifclear
898 @item --listing-lhs-width=@var{number}
899 Set the maximum width, in words, of the output data column for an assembler
900 listing to @var{number}.
902 @item --listing-lhs-width2=@var{number}
903 Set the maximum width, in words, of the output data column for continuation
904 lines in an assembler listing to @var{number}.
906 @item --listing-rhs-width=@var{number}
907 Set the maximum width of an input source line, as displayed in a listing, to
908 @var{number} bytes.
910 @item --listing-cont-lines=@var{number}
911 Set the maximum number of lines printed in a listing for a single line of input
912 to @var{number} + 1.
914 @item --multibyte-handling=allow
915 @itemx --multibyte-handling=warn
916 @itemx --multibyte-handling=warn-sym-only
917 @itemx --multibyte-handling=warn_sym_only
918 Controls how the assembler handles multibyte characters in the input.  The
919 default (which can be restored by using the @option{allow} argument) is to
920 allow such characters without complaint.  Using the @option{warn} argument will
921 make the assembler generate a warning message whenever any multibyte character
922 is encountered.  Using the @option{warn-sym-only} argument will only cause a
923 warning to be generated when a symbol is defined with a name that contains
924 multibyte characters.  (References to undefined symbols will not generate a
925 warning).
927 @item --no-pad-sections
928 Stop the assembler for padding the ends of output sections to the alignment
929 of that section.  The default is to pad the sections, but this can waste space
930 which might be needed on targets which have tight memory constraints.
932 @item -o @var{objfile}
933 Name the object-file output from @command{@value{AS}} @var{objfile}.
935 @item -R
936 Fold the data section into the text section.
938 @item --reduce-memory-overheads
939 Ignored.  Supported for compatibility with tools that apss the same option to
940 both the assembler and the linker.
942 @ifset ELF
943 @item --scfi=experimental
944 This option controls whether the assembler should synthesize CFI for
945 hand-written input.  If the input already contains some synthesizable CFI
946 directives, the assembler ignores them and emits a warning.  Note that
947 @code{--scfi=experimental} is not intended to be used for compiler-generated
948 code, including inline assembly.  This experimental support is work in
949 progress.  Only System V AMD64 ABI is supported.
951 Each input function in assembly must begin with the @code{.type} directive, and
952 should ideally be closed off using a @code{.size} directive.  When using SCFI,
953 each @code{.type} directive prompts GAS to start a new FDE (a.k.a., Function
954 Descriptor Entry).  This implies that with each @code{.type} directive, a
955 previous block of instructions, if any, is finalised as a distinct FDE.
957 @item --sectname-subst
958 Honor substitution sequences in section names.
959 @ifclear man
960 @xref{Section Name Substitutions,,@code{.section @var{name}}}.
961 @end ifclear
963 @item --size-check=error
964 @itemx --size-check=warning
965 Issue an error or warning for invalid ELF .size directive.
966 @end ifset
968 @item --statistics
969 Print the maximum space (in bytes) and total time (in seconds) used by
970 assembly.
972 @item --strip-local-absolute
973 Remove local absolute symbols from the outgoing symbol table.
975 @item -v
976 @itemx -version
977 Print the @command{as} version.
979 @item --version
980 Print the @command{as} version and exit.
982 @item -W
983 @itemx --no-warn
984 Suppress warning messages.
986 @item --fatal-warnings
987 Treat warnings as errors.
989 @item --warn
990 Don't suppress warning messages or treat them as errors.
992 @item -w
993 Ignored.
995 @item -x
996 Ignored.
998 @item -Z
999 Generate an object file even after errors.
1001 @item -- | @var{files} @dots{}
1002 Standard input, or source files to assemble.
1004 @end table
1005 @c man end
1007 @ifset AARCH64
1009 @ifclear man
1010 @xref{AArch64 Options}, for the options available when @value{AS} is configured
1011 for the 64-bit mode of the ARM Architecture (AArch64).
1012 @end ifclear
1014 @ifset man
1015 @c man begin OPTIONS
1016 The following options are available when @value{AS} is configured for the
1017 64-bit mode of the ARM Architecture (AArch64).
1018 @c man end
1019 @c man begin INCLUDE
1020 @include c-aarch64.texi
1021 @c ended inside the included file
1022 @end ifset
1024 @end ifset
1026 @ifset ALPHA
1028 @ifclear man
1029 @xref{Alpha Options}, for the options available when @value{AS} is configured
1030 for an Alpha processor.
1031 @end ifclear
1033 @ifset man
1034 @c man begin OPTIONS
1035 The following options are available when @value{AS} is configured for an Alpha
1036 processor.
1037 @c man end
1038 @c man begin INCLUDE
1039 @include c-alpha.texi
1040 @c ended inside the included file
1041 @end ifset
1043 @end ifset
1045 @c man begin OPTIONS
1046 @ifset ARC
1047 The following options are available when @value{AS} is configured for an ARC
1048 processor.
1050 @table @gcctabopt
1051 @item -mcpu=@var{cpu}
1052 This option selects the core processor variant.
1053 @item -EB | -EL
1054 Select either big-endian (-EB) or little-endian (-EL) output.
1055 @item -mcode-density
1056 Enable Code Density extension instructions.
1057 @end table
1058 @end ifset
1060 @ifset ARM
1061 The following options are available when @value{AS} is configured for the ARM
1062 processor family.
1064 @table @gcctabopt
1065 @item -mcpu=@var{processor}[+@var{extension}@dots{}]
1066 Specify which ARM processor variant is the target.
1067 @item -march=@var{architecture}[+@var{extension}@dots{}]
1068 Specify which ARM architecture variant is used by the target.
1069 @item -mfpu=@var{floating-point-format}
1070 Select which Floating Point architecture is the target.
1071 @item -mfloat-abi=@var{abi}
1072 Select which floating point ABI is in use.
1073 @item -mthumb
1074 Enable Thumb only instruction decoding.
1075 @item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant
1076 Select which procedure calling convention is in use.
1077 @item -EB | -EL
1078 Select either big-endian (-EB) or little-endian (-EL) output.
1079 @item -mthumb-interwork
1080 Specify that the code has been generated with interworking between Thumb and
1081 ARM code in mind.
1082 @item -mccs
1083 Turns on CodeComposer Studio assembly syntax compatibility mode.
1084 @item -k
1085 Specify that PIC code has been generated.
1086 @end table
1087 @end ifset
1088 @c man end
1090 @ifset Blackfin
1092 @ifclear man
1093 @xref{Blackfin Options}, for the options available when @value{AS} is
1094 configured for the Blackfin processor family.
1095 @end ifclear
1097 @ifset man
1098 @c man begin OPTIONS
1099 The following options are available when @value{AS} is configured for
1100 the Blackfin processor family.
1101 @c man end
1102 @c man begin INCLUDE
1103 @include c-bfin.texi
1104 @c ended inside the included file
1105 @end ifset
1107 @end ifset
1109 @ifset BPF
1111 @ifclear man
1112 @xref{BPF Options}, for the options available when @value{AS} is
1113 configured for the Linux kernel BPF processor family.
1114 @end ifclear
1116 @ifset man
1117 @c man begin OPTIONS
1118 The following options are available when @value{AS} is configured for
1119 the Linux kernel BPF processor family.
1120 @c man end
1121 @c man begin INCLUDE
1122 @include c-bpf.texi
1123 @c ended inside the included file
1124 @end ifset
1126 @end ifset
1128 @c man begin OPTIONS
1129 @ifset CRIS
1130 See the info pages for documentation of the CRIS-specific options.
1131 @end ifset
1133 @ifset CSKY
1135 @ifclear man
1136 @xref{C-SKY Options}, for the options available when @value{AS} is
1137 configured for the C-SKY processor family.
1138 @end ifclear
1140 @ifset man
1141 @c man begin OPTIONS
1142 The following options are available when @value{AS} is configured for
1143 the C-SKY processor family.
1144 @c man end
1145 @c man begin INCLUDE
1146 @include c-csky.texi
1147 @c ended inside the included file
1148 @end ifset
1150 @end ifset
1152 @ifset D10V
1153 The following options are available when @value{AS} is configured for
1154 a D10V processor.
1155 @table @gcctabopt
1156 @cindex D10V optimization
1157 @cindex optimization, D10V
1158 @item -O
1159 Optimize output by parallelizing instructions.
1160 @end table
1161 @end ifset
1163 @ifset D30V
1164 The following options are available when @value{AS} is configured for a D30V
1165 processor.
1166 @table @gcctabopt
1167 @cindex D30V optimization
1168 @cindex optimization, D30V
1169 @item -O
1170 Optimize output by parallelizing instructions.
1172 @cindex D30V nops
1173 @item -n
1174 Warn when nops are generated.
1176 @cindex D30V nops after 32-bit multiply
1177 @item -N
1178 Warn when a nop after a 32-bit multiply instruction is generated.
1179 @end table
1180 @end ifset
1181 @c man end
1183 @ifset EPIPHANY
1184 The following options are available when @value{AS} is configured for the
1185 Adapteva EPIPHANY series.
1187 @ifclear man
1188 @xref{Epiphany Options}, for the options available when @value{AS} is
1189 configured for an Epiphany processor.
1190 @end ifclear
1192 @ifset man
1193 @c man begin OPTIONS
1194 The following options are available when @value{AS} is configured for
1195 an Epiphany processor.
1196 @c man end
1197 @c man begin INCLUDE
1198 @include c-epiphany.texi
1199 @c ended inside the included file
1200 @end ifset
1202 @end ifset
1204 @ifset H8300
1206 @ifclear man
1207 @xref{H8/300 Options}, for the options available when @value{AS} is configured
1208 for an H8/300 processor.
1209 @end ifclear
1211 @ifset man
1212 @c man begin OPTIONS
1213 The following options are available when @value{AS} is configured for an H8/300
1214 processor.
1215 @c man end
1216 @c man begin INCLUDE
1217 @include c-h8300.texi
1218 @c ended inside the included file
1219 @end ifset
1221 @end ifset
1223 @ifset I80386
1225 @ifclear man
1226 @xref{i386-Options}, for the options available when @value{AS} is
1227 configured for an i386 processor.
1228 @end ifclear
1230 @ifset man
1231 @c man begin OPTIONS
1232 The following options are available when @value{AS} is configured for
1233 an i386 processor.
1234 @c man end
1235 @c man begin INCLUDE
1236 @include c-i386.texi
1237 @c ended inside the included file
1238 @end ifset
1240 @end ifset
1242 @c man begin OPTIONS
1243 @ifset IP2K
1244 The following options are available when @value{AS} is configured for the
1245 Ubicom IP2K series.
1247 @table @gcctabopt
1249 @item -mip2022ext
1250 Specifies that the extended IP2022 instructions are allowed.
1252 @item -mip2022
1253 Restores the default behaviour, which restricts the permitted instructions to
1254 just the basic IP2022 ones.
1256 @end table
1257 @end ifset
1259 @ifset M32C
1260 The following options are available when @value{AS} is configured for the
1261 Renesas M32C and M16C processors.
1263 @table @gcctabopt
1265 @item -m32c
1266 Assemble M32C instructions.
1268 @item -m16c
1269 Assemble M16C instructions (the default).
1271 @item -relax
1272 Enable support for link-time relaxations.
1274 @item -h-tick-hex
1275 Support H'00 style hex constants in addition to 0x00 style.
1277 @end table
1278 @end ifset
1280 @ifset M32R
1281 The following options are available when @value{AS} is configured for the
1282 Renesas M32R (formerly Mitsubishi M32R) series.
1284 @table @gcctabopt
1286 @item --m32rx
1287 Specify which processor in the M32R family is the target.  The default
1288 is normally the M32R, but this option changes it to the M32RX.
1290 @item --warn-explicit-parallel-conflicts or --Wp
1291 Produce warning messages when questionable parallel constructs are
1292 encountered.
1294 @item --no-warn-explicit-parallel-conflicts or --Wnp
1295 Do not produce warning messages when questionable parallel constructs are
1296 encountered.
1298 @end table
1299 @end ifset
1301 @ifset M680X0
1302 The following options are available when @value{AS} is configured for the
1303 Motorola 68000 series.
1305 @table @gcctabopt
1307 @item -l
1308 Shorten references to undefined symbols, to one word instead of two.
1310 @item -m68000 | -m68008 | -m68010 | -m68020 | -m68030
1311 @itemx | -m68040 | -m68060 | -m68302 | -m68331 | -m68332
1312 @itemx | -m68333 | -m68340 | -mcpu32 | -m5200
1313 Specify what processor in the 68000 family is the target.  The default
1314 is normally the 68020, but this can be changed at configuration time.
1316 @item -m68881 | -m68882 | -mno-68881 | -mno-68882
1317 The target machine does (or does not) have a floating-point coprocessor.
1318 The default is to assume a coprocessor for 68020, 68030, and cpu32.  Although
1319 the basic 68000 is not compatible with the 68881, a combination of the
1320 two can be specified, since it's possible to do emulation of the
1321 coprocessor instructions with the main processor.
1323 @item -m68851 | -mno-68851
1324 The target machine does (or does not) have a memory-management
1325 unit coprocessor.  The default is to assume an MMU for 68020 and up.
1327 @end table
1328 @end ifset
1330 @ifset NIOSII
1332 @ifclear man
1333 @xref{Nios II Options}, for the options available when @value{AS} is configured
1334 for an Altera Nios II processor.
1335 @end ifclear
1337 @ifset man
1338 @c man begin OPTIONS
1339 The following options are available when @value{AS} is configured for an
1340 Altera Nios II processor.
1341 @c man end
1342 @c man begin INCLUDE
1343 @include c-nios2.texi
1344 @c ended inside the included file
1345 @end ifset
1346 @end ifset
1348 @ifset PDP11
1350 For details about the PDP-11 machine dependent features options,
1351 see @ref{PDP-11-Options}.
1353 @table @gcctabopt
1354 @item -mpic | -mno-pic
1355 Generate position-independent (or position-dependent) code.  The
1356 default is @option{-mpic}.
1358 @item -mall
1359 @itemx -mall-extensions
1360 Enable all instruction set extensions.  This is the default.
1362 @item -mno-extensions
1363 Disable all instruction set extensions.
1365 @item -m@var{extension} | -mno-@var{extension}
1366 Enable (or disable) a particular instruction set extension.
1368 @item -m@var{cpu}
1369 Enable the instruction set extensions supported by a particular CPU, and
1370 disable all other extensions.
1372 @item -m@var{machine}
1373 Enable the instruction set extensions supported by a particular machine
1374 model, and disable all other extensions.
1375 @end table
1377 @end ifset
1379 @ifset PJ
1380 The following options are available when @value{AS} is configured for
1381 a picoJava processor.
1383 @table @gcctabopt
1385 @cindex PJ endianness
1386 @cindex endianness, PJ
1387 @cindex big endian output, PJ
1388 @item -mb
1389 Generate ``big endian'' format output.
1391 @cindex little endian output, PJ
1392 @item -ml
1393 Generate ``little endian'' format output.
1395 @end table
1396 @end ifset
1398 @ifset PRU
1400 @ifclear man
1401 @xref{PRU Options}, for the options available when @value{AS} is configured
1402 for a PRU processor.
1403 @end ifclear
1405 @ifset man
1406 @c man begin OPTIONS
1407 The following options are available when @value{AS} is configured for a
1408 PRU processor.
1409 @c man end
1410 @c man begin INCLUDE
1411 @include c-pru.texi
1412 @c ended inside the included file
1413 @end ifset
1414 @end ifset
1416 @ifset M68HC11
1417 The following options are available when @value{AS} is configured for the
1418 Motorola 68HC11 or 68HC12 series.
1420 @table @gcctabopt
1422 @item -m68hc11 | -m68hc12 | -m68hcs12 | -mm9s12x | -mm9s12xg
1423 Specify what processor is the target.  The default is
1424 defined by the configuration option when building the assembler.
1426 @item --xgate-ramoffset
1427 Instruct the linker to offset RAM addresses from S12X address space into
1428 XGATE address space.
1430 @item -mshort
1431 Specify to use the 16-bit integer ABI.
1433 @item -mlong
1434 Specify to use the 32-bit integer ABI.
1436 @item -mshort-double
1437 Specify to use the 32-bit double ABI.
1439 @item -mlong-double
1440 Specify to use the 64-bit double ABI.
1442 @item --force-long-branches
1443 Relative branches are turned into absolute ones. This concerns
1444 conditional branches, unconditional branches and branches to a
1445 sub routine.
1447 @item -S | --short-branches
1448 Do not turn relative branches into absolute ones
1449 when the offset is out of range.
1451 @item --strict-direct-mode
1452 Do not turn the direct addressing mode into extended addressing mode
1453 when the instruction does not support direct addressing mode.
1455 @item --print-insn-syntax
1456 Print the syntax of instruction in case of error.
1458 @item --print-opcodes
1459 Print the list of instructions with syntax and then exit.
1461 @item --generate-example
1462 Print an example of instruction for each possible instruction and then exit.
1463 This option is only useful for testing @command{@value{AS}}.
1465 @end table
1466 @end ifset
1468 @ifset SPARC
1469 The following options are available when @command{@value{AS}} is configured
1470 for the SPARC architecture:
1472 @table @gcctabopt
1473 @item -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
1474 @itemx -Av8plus | -Av8plusa | -Av9 | -Av9a
1475 Explicitly select a variant of the SPARC architecture.
1477 @samp{-Av8plus} and @samp{-Av8plusa} select a 32 bit environment.
1478 @samp{-Av9} and @samp{-Av9a} select a 64 bit environment.
1480 @samp{-Av8plusa} and @samp{-Av9a} enable the SPARC V9 instruction set with
1481 UltraSPARC extensions.
1483 @item -xarch=v8plus | -xarch=v8plusa
1484 For compatibility with the Solaris v9 assembler.  These options are
1485 equivalent to -Av8plus and -Av8plusa, respectively.
1487 @item -bump
1488 Warn when the assembler switches to another architecture.
1489 @end table
1490 @end ifset
1492 @ifset TIC54X
1493 The following options are available when @value{AS} is configured for the 'c54x
1494 architecture.
1496 @table @gcctabopt
1497 @item -mfar-mode
1498 Enable extended addressing mode.  All addresses and relocations will assume
1499 extended addressing (usually 23 bits).
1500 @item -mcpu=@var{CPU_VERSION}
1501 Sets the CPU version being compiled for.
1502 @item -merrors-to-file @var{FILENAME}
1503 Redirect error output to a file, for broken systems which don't support such
1504 behaviour in the shell.
1505 @end table
1506 @end ifset
1508 @ifset MIPS
1509 @c man begin OPTIONS
1510 The following options are available when @value{AS} is configured for
1511 a MIPS processor.
1513 @table @gcctabopt
1514 @item -G @var{num}
1515 This option sets the largest size of an object that can be referenced
1516 implicitly with the @code{gp} register.  It is only accepted for targets that
1517 use ECOFF format, such as a DECstation running Ultrix.  The default value is 8.
1519 @cindex MIPS endianness
1520 @cindex endianness, MIPS
1521 @cindex big endian output, MIPS
1522 @item -EB
1523 Generate ``big endian'' format output.
1525 @cindex little endian output, MIPS
1526 @item -EL
1527 Generate ``little endian'' format output.
1529 @cindex MIPS ISA
1530 @item -mips1
1531 @itemx -mips2
1532 @itemx -mips3
1533 @itemx -mips4
1534 @itemx -mips5
1535 @itemx -mips32
1536 @itemx -mips32r2
1537 @itemx -mips32r3
1538 @itemx -mips32r5
1539 @itemx -mips32r6
1540 @itemx -mips64
1541 @itemx -mips64r2
1542 @itemx -mips64r3
1543 @itemx -mips64r5
1544 @itemx -mips64r6
1545 Generate code for a particular MIPS Instruction Set Architecture level.
1546 @samp{-mips1} is an alias for @samp{-march=r3000}, @samp{-mips2} is an
1547 alias for @samp{-march=r6000}, @samp{-mips3} is an alias for
1548 @samp{-march=r4000} and @samp{-mips4} is an alias for @samp{-march=r8000}.
1549 @samp{-mips5}, @samp{-mips32}, @samp{-mips32r2}, @samp{-mips32r3},
1550 @samp{-mips32r5}, @samp{-mips32r6}, @samp{-mips64}, @samp{-mips64r2},
1551 @samp{-mips64r3}, @samp{-mips64r5}, and @samp{-mips64r6} correspond to generic
1552 MIPS V, MIPS32, MIPS32 Release 2, MIPS32 Release 3, MIPS32 Release 5, MIPS32
1553 Release 6, MIPS64, MIPS64 Release 2, MIPS64 Release 3, MIPS64 Release 5, and
1554 MIPS64 Release 6 ISA processors, respectively.
1556 @item -march=@var{cpu}
1557 Generate code for a particular MIPS CPU.
1559 @item -mtune=@var{cpu}
1560 Schedule and tune for a particular MIPS CPU.
1562 @item -mfix7000
1563 @itemx -mno-fix7000
1564 Cause nops to be inserted if the read of the destination register
1565 of an mfhi or mflo instruction occurs in the following two instructions.
1567 @item -mfix-rm7000
1568 @itemx -mno-fix-rm7000
1569 Cause nops to be inserted if a dmult or dmultu instruction is
1570 followed by a load instruction.
1572 @item -mfix-r5900
1573 @itemx -mno-fix-r5900
1574 Do not attempt to schedule the preceding instruction into the delay slot
1575 of a branch instruction placed at the end of a short loop of six
1576 instructions or fewer and always schedule a @code{nop} instruction there
1577 instead.  The short loop bug under certain conditions causes loops to
1578 execute only once or twice, due to a hardware bug in the R5900 chip.
1580 @item -mdebug
1581 @itemx -no-mdebug
1582 Cause stabs-style debugging output to go into an ECOFF-style .mdebug
1583 section instead of the standard ELF .stabs sections.
1585 @item -mpdr
1586 @itemx -mno-pdr
1587 Control generation of @code{.pdr} sections.
1589 @item -mgp32
1590 @itemx -mfp32
1591 The register sizes are normally inferred from the ISA and ABI, but these
1592 flags force a certain group of registers to be treated as 32 bits wide at
1593 all times.  @samp{-mgp32} controls the size of general-purpose registers
1594 and @samp{-mfp32} controls the size of floating-point registers.
1596 @item -mgp64
1597 @itemx -mfp64
1598 The register sizes are normally inferred from the ISA and ABI, but these
1599 flags force a certain group of registers to be treated as 64 bits wide at
1600 all times.  @samp{-mgp64} controls the size of general-purpose registers
1601 and @samp{-mfp64} controls the size of floating-point registers.
1603 @item -mfpxx
1604 The register sizes are normally inferred from the ISA and ABI, but using
1605 this flag in combination with @samp{-mabi=32} enables an ABI variant
1606 which will operate correctly with floating-point registers which are
1607 32 or 64 bits wide.
1609 @item -modd-spreg
1610 @itemx -mno-odd-spreg
1611 Enable use of floating-point operations on odd-numbered single-precision
1612 registers when supported by the ISA.  @samp{-mfpxx} implies
1613 @samp{-mno-odd-spreg}, otherwise the default is @samp{-modd-spreg}.
1615 @item -mips16
1616 @itemx -no-mips16
1617 Generate code for the MIPS 16 processor.  This is equivalent to putting
1618 @code{.module mips16} at the start of the assembly file.  @samp{-no-mips16}
1619 turns off this option.
1621 @item -mmips16e2
1622 @itemx -mno-mips16e2
1623 Enable the use of MIPS16e2 instructions in MIPS16 mode.  This is equivalent
1624 to putting @code{.module mips16e2} at the start of the assembly file.
1625 @samp{-mno-mips16e2} turns off this option.
1627 @item -mmicromips
1628 @itemx -mno-micromips
1629 Generate code for the microMIPS processor.  This is equivalent to putting
1630 @code{.module micromips} at the start of the assembly file.
1631 @samp{-mno-micromips} turns off this option.  This is equivalent to putting
1632 @code{.module nomicromips} at the start of the assembly file.
1634 @item -msmartmips
1635 @itemx -mno-smartmips
1636 Enables the SmartMIPS extension to the MIPS32 instruction set.  This is
1637 equivalent to putting @code{.module smartmips} at the start of the assembly
1638 file.  @samp{-mno-smartmips} turns off this option.
1640 @item -mips3d
1641 @itemx -no-mips3d
1642 Generate code for the MIPS-3D Application Specific Extension.
1643 This tells the assembler to accept MIPS-3D instructions.
1644 @samp{-no-mips3d} turns off this option.
1646 @item -mdmx
1647 @itemx -no-mdmx
1648 Generate code for the MDMX Application Specific Extension.
1649 This tells the assembler to accept MDMX instructions.
1650 @samp{-no-mdmx} turns off this option.
1652 @item -mdsp
1653 @itemx -mno-dsp
1654 Generate code for the DSP Release 1 Application Specific Extension.
1655 This tells the assembler to accept DSP Release 1 instructions.
1656 @samp{-mno-dsp} turns off this option.
1658 @item -mdspr2
1659 @itemx -mno-dspr2
1660 Generate code for the DSP Release 2 Application Specific Extension.
1661 This option implies @samp{-mdsp}.
1662 This tells the assembler to accept DSP Release 2 instructions.
1663 @samp{-mno-dspr2} turns off this option.
1665 @item -mdspr3
1666 @itemx -mno-dspr3
1667 Generate code for the DSP Release 3 Application Specific Extension.
1668 This option implies @samp{-mdsp} and @samp{-mdspr2}.
1669 This tells the assembler to accept DSP Release 3 instructions.
1670 @samp{-mno-dspr3} turns off this option.
1672 @item -mmsa
1673 @itemx -mno-msa
1674 Generate code for the MIPS SIMD Architecture Extension.
1675 This tells the assembler to accept MSA instructions.
1676 @samp{-mno-msa} turns off this option.
1678 @item -mxpa
1679 @itemx -mno-xpa
1680 Generate code for the MIPS eXtended Physical Address (XPA) Extension.
1681 This tells the assembler to accept XPA instructions.
1682 @samp{-mno-xpa} turns off this option.
1684 @item -mmt
1685 @itemx -mno-mt
1686 Generate code for the MT Application Specific Extension.
1687 This tells the assembler to accept MT instructions.
1688 @samp{-mno-mt} turns off this option.
1690 @item -mmcu
1691 @itemx -mno-mcu
1692 Generate code for the MCU Application Specific Extension.
1693 This tells the assembler to accept MCU instructions.
1694 @samp{-mno-mcu} turns off this option.
1696 @item -mcrc
1697 @itemx -mno-crc
1698 Generate code for the MIPS cyclic redundancy check (CRC) Application
1699 Specific Extension.  This tells the assembler to accept CRC instructions.
1700 @samp{-mno-crc} turns off this option.
1702 @item -mginv
1703 @itemx -mno-ginv
1704 Generate code for the Global INValidate (GINV) Application Specific
1705 Extension.  This tells the assembler to accept GINV instructions.
1706 @samp{-mno-ginv} turns off this option.
1708 @item -mloongson-mmi
1709 @itemx -mno-loongson-mmi
1710 Generate code for the Loongson MultiMedia extensions Instructions (MMI)
1711 Application Specific Extension.  This tells the assembler to accept MMI
1712 instructions.
1713 @samp{-mno-loongson-mmi} turns off this option.
1715 @item -mloongson-cam
1716 @itemx -mno-loongson-cam
1717 Generate code for the Loongson Content Address Memory (CAM) instructions.
1718 This tells the assembler to accept Loongson CAM instructions.
1719 @samp{-mno-loongson-cam} turns off this option.
1721 @item -mloongson-ext
1722 @itemx -mno-loongson-ext
1723 Generate code for the Loongson EXTensions (EXT) instructions.
1724 This tells the assembler to accept Loongson EXT instructions.
1725 @samp{-mno-loongson-ext} turns off this option.
1727 @item -mloongson-ext2
1728 @itemx -mno-loongson-ext2
1729 Generate code for the Loongson EXTensions R2 (EXT2) instructions.
1730 This option implies @samp{-mloongson-ext}.
1731 This tells the assembler to accept Loongson EXT2 instructions.
1732 @samp{-mno-loongson-ext2} turns off this option.
1734 @item -minsn32
1735 @itemx -mno-insn32
1736 Only use 32-bit instruction encodings when generating code for the
1737 microMIPS processor.  This option inhibits the use of any 16-bit
1738 instructions.  This is equivalent to putting @code{.set insn32} at
1739 the start of the assembly file.  @samp{-mno-insn32} turns off this
1740 option.  This is equivalent to putting @code{.set noinsn32} at the
1741 start of the assembly file.  By default @samp{-mno-insn32} is
1742 selected, allowing all instructions to be used.
1744 @item --construct-floats
1745 @itemx --no-construct-floats
1746 The @samp{--no-construct-floats} option disables the construction of
1747 double width floating point constants by loading the two halves of the
1748 value into the two single width floating point registers that make up
1749 the double width register.  By default @samp{--construct-floats} is
1750 selected, allowing construction of these floating point constants.
1752 @item --relax-branch
1753 @itemx --no-relax-branch
1754 The @samp{--relax-branch} option enables the relaxation of out-of-range
1755 branches.  By default @samp{--no-relax-branch} is selected, causing any
1756 out-of-range branches to produce an error.
1758 @item -mignore-branch-isa
1759 @itemx -mno-ignore-branch-isa
1760 Ignore branch checks for invalid transitions between ISA modes.  The
1761 semantics of branches does not provide for an ISA mode switch, so in
1762 most cases the ISA mode a branch has been encoded for has to be the
1763 same as the ISA mode of the branch's target label.  Therefore GAS has
1764 checks implemented that verify in branch assembly that the two ISA
1765 modes match.  @samp{-mignore-branch-isa} disables these checks.  By
1766 default @samp{-mno-ignore-branch-isa} is selected, causing any invalid
1767 branch requiring a transition between ISA modes to produce an error.
1769 @item -mnan=@var{encoding}
1770 Select between the IEEE 754-2008 (@option{-mnan=2008}) or the legacy
1771 (@option{-mnan=legacy}) NaN encoding format.  The latter is the default.
1773 @cindex emulation
1774 @item --emulation=@var{name}
1775 This option was formerly used to switch between ELF and ECOFF output
1776 on targets like IRIX 5 that supported both.  MIPS ECOFF support was
1777 removed in GAS 2.24, so the option now serves little purpose.
1778 It is retained for backwards compatibility.
1780 The available configuration names are: @samp{mipself}, @samp{mipslelf} and
1781 @samp{mipsbelf}.  Choosing @samp{mipself} now has no effect, since the output
1782 is always ELF.  @samp{mipslelf} and @samp{mipsbelf} select little- and
1783 big-endian output respectively, but @samp{-EL} and @samp{-EB} are now the
1784 preferred options instead.
1786 @item -nocpp
1787 @command{@value{AS}} ignores this option.  It is accepted for compatibility with
1788 the native tools.
1790 @item --trap
1791 @itemx --no-trap
1792 @itemx --break
1793 @itemx --no-break
1794 Control how to deal with multiplication overflow and division by zero.
1795 @samp{--trap} or @samp{--no-break} (which are synonyms) take a trap exception
1796 (and only work for Instruction Set Architecture level 2 and higher);
1797 @samp{--break} or @samp{--no-trap} (also synonyms, and the default) take a
1798 break exception.
1800 @item -n
1801 When this option is used, @command{@value{AS}} will issue a warning every
1802 time it generates a nop instruction from a macro.
1803 @end table
1804 @c man end
1805 @end ifset
1807 @ifset MCORE
1808 The following options are available when @value{AS} is configured for
1809 an MCore processor.
1811 @table @gcctabopt
1812 @item -jsri2bsr
1813 @itemx -nojsri2bsr
1814 Enable or disable the JSRI to BSR transformation.  By default this is enabled.
1815 The command-line option @samp{-nojsri2bsr} can be used to disable it.
1817 @item -sifilter
1818 @itemx -nosifilter
1819 Enable or disable the silicon filter behaviour.  By default this is disabled.
1820 The default can be overridden by the @samp{-sifilter} command-line option.
1822 @item -relax
1823 Alter jump instructions for long displacements.
1825 @item -mcpu=[210|340]
1826 Select the cpu type on the target hardware.  This controls which instructions
1827 can be assembled.
1829 @item -EB
1830 Assemble for a big endian target.
1832 @item -EL
1833 Assemble for a little endian target.
1835 @end table
1836 @end ifset
1837 @c man end
1839 @ifset LOONGARCH
1841 @ifclear man
1842 @xref{LoongArch-Options}, for the options available when @value{AS} is configured
1843 for a LoongArch processor.
1844 @end ifclear
1846 @ifset man
1847 @c man begin OPTIONS
1848 The following options are available when @value{AS} is configured for a
1849 LoongArch processor.
1850 @c man end
1851 @c man begin INCLUDE
1852 @include c-loongarch.texi
1853 @c ended inside the included file
1854 @end ifset
1856 @end ifset
1858 @ifset METAG
1860 @ifclear man
1861 @xref{Meta Options}, for the options available when @value{AS} is configured
1862 for a Meta processor.
1863 @end ifclear
1865 @ifset man
1866 @c man begin OPTIONS
1867 The following options are available when @value{AS} is configured for a
1868 Meta processor.
1869 @c man end
1870 @c man begin INCLUDE
1871 @include c-metag.texi
1872 @c ended inside the included file
1873 @end ifset
1875 @end ifset
1877 @c man begin OPTIONS
1878 @ifset MMIX
1879 See the info pages for documentation of the MMIX-specific options.
1880 @end ifset
1882 @ifset NDS32
1884 @ifclear man
1885 @xref{NDS32 Options}, for the options available when @value{AS} is configured
1886 for a NDS32 processor.
1887 @end ifclear
1888 @c ended inside the included file
1889 @end ifset
1891 @ifset man
1892 @c man begin OPTIONS
1893 The following options are available when @value{AS} is configured for a
1894 NDS32 processor.
1895 @c man end
1896 @c man begin INCLUDE
1897 @include c-nds32.texi
1898 @c ended inside the included file
1899 @end ifset
1901 @c man end
1902 @ifset PPC
1904 @ifclear man
1905 @xref{PowerPC-Opts}, for the options available when @value{AS} is configured
1906 for a PowerPC processor.
1907 @end ifclear
1909 @ifset man
1910 @c man begin OPTIONS
1911 The following options are available when @value{AS} is configured for a
1912 PowerPC processor.
1913 @c man end
1914 @c man begin INCLUDE
1915 @include c-ppc.texi
1916 @c ended inside the included file
1917 @end ifset
1919 @end ifset
1921 @ifset RISCV
1923 @ifclear man
1924 @xref{RISC-V-Options}, for the options available when @value{AS} is configured
1925 for a RISC-V processor.
1926 @end ifclear
1928 @ifset man
1929 @c man begin OPTIONS
1930 The following options are available when @value{AS} is configured for a
1931 RISC-V processor.
1932 @c man end
1933 @c man begin INCLUDE
1934 @include c-riscv.texi
1935 @c ended inside the included file
1936 @end ifset
1938 @end ifset
1940 @c man begin OPTIONS
1941 @ifset RX
1942 See the info pages for documentation of the RX-specific options.
1943 @end ifset
1945 @ifset S390
1946 The following options are available when @value{AS} is configured for the s390
1947 processor family.
1949 @table @gcctabopt
1950 @item -m31
1951 @itemx -m64
1952 Select the word size, either 31/32 bits or 64 bits.
1953 @item -mesa
1954 @item -mzarch
1955 Select the architecture mode, either the Enterprise System
1956 Architecture (esa) or the z/Architecture mode (zarch).
1957 @item -march=@var{processor}
1958 Specify which s390 processor variant is the target, @samp{g5} (or
1959 @samp{arch3}), @samp{g6}, @samp{z900} (or @samp{arch5}), @samp{z990} (or
1960 @samp{arch6}), @samp{z9-109}, @samp{z9-ec} (or @samp{arch7}), @samp{z10} (or
1961 @samp{arch8}), @samp{z196} (or @samp{arch9}), @samp{zEC12} (or @samp{arch10}),
1962 @samp{z13} (or @samp{arch11}), @samp{z14} (or @samp{arch12}), @samp{z15}
1963 (or @samp{arch13}), or @samp{z16} (or @samp{arch14}).
1964 @item -mregnames
1965 @itemx -mno-regnames
1966 Allow or disallow symbolic names for registers.
1967 @item -mwarn-areg-zero
1968 Warn whenever the operand for a base or index register has been specified
1969 but evaluates to zero.
1970 @item -mwarn-regtype-mismatch=strict
1971 @itemx -mwarn-regtype-mismatch=relaxed
1972 @itemx -mwarn-regtype-mismatch=no
1973 @itemx -mno-warn-regtype-mismatch
1974 Controls whether the assembler performs register name type checks and generates
1975 a warning message in case of a mismatch with the operand register type.
1976 The default (which can be restored by using the @option{relaxed} argument) is
1977 to perform relaxed register name type checks, which allow floating point
1978 register (FPR) names %f0 to %f15 to be specified as argument to vector register
1979 (VR) operands and vector register (VR) names %v0 to %v15 to be specified as
1980 argument to floating point register (FPR) operands.  This is acceptable as the
1981 FPR are embedded into the lower half of the VR.
1982 Using the @option{strict} argument strict register name type checks are
1983 performed.
1984 The @option{no} argument, which is equivalent to
1985 @samp{-mno-warn-regtype-mismatch}, disables any register name type checks.
1986 @end table
1987 @end ifset
1988 @c man end
1990 @ifset TIC6X
1992 @ifclear man
1993 @xref{TIC6X Options}, for the options available when @value{AS} is configured
1994 for a TMS320C6000 processor.
1995 @end ifclear
1997 @ifset man
1998 @c man begin OPTIONS
1999 The following options are available when @value{AS} is configured for a
2000 TMS320C6000 processor.
2001 @c man end
2002 @c man begin INCLUDE
2003 @include c-tic6x.texi
2004 @c ended inside the included file
2005 @end ifset
2007 @end ifset
2009 @ifset TILEGX
2011 @ifclear man
2012 @xref{TILE-Gx Options}, for the options available when @value{AS} is configured
2013 for a TILE-Gx processor.
2014 @end ifclear
2016 @ifset man
2017 @c man begin OPTIONS
2018 The following options are available when @value{AS} is configured for a TILE-Gx
2019 processor.
2020 @c man end
2021 @c man begin INCLUDE
2022 @include c-tilegx.texi
2023 @c ended inside the included file
2024 @end ifset
2026 @end ifset
2028 @ifset VISIUM
2030 @ifclear man
2031 @xref{Visium Options}, for the options available when @value{AS} is configured
2032 for a Visium processor.
2033 @end ifclear
2035 @ifset man
2036 @c man begin OPTIONS
2037 The following option is available when @value{AS} is configured for a Visium
2038 processor.
2039 @c man end
2040 @c man begin INCLUDE
2041 @include c-visium.texi
2042 @c ended inside the included file
2043 @end ifset
2045 @end ifset
2047 @ifset XTENSA
2049 @ifclear man
2050 @xref{Xtensa Options}, for the options available when @value{AS} is configured
2051 for an Xtensa processor.
2052 @end ifclear
2054 @ifset man
2055 @c man begin OPTIONS
2056 The following options are available when @value{AS} is configured for an
2057 Xtensa processor.
2058 @c man end
2059 @c man begin INCLUDE
2060 @include c-xtensa.texi
2061 @c ended inside the included file
2062 @end ifset
2064 @end ifset
2066 @ifset Z80
2068 @ifclear man
2069 @xref{Z80 Options}, for the options available when @value{AS} is configured
2070 for an Z80 processor.
2071 @end ifclear
2073 @ifset man
2074 @c man begin OPTIONS
2075 The following options are available when @value{AS} is configured for an
2076 Z80 processor.
2077 @c man end
2078 @c man begin INCLUDE
2079 @include c-z80.texi
2080 @c ended inside the included file
2081 @end ifset
2083 @end ifset
2085 @menu
2086 * Manual::                      Structure of this Manual
2087 * GNU Assembler::               The GNU Assembler
2088 * Object Formats::              Object File Formats
2089 * Command Line::                Command Line
2090 * Input Files::                 Input Files
2091 * Object::                      Output (Object) File
2092 * Errors::                      Error and Warning Messages
2093 @end menu
2095 @node Manual
2096 @section Structure of this Manual
2098 @cindex manual, structure and purpose
2099 This manual is intended to describe what you need to know to use
2100 @sc{gnu} @command{@value{AS}}.  We cover the syntax expected in source files, including
2101 notation for symbols, constants, and expressions; the directives that
2102 @command{@value{AS}} understands; and of course how to invoke @command{@value{AS}}.
2104 @ifclear GENERIC
2105 We also cover special features in the @value{TARGET}
2106 configuration of @command{@value{AS}}, including assembler directives.
2107 @end ifclear
2108 @ifset GENERIC
2109 This manual also describes some of the machine-dependent features of
2110 various flavors of the assembler.
2111 @end ifset
2113 @cindex machine instructions (not covered)
2114 On the other hand, this manual is @emph{not} intended as an introduction
2115 to programming in assembly language---let alone programming in general!
2116 In a similar vein, we make no attempt to introduce the machine
2117 architecture; we do @emph{not} describe the instruction set, standard
2118 mnemonics, registers or addressing modes that are standard to a
2119 particular architecture.
2120 @ifset GENERIC
2121 You may want to consult the manufacturer's
2122 machine architecture manual for this information.
2123 @end ifset
2124 @ifclear GENERIC
2125 @ifset H8/300
2126 For information on the H8/300 machine instruction set, see @cite{H8/300
2127 Series Programming Manual}.  For the H8/300H, see @cite{H8/300H Series
2128 Programming Manual} (Renesas).
2129 @end ifset
2130 @ifset SH
2131 For information on the Renesas (formerly Hitachi) / SuperH SH machine instruction set,
2132 see @cite{SH-Microcomputer User's Manual} (Renesas) or
2133 @cite{SH-4 32-bit CPU Core Architecture} (SuperH) and
2134 @cite{SuperH (SH) 64-Bit RISC Series} (SuperH).
2135 @end ifset
2136 @ifset Z8000
2137 For information on the Z8000 machine instruction set, see @cite{Z8000 CPU Technical Manual}
2138 @end ifset
2139 @end ifclear
2141 @c I think this is premature---doc@cygnus.com, 17jan1991
2142 @ignore
2143 Throughout this manual, we assume that you are running @dfn{GNU},
2144 the portable operating system from the @dfn{Free Software
2145 Foundation, Inc.}.  This restricts our attention to certain kinds of
2146 computer (in particular, the kinds of computers that @sc{gnu} can run on);
2147 once this assumption is granted examples and definitions need less
2148 qualification.
2150 @command{@value{AS}} is part of a team of programs that turn a high-level
2151 human-readable series of instructions into a low-level
2152 computer-readable series of instructions.  Different versions of
2153 @command{@value{AS}} are used for different kinds of computer.
2154 @end ignore
2156 @c There used to be a section "Terminology" here, which defined
2157 @c "contents", "byte", "word", and "long".  Defining "word" to any
2158 @c particular size is confusing when the .word directive may generate 16
2159 @c bits on one machine and 32 bits on another; in general, for the user
2160 @c version of this manual, none of these terms seem essential to define.
2161 @c They were used very little even in the former draft of the manual;
2162 @c this draft makes an effort to avoid them (except in names of
2163 @c directives).
2165 @node GNU Assembler
2166 @section The GNU Assembler
2168 @c man begin DESCRIPTION
2170 @sc{gnu} @command{as} is really a family of assemblers.
2171 @ifclear GENERIC
2172 This manual describes @command{@value{AS}}, a member of that family which is
2173 configured for the @value{TARGET} architectures.
2174 @end ifclear
2175 If you use (or have used) the @sc{gnu} assembler on one architecture, you
2176 should find a fairly similar environment when you use it on another
2177 architecture.  Each version has much in common with the others,
2178 including object file formats, most assembler directives (often called
2179 @dfn{pseudo-ops}) and assembler syntax.
2181 @cindex purpose of @sc{gnu} assembler
2182 @command{@value{AS}} is primarily intended to assemble the output of the
2183 @sc{gnu} C compiler @code{@value{GCC}} for use by the linker
2184 @code{@value{LD}}.  Nevertheless, we've tried to make @command{@value{AS}}
2185 assemble correctly everything that other assemblers for the same
2186 machine would assemble.
2187 @ifset VAX
2188 Any exceptions are documented explicitly (@pxref{Machine Dependencies}).
2189 @end ifset
2190 @ifset M680X0
2191 @c This remark should appear in generic version of manual; assumption
2192 @c here is that generic version sets M680x0.
2193 This doesn't mean @command{@value{AS}} always uses the same syntax as another
2194 assembler for the same architecture; for example, we know of several
2195 incompatible versions of 680x0 assembly language syntax.
2196 @end ifset
2198 @c man end
2200 Unlike older assemblers, @command{@value{AS}} is designed to assemble a source
2201 program in one pass of the source file.  This has a subtle impact on the
2202 @kbd{.org} directive (@pxref{Org,,@code{.org}}).
2204 @node Object Formats
2205 @section Object File Formats
2207 @cindex object file format
2208 The @sc{gnu} assembler can be configured to produce several alternative
2209 object file formats.  For the most part, this does not affect how you
2210 write assembly language programs; but directives for debugging symbols
2211 are typically different in different file formats.  @xref{Symbol
2212 Attributes,,Symbol Attributes}.
2213 @ifclear GENERIC
2214 @ifclear MULTI-OBJ
2215 For the @value{TARGET} target, @command{@value{AS}} is configured to produce
2216 @value{OBJ-NAME} format object files.
2217 @end ifclear
2218 @c The following should exhaust all configs that set MULTI-OBJ, ideally
2219 @ifset HPPA
2220 On the @value{TARGET}, @command{@value{AS}} can be configured to produce either
2221 SOM or ELF format object files.
2222 @end ifset
2223 @end ifclear
2225 @node Command Line
2226 @section Command Line
2228 @cindex command line conventions
2230 After the program name @command{@value{AS}}, the command line may contain
2231 options and file names.  Options may appear in any order, and may be
2232 before, after, or between file names.  The order of file names is
2233 significant.
2235 @cindex standard input, as input file
2236 @kindex --
2237 @file{--} (two hyphens) by itself names the standard input file
2238 explicitly, as one of the files for @command{@value{AS}} to assemble.
2240 @cindex options, command line
2241 Except for @samp{--} any command-line argument that begins with a
2242 hyphen (@samp{-}) is an option.  Each option changes the behavior of
2243 @command{@value{AS}}.  No option changes the way another option works.  An
2244 option is a @samp{-} followed by one or more letters; the case of
2245 the letter is important.   All options are optional.
2247 Some options expect exactly one file name to follow them.  The file
2248 name may either immediately follow the option's letter (compatible
2249 with older assemblers) or it may be the next command argument (@sc{gnu}
2250 standard).  These two command lines are equivalent:
2252 @smallexample
2253 @value{AS} -o my-object-file.o mumble.s
2254 @value{AS} -omy-object-file.o mumble.s
2255 @end smallexample
2257 @node Input Files
2258 @section Input Files
2260 @cindex input
2261 @cindex source program
2262 @cindex files, input
2263 We use the phrase @dfn{source program}, abbreviated @dfn{source}, to
2264 describe the program input to one run of @command{@value{AS}}.  The program may
2265 be in one or more files; how the source is partitioned into files
2266 doesn't change the meaning of the source.
2268 @c I added "con" prefix to "catenation" just to prove I can overcome my
2269 @c APL training...   doc@cygnus.com
2270 The source program is a concatenation of the text in all the files, in the
2271 order specified.
2273 @c man begin DESCRIPTION
2274 Each time you run @command{@value{AS}} it assembles exactly one source
2275 program.  The source program is made up of one or more files.
2276 (The standard input is also a file.)
2278 You give @command{@value{AS}} a command line that has zero or more input file
2279 names.  The input files are read (from left file name to right).  A
2280 command-line argument (in any position) that has no special meaning
2281 is taken to be an input file name.
2283 If you give @command{@value{AS}} no file names it attempts to read one input file
2284 from the @command{@value{AS}} standard input, which is normally your terminal.  You
2285 may have to type @key{ctl-D} to tell @command{@value{AS}} there is no more program
2286 to assemble.
2288 Use @samp{--} if you need to explicitly name the standard input file
2289 in your command line.
2291 If the source is empty, @command{@value{AS}} produces a small, empty object
2292 file.
2294 @c man end
2296 @subheading Filenames and Line-numbers
2298 @cindex input file linenumbers
2299 @cindex line numbers, in input files
2300 There are two ways of locating a line in the input file (or files) and
2301 either may be used in reporting error messages.  One way refers to a line
2302 number in a physical file; the other refers to a line number in a
2303 ``logical'' file.  @xref{Errors, ,Error and Warning Messages}.
2305 @dfn{Physical files} are those files named in the command line given
2306 to @command{@value{AS}}.
2308 @dfn{Logical files} are simply names declared explicitly by assembler
2309 directives; they bear no relation to physical files.  Logical file names help
2310 error messages reflect the original source file, when @command{@value{AS}} source
2311 is itself synthesized from other files.  @command{@value{AS}} understands the
2312 @samp{#} directives emitted by the @code{@value{GCC}} preprocessor.  See also
2313 @ref{File,,@code{.file}}.
2315 @node Object
2316 @section Output (Object) File
2318 @cindex object file
2319 @cindex output file
2320 @kindex a.out
2321 @kindex .o
2322 Every time you run @command{@value{AS}} it produces an output file, which is
2323 your assembly language program translated into numbers.  This file
2324 is the object file.  Its default name is @code{a.out}.
2325 You can give it another name by using the @option{-o} option.  Conventionally,
2326 object file names end with @file{.o}.  The default name is used for historical
2327 reasons: older assemblers were capable of assembling self-contained programs
2328 directly into a runnable program.  (For some formats, this isn't currently
2329 possible, but it can be done for the @code{a.out} format.)
2331 @cindex linker
2332 @kindex ld
2333 The object file is meant for input to the linker @code{@value{LD}}.  It contains
2334 assembled program code, information to help @code{@value{LD}} integrate
2335 the assembled program into a runnable file, and (optionally) symbolic
2336 information for the debugger.
2338 @c link above to some info file(s) like the description of a.out.
2339 @c don't forget to describe @sc{gnu} info as well as Unix lossage.
2341 @node Errors
2342 @section Error and Warning Messages
2344 @c man begin DESCRIPTION
2346 @cindex error messages
2347 @cindex warning messages
2348 @cindex messages from assembler
2349 @command{@value{AS}} may write warnings and error messages to the standard error
2350 file (usually your terminal).  This should not happen when  a compiler
2351 runs @command{@value{AS}} automatically.  Warnings report an assumption made so
2352 that @command{@value{AS}} could keep assembling a flawed program; errors report a
2353 grave problem that stops the assembly.
2355 @c man end
2357 @cindex format of warning messages
2358 Warning messages have the format
2360 @smallexample
2361 file_name:@b{NNN}:Warning Message Text
2362 @end smallexample
2364 @noindent
2365 @cindex file names and line numbers, in warnings/errors
2366 (where @b{NNN} is a line number).  If both a logical file name
2367 (@pxref{File,,@code{.file}}) and a logical line number
2368 @ifset GENERIC
2369 (@pxref{Line,,@code{.line}})
2370 @end ifset
2371 have been given then they will be used, otherwise the file name and line number
2372 in the current assembler source file will be used.  The message text is
2373 intended to be self explanatory (in the grand Unix tradition).
2375 Note the file name must be set via the logical version of the @code{.file}
2376 directive, not the DWARF2 version of the @code{.file} directive.  For example:
2378 @smallexample
2379   .file 2 "bar.c"
2380      error_assembler_source
2381   .file "foo.c"
2382   .line 30
2383       error_c_source
2384 @end smallexample
2386 produces this output:
2388 @smallexample
2389   Assembler messages:
2390   asm.s:2: Error: no such instruction: `error_assembler_source'
2391   foo.c:31: Error: no such instruction: `error_c_source'
2392 @end smallexample
2394 @cindex format of error messages
2395 Error messages have the format
2397 @smallexample
2398 file_name:@b{NNN}:FATAL:Error Message Text
2399 @end smallexample
2401 The file name and line number are derived as for warning
2402 messages.  The actual message text may be rather less explanatory
2403 because many of them aren't supposed to happen.
2405 @node Invoking
2406 @chapter Command-Line Options
2408 @cindex options, all versions of assembler
2409 This chapter describes command-line options available in @emph{all}
2410 versions of the @sc{gnu} assembler; see @ref{Machine Dependencies},
2411 for options specific
2412 @ifclear GENERIC
2413 to the @value{TARGET} target.
2414 @end ifclear
2415 @ifset GENERIC
2416 to particular machine architectures.
2417 @end ifset
2419 @c man begin DESCRIPTION
2421 If you are invoking @command{@value{AS}} via the @sc{gnu} C compiler,
2422 you can use the @samp{-Wa} option to pass arguments through to the assembler.
2423 The assembler arguments must be separated from each other (and the @samp{-Wa})
2424 by commas.  For example:
2426 @smallexample
2427 gcc -c -g -O -Wa,-alh,-L file.c
2428 @end smallexample
2430 @noindent
2431 This passes two options to the assembler: @samp{-alh} (emit a listing to
2432 standard output with high-level and assembly source) and @samp{-L} (retain
2433 local symbols in the symbol table).
2435 Usually you do not need to use this @samp{-Wa} mechanism, since many compiler
2436 command-line options are automatically passed to the assembler by the compiler.
2437 (You can call the @sc{gnu} compiler driver with the @samp{-v} option to see
2438 precisely what options it passes to each compilation pass, including the
2439 assembler.)
2441 @c man end
2443 @menu
2444 * a::             -a[cdghilns] enable listings
2445 * alternate::     --alternate enable alternate macro syntax
2446 * D::             -D for compatibility and debugging
2447 * f::             -f to work faster
2448 * I::             -I for .include search path
2449 @ifclear DIFF-TBL-KLUGE
2450 * K::             -K for compatibility
2451 @end ifclear
2452 @ifset DIFF-TBL-KLUGE
2453 * K::             -K for difference tables
2454 @end ifset
2456 * L::             -L to retain local symbols
2457 * listing::       --listing-XXX to configure listing output
2458 * M::             -M or --mri to assemble in MRI compatibility mode
2459 * MD::            --MD for dependency tracking
2460 * no-pad-sections:: --no-pad-sections to stop section padding
2461 * o::             -o to name the object file
2462 * R::             -R to join data and text sections
2463 * statistics::    --statistics to see statistics about assembly
2464 * traditional-format:: --traditional-format for compatible output
2465 * v::             -v to announce version
2466 * W::             -W, --no-warn, --warn, --fatal-warnings to control warnings
2467 * Z::             -Z to make object file even after errors
2468 @end menu
2470 @node a
2471 @section Enable Listings: @option{-a[cdghilns]}
2473 @kindex -a
2474 @kindex -ac
2475 @kindex -ad
2476 @kindex -ag
2477 @kindex -ah
2478 @kindex -al
2479 @kindex -ali
2480 @kindex -an
2481 @kindex -as
2482 @cindex listings, enabling
2483 @cindex assembly listings, enabling
2485 These options enable listing output from the assembler.  By itself,
2486 @samp{-a} requests high-level, assembly, and symbols listing.
2487 You can use other letters to select specific options for the list:
2488 @samp{-ah} requests a high-level language listing,
2489 @samp{-al} requests an output-program assembly listing,
2490 @samp{-ali} requests an output-program assembly listing along with the
2491 associated ginsn, and
2492 @samp{-as} requests a symbol table listing.
2493 High-level listings require that a compiler debugging option like
2494 @samp{-g} be used, and that assembly listings (@samp{-al}) be requested
2495 also.
2497 Use the @samp{-ag} option to print a first section with general assembly
2498 information, like @value{AS} version, switches passed, or time stamp.
2500 Use the @samp{-ac} option to omit false conditionals from a listing.  Any lines
2501 which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any
2502 other conditional), or a true @code{.if} followed by an @code{.else}, will be
2503 omitted from the listing.
2505 Use the @samp{-ad} option to omit debugging directives from the
2506 listing.
2508 Once you have specified one of these options, you can further control
2509 listing output and its appearance using the directives @code{.list},
2510 @code{.nolist}, @code{.psize}, @code{.eject}, @code{.title}, and
2511 @code{.sbttl}.
2512 The @samp{-an} option turns off all forms processing.
2513 If you do not request listing output with one of the @samp{-a} options, the
2514 listing-control directives have no effect.
2516 The letters after @samp{-a} may be combined into one option,
2517 @emph{e.g.}, @samp{-aln}.
2519 Note if the assembler source is coming from the standard input (e.g.,
2520 because it
2521 is being created by @code{@value{GCC}} and the @samp{-pipe} command-line switch
2522 is being used) then the listing will not contain any comments or preprocessor
2523 directives.  This is because the listing code buffers input source lines from
2524 stdin only after they have been preprocessed by the assembler.  This reduces
2525 memory usage and makes the code more efficient.
2527 @node alternate
2528 @section @option{--alternate}
2530 @kindex --alternate
2531 Begin in alternate macro mode, see @ref{Altmacro,,@code{.altmacro}}.
2533 @node D
2534 @section @option{-D}
2536 @kindex -D
2537 This option enables debugging, if it is supported by the assembler's
2538 configuration.  Otherwise it does nothing as is ignored.  This allows scripts
2539 designed to work with other assemblers to also work with GAS.
2540 @command{@value{AS}}.
2542 @node f
2543 @section Work Faster: @option{-f}
2545 @kindex -f
2546 @cindex trusted compiler
2547 @cindex faster processing (@option{-f})
2548 @samp{-f} should only be used when assembling programs written by a
2549 (trusted) compiler.  @samp{-f} stops the assembler from doing whitespace
2550 and comment preprocessing on
2551 the input file(s) before assembling them.  @xref{Preprocessing,
2552 ,Preprocessing}.
2554 @quotation
2555 @emph{Warning:} if you use @samp{-f} when the files actually need to be
2556 preprocessed (if they contain comments, for example), @command{@value{AS}} does
2557 not work correctly.
2558 @end quotation
2560 @node I
2561 @section @code{.include} Search Path: @option{-I} @var{path}
2563 @kindex -I @var{path}
2564 @cindex paths for @code{.include}
2565 @cindex search path for @code{.include}
2566 @cindex @code{include} directive search path
2567 Use this option to add a @var{path} to the list of directories
2568 @command{@value{AS}} searches for files specified in @code{.include}
2569 directives (@pxref{Include,,@code{.include}}).  You may use @option{-I} as
2570 many times as necessary to include a variety of paths.  The current
2571 working directory is always searched first; after that, @command{@value{AS}}
2572 searches any @samp{-I} directories in the same order as they were
2573 specified (left to right) on the command line.
2575 @node K
2576 @section Difference Tables: @option{-K}
2578 @kindex -K
2579 @ifclear DIFF-TBL-KLUGE
2580 On the @value{TARGET} family, this option is allowed, but has no effect.  It is
2581 permitted for compatibility with the @sc{gnu} assembler on other platforms,
2582 where it can be used to warn when the assembler alters the machine code
2583 generated for @samp{.word} directives in difference tables.  The @value{TARGET}
2584 family does not have the addressing limitations that sometimes lead to this
2585 alteration on other platforms.
2586 @end ifclear
2588 @ifset DIFF-TBL-KLUGE
2589 @cindex difference tables, warning
2590 @cindex warning for altered difference tables
2591 @command{@value{AS}} sometimes alters the code emitted for directives of the
2592 form @samp{.word @var{sym1}-@var{sym2}}.  @xref{Word,,@code{.word}}.
2593 You can use the @samp{-K} option if you want a warning issued when this
2594 is done.
2595 @end ifset
2597 @node L
2598 @section Include Local Symbols: @option{-L}
2600 @kindex -L
2601 @cindex local symbols, retaining in output
2602 Symbols beginning with system-specific local label prefixes, typically
2603 @samp{.L} for ELF systems or @samp{L} for traditional a.out systems, are
2604 called @dfn{local symbols}.  @xref{Symbol Names}.  Normally you do not see
2605 such symbols when debugging, because they are intended for the use of
2606 programs (like compilers) that compose assembler programs, not for your
2607 notice.  Normally both @command{@value{AS}} and @code{@value{LD}} discard
2608 such symbols, so you do not normally debug with them.
2610 This option tells @command{@value{AS}} to retain those local symbols
2611 in the object file.  Usually if you do this you also tell the linker
2612 @code{@value{LD}} to preserve those symbols.
2614 @node listing
2615 @section Configuring listing output: @option{--listing}
2617 The listing feature of the assembler can be enabled via the command-line switch
2618 @samp{-a} (@pxref{a}).  This feature combines the input source file(s) with a
2619 hex dump of the corresponding locations in the output object file, and displays
2620 them as a listing file.  The format of this listing can be controlled by
2621 directives inside the assembler source (i.e., @code{.list} (@pxref{List}),
2622 @code{.title} (@pxref{Title}), @code{.sbttl} (@pxref{Sbttl}),
2623 @code{.psize} (@pxref{Psize}), and
2624 @code{.eject} (@pxref{Eject}) and also by the following switches:
2626 @table @gcctabopt
2627 @item --listing-lhs-width=@samp{number}
2628 @kindex --listing-lhs-width
2629 @cindex Width of first line disassembly output
2630 Sets the maximum width, in words, of the first line of the hex byte dump.  This
2631 dump appears on the left hand side of the listing output.
2633 @item --listing-lhs-width2=@samp{number}
2634 @kindex --listing-lhs-width2
2635 @cindex Width of continuation lines of disassembly output
2636 Sets the maximum width, in words, of any further lines of the hex byte dump for
2637 a given input source line.  If this value is not specified, it defaults to being
2638 the same as the value specified for @samp{--listing-lhs-width}.  If neither
2639 switch is used the default is to one.
2641 @item --listing-rhs-width=@samp{number}
2642 @kindex --listing-rhs-width
2643 @cindex Width of source line output
2644 Sets the maximum width, in characters, of the source line that is displayed
2645 alongside the hex dump.  The default value for this parameter is 100.  The
2646 source line is displayed on the right hand side of the listing output.
2648 @item --listing-cont-lines=@samp{number}
2649 @kindex --listing-cont-lines
2650 @cindex Maximum number of continuation lines
2651 Sets the maximum number of continuation lines of hex dump that will be
2652 displayed for a given single line of source input.  The default value is 4.
2653 @end table
2655 @node M
2656 @section Assemble in MRI Compatibility Mode: @option{-M}
2658 @kindex -M
2659 @cindex MRI compatibility mode
2660 The @option{-M} or @option{--mri} option selects MRI compatibility mode.  This
2661 changes the syntax and pseudo-op handling of @command{@value{AS}} to make it
2662 compatible with the @code{ASM68K} assembler from Microtec Research.
2663 The exact nature of the
2664 MRI syntax will not be documented here; see the MRI manuals for more
2665 information.  Note in particular that the handling of macros and macro
2666 arguments is somewhat different.  The purpose of this option is to permit
2667 assembling existing MRI assembler code using @command{@value{AS}}.
2669 The MRI compatibility is not complete.  Certain operations of the MRI assembler
2670 depend upon its object file format, and can not be supported using other object
2671 file formats.  Supporting these would require enhancing each object file format
2672 individually.  These are:
2674 @itemize @bullet
2675 @item global symbols in common section
2677 The m68k MRI assembler supports common sections which are merged by the linker.
2678 Other object file formats do not support this.  @command{@value{AS}} handles
2679 common sections by treating them as a single common symbol.  It permits local
2680 symbols to be defined within a common section, but it can not support global
2681 symbols, since it has no way to describe them.
2683 @item complex relocations
2685 The MRI assemblers support relocations against a negated section address, and
2686 relocations which combine the start addresses of two or more sections.  These
2687 are not support by other object file formats.
2689 @item @code{END} pseudo-op specifying start address
2691 The MRI @code{END} pseudo-op permits the specification of a start address.
2692 This is not supported by other object file formats.  The start address may
2693 instead be specified using the @option{-e} option to the linker, or in a linker
2694 script.
2696 @item @code{IDNT}, @code{.ident} and @code{NAME} pseudo-ops
2698 The MRI @code{IDNT}, @code{.ident} and @code{NAME} pseudo-ops assign a module
2699 name to the output file.  This is not supported by other object file formats.
2701 @item @code{ORG} pseudo-op
2703 The m68k MRI @code{ORG} pseudo-op begins an absolute section at a given
2704 address.  This differs from the usual @command{@value{AS}} @code{.org} pseudo-op,
2705 which changes the location within the current section.  Absolute sections are
2706 not supported by other object file formats.  The address of a section may be
2707 assigned within a linker script.
2708 @end itemize
2710 There are some other features of the MRI assembler which are not supported by
2711 @command{@value{AS}}, typically either because they are difficult or because they
2712 seem of little consequence.  Some of these may be supported in future releases.
2714 @itemize @bullet
2716 @item EBCDIC strings
2718 EBCDIC strings are not supported.
2720 @item packed binary coded decimal
2722 Packed binary coded decimal is not supported.  This means that the @code{DC.P}
2723 and @code{DCB.P} pseudo-ops are not supported.
2725 @item @code{FEQU} pseudo-op
2727 The m68k @code{FEQU} pseudo-op is not supported.
2729 @item @code{NOOBJ} pseudo-op
2731 The m68k @code{NOOBJ} pseudo-op is not supported.
2733 @item @code{OPT} branch control options
2735 The m68k @code{OPT} branch control options---@code{B}, @code{BRS}, @code{BRB},
2736 @code{BRL}, and @code{BRW}---are ignored.  @command{@value{AS}} automatically
2737 relaxes all branches, whether forward or backward, to an appropriate size, so
2738 these options serve no purpose.
2740 @item @code{OPT} list control options
2742 The following m68k @code{OPT} list control options are ignored: @code{C},
2743 @code{CEX}, @code{CL}, @code{CRE}, @code{E}, @code{G}, @code{I}, @code{M},
2744 @code{MEX}, @code{MC}, @code{MD}, @code{X}.
2746 @item other @code{OPT} options
2748 The following m68k @code{OPT} options are ignored: @code{NEST}, @code{O},
2749 @code{OLD}, @code{OP}, @code{P}, @code{PCO}, @code{PCR}, @code{PCS}, @code{R}.
2751 @item @code{OPT} @code{D} option is default
2753 The m68k @code{OPT} @code{D} option is the default, unlike the MRI assembler.
2754 @code{OPT NOD} may be used to turn it off.
2756 @item @code{XREF} pseudo-op.
2758 The m68k @code{XREF} pseudo-op is ignored.
2760 @end itemize
2762 @node MD
2763 @section Dependency Tracking: @option{--MD}
2765 @kindex --MD
2766 @cindex dependency tracking
2767 @cindex make rules
2769 @command{@value{AS}} can generate a dependency file for the file it creates.  This
2770 file consists of a single rule suitable for @code{make} describing the
2771 dependencies of the main source file.
2773 The rule is written to the file named in its argument.
2775 This feature is used in the automatic updating of makefiles.
2777 @node no-pad-sections
2778 @section Output Section Padding
2779 @kindex --no-pad-sections
2780 @cindex output section padding
2781 Normally the assembler will pad the end of each output section up to its
2782 alignment boundary.  But this can waste space, which can be significant on
2783 memory constrained targets.  So the @option{--no-pad-sections} option will
2784 disable this behaviour.
2786 @node o
2787 @section Name the Object File: @option{-o}
2789 @kindex -o
2790 @cindex naming object file
2791 @cindex object file name
2792 There is always one object file output when you run @command{@value{AS}}.  By
2793 default it has the name @file{a.out}.
2794 You use this option (which takes exactly one filename) to give the
2795 object file a different name.
2797 Whatever the object file is called, @command{@value{AS}} overwrites any
2798 existing file of the same name.
2800 @node R
2801 @section Join Data and Text Sections: @option{-R}
2803 @kindex -R
2804 @cindex data and text sections, joining
2805 @cindex text and data sections, joining
2806 @cindex joining text and data sections
2807 @cindex merging text and data sections
2808 @option{-R} tells @command{@value{AS}} to write the object file as if all
2809 data-section data lives in the text section.  This is only done at
2810 the very last moment:  your binary data are the same, but data
2811 section parts are relocated differently.  The data section part of
2812 your object file is zero bytes long because all its bytes are
2813 appended to the text section.  (@xref{Sections,,Sections and Relocation}.)
2815 When you specify @option{-R} it would be possible to generate shorter
2816 address displacements (because we do not have to cross between text and
2817 data section).  We refrain from doing this simply for compatibility with
2818 older versions of @command{@value{AS}}.  In future, @option{-R} may work this way.
2820 @ifset COFF-ELF
2821 When @command{@value{AS}} is configured for COFF or ELF output,
2822 this option is only useful if you use sections named @samp{.text} and
2823 @samp{.data}.
2824 @end ifset
2826 @ifset HPPA
2827 @option{-R} is not supported for any of the HPPA targets.  Using
2828 @option{-R} generates a warning from @command{@value{AS}}.
2829 @end ifset
2831 @node statistics
2832 @section Display Assembly Statistics: @option{--statistics}
2834 @kindex --statistics
2835 @cindex statistics, about assembly
2836 @cindex time, total for assembly
2837 @cindex space used, maximum for assembly
2838 Use @samp{--statistics} to display two statistics about the resources used by
2839 @command{@value{AS}}: the maximum amount of space allocated during the assembly
2840 (in bytes), and the total execution time taken for the assembly (in @sc{cpu}
2841 seconds).
2843 @node traditional-format
2844 @section Compatible Output: @option{--traditional-format}
2846 @kindex --traditional-format
2847 For some targets, the output of @command{@value{AS}} is different in some ways
2848 from the output of some existing assembler.  This switch requests
2849 @command{@value{AS}} to use the traditional format instead.
2851 For example, it disables the exception frame optimizations which
2852 @command{@value{AS}} normally does by default on @code{@value{GCC}} output.
2854 @node v
2855 @section Announce Version: @option{-v}
2857 @kindex -v
2858 @kindex -version
2859 @cindex assembler version
2860 @cindex version of assembler
2861 You can find out what version of as is running by including the
2862 option @samp{-v} (which you can also spell as @samp{-version}) on the
2863 command line.
2865 @node W
2866 @section Control Warnings: @option{-W}, @option{--warn}, @option{--no-warn}, @option{--fatal-warnings}
2868 @command{@value{AS}} should never give a warning or error message when
2869 assembling compiler output.  But programs written by people often
2870 cause @command{@value{AS}} to give a warning that a particular assumption was
2871 made.  All such warnings are directed to the standard error file.
2873 @kindex -W
2874 @kindex --no-warn
2875 @cindex suppressing warnings
2876 @cindex warnings, suppressing
2877 If you use the @option{-W} and @option{--no-warn} options, no warnings are issued.
2878 This only affects the warning messages: it does not change any particular of
2879 how @command{@value{AS}} assembles your file.  Errors, which stop the assembly,
2880 are still reported.
2882 @kindex --fatal-warnings
2883 @cindex errors, caused by warnings
2884 @cindex warnings, causing error
2885 If you use the @option{--fatal-warnings} option, @command{@value{AS}} considers
2886 files that generate warnings to be in error.
2888 @kindex --warn
2889 @cindex warnings, switching on
2890 You can switch these options off again by specifying @option{--warn}, which
2891 causes warnings to be output as usual.
2893 @node Z
2894 @section Generate Object File in Spite of Errors: @option{-Z}
2895 @cindex object file, after errors
2896 @cindex errors, continuing after
2897 After an error message, @command{@value{AS}} normally produces no output.  If for
2898 some reason you are interested in object file output even after
2899 @command{@value{AS}} gives an error message on your program, use the @samp{-Z}
2900 option.  If there are any errors, @command{@value{AS}} continues anyways, and
2901 writes an object file after a final warning message of the form @samp{@var{n}
2902 errors, @var{m} warnings, generating bad object file.}
2904 @node Syntax
2905 @chapter Syntax
2907 @cindex machine-independent syntax
2908 @cindex syntax, machine-independent
2909 This chapter describes the machine-independent syntax allowed in a
2910 source file.  @command{@value{AS}} syntax is similar to what many other
2911 assemblers use; it is inspired by the BSD 4.2
2912 @ifclear VAX
2913 assembler.
2914 @end ifclear
2915 @ifset VAX
2916 assembler, except that @command{@value{AS}} does not assemble Vax bit-fields.
2917 @end ifset
2919 @menu
2920 * Preprocessing::               Preprocessing
2921 * Whitespace::                  Whitespace
2922 * Comments::                    Comments
2923 * Symbol Intro::                Symbols
2924 * Statements::                  Statements
2925 * Constants::                   Constants
2926 @end menu
2928 @node Preprocessing
2929 @section Preprocessing
2931 @cindex preprocessing
2932 The @command{@value{AS}} internal preprocessor:
2933 @itemize @bullet
2934 @cindex whitespace, removed by preprocessor
2935 @item
2936 adjusts and removes extra whitespace.  It leaves one space or tab before
2937 the keywords on a line, and turns any other whitespace on the line into
2938 a single space.
2940 @cindex comments, removed by preprocessor
2941 @item
2942 removes all comments, replacing them with a single space, or an
2943 appropriate number of newlines.
2945 @cindex constants, converted by preprocessor
2946 @item
2947 converts character constants into the appropriate numeric values.
2948 @end itemize
2950 It does not do macro processing, include file handling, or
2951 anything else you may get from your C compiler's preprocessor.  You can
2952 do include file processing with the @code{.include} directive
2953 (@pxref{Include,,@code{.include}}).  You can use the @sc{gnu} C compiler driver
2954 to get other ``CPP'' style preprocessing by giving the input file a
2955 @samp{.S} suffix.  @url{https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#Overall-Options,
2956 See the 'Options Controlling the Kind of Output' section of the GCC manual for
2957 more details}
2959 Excess whitespace, comments, and character constants
2960 cannot be used in the portions of the input text that are not
2961 preprocessed.
2963 @cindex turning preprocessing on and off
2964 @cindex preprocessing, turning on and off
2965 @kindex #NO_APP
2966 @kindex #APP
2967 If the first line of an input file is @code{#NO_APP} or if you use the
2968 @samp{-f} option, whitespace and comments are not removed from the input file.
2969 Within an input file, you can ask for whitespace and comment removal in
2970 specific portions of the file by putting a line that says @code{#APP} before the
2971 text that may contain whitespace or comments, and putting a line that says
2972 @code{#NO_APP} after this text.  This feature is mainly intended to support
2973 @code{asm} statements in compilers whose output is otherwise free of comments
2974 and whitespace.
2976 @node Whitespace
2977 @section Whitespace
2979 @cindex whitespace
2980 @dfn{Whitespace} is one or more blanks or tabs, in any order.
2981 Whitespace is used to separate symbols, and to make programs neater for
2982 people to read.  Unless within character constants
2983 (@pxref{Characters,,Character Constants}), any whitespace means the same
2984 as exactly one space.
2986 @node Comments
2987 @section Comments
2989 @cindex comments
2990 There are two ways of rendering comments to @command{@value{AS}}.  In both
2991 cases the comment is equivalent to one space.
2993 Anything from @samp{/*} through the next @samp{*/} is a comment.
2994 This means you may not nest these comments.
2996 @smallexample
2998   The only way to include a newline ('\n') in a comment
2999   is to use this sort of comment.
3002 /* This sort of comment does not nest. */
3003 @end smallexample
3005 @cindex line comment character
3006 Anything from a @dfn{line comment} character up to the next newline is
3007 considered a comment and is ignored.  The line comment character is target
3008 specific, and some targets support multiple comment characters.  Some targets
3009 also have line comment characters that only work if they are the first
3010 character on a line.  Some targets use a sequence of two characters to
3011 introduce a line comment.  Some targets can also change their line comment
3012 characters depending upon command-line options that have been used.  For more
3013 details see the @emph{Syntax} section in the documentation for individual
3014 targets.
3016 If the line comment character is the hash sign (@samp{#}) then it still has the
3017 special ability to enable and disable preprocessing (@pxref{Preprocessing}) and
3018 to specify logical line numbers:
3020 @kindex #
3021 @cindex lines starting with @code{#}
3022 @cindex logical line numbers
3023 To be compatible with past assemblers, lines that begin with @samp{#} have a
3024 special interpretation.  Following the @samp{#} should be an absolute
3025 expression (@pxref{Expressions}): the logical line number of the @emph{next}
3026 line.  Then a string (@pxref{Strings, ,Strings}) is allowed: if present it is a
3027 new logical file name.  The rest of the line, if any, should be whitespace.
3029 If the first non-whitespace characters on the line are not numeric,
3030 the line is ignored.  (Just like a comment.)
3032 @smallexample
3033                           # This is an ordinary comment.
3034 # 42-6 "new_file_name"    # New logical file name
3035                           # This is logical line # 36.
3036 @end smallexample
3037 This feature is deprecated, and may disappear from future versions
3038 of @command{@value{AS}}.
3040 @node Symbol Intro
3041 @section Symbols
3043 @cindex characters used in symbols
3044 @ifclear SPECIAL-SYMS
3045 A @dfn{symbol} is one or more characters chosen from the set of all
3046 letters (both upper and lower case), digits and the three characters
3047 @samp{_.$}.
3048 @end ifclear
3049 @ifset SPECIAL-SYMS
3050 @ifclear GENERIC
3051 @ifset H8
3052 A @dfn{symbol} is one or more characters chosen from the set of all
3053 letters (both upper and lower case), digits and the three characters
3054 @samp{._$}.  (Save that, on the H8/300 only, you may not use @samp{$} in
3055 symbol names.)
3056 @end ifset
3057 @end ifclear
3058 @end ifset
3059 @ifset GENERIC
3060 On most machines, you can also use @code{$} in symbol names; exceptions
3061 are noted in @ref{Machine Dependencies}.
3062 @end ifset
3063 No symbol may begin with a digit.  Case is significant.
3064 There is no length limit; all characters are significant.  Multibyte characters
3065 are supported, but note that the setting of the
3066 @option{--multibyte-handling} option might prevent their use.  Symbols
3067 are delimited by characters not in that set, or by the beginning of a file
3068 (since the source program must end with a newline, the end of a file is not a
3069 possible symbol delimiter).  @xref{Symbols}.
3071 Symbol names may also be enclosed in double quote @code{"} characters.  In such
3072 cases any characters are allowed, except for the NUL character.  If a double
3073 quote character is to be included in the symbol name it must be preceded by a
3074 backslash @code{\} character.
3075 @cindex length of symbols
3077 @node Statements
3078 @section Statements
3080 @cindex statements, structure of
3081 @cindex line separator character
3082 @cindex statement separator character
3084 A @dfn{statement} ends at a newline character (@samp{\n}) or a
3085 @dfn{line separator character}.  The line separator character is target
3086 specific and described in the @emph{Syntax} section of each
3087 target's documentation.  Not all targets support a line separator character.
3088 The newline or line separator character is considered to be part of the
3089 preceding statement.  Newlines and separators within character constants are an
3090 exception: they do not end statements.
3092 @cindex newline, required at file end
3093 @cindex EOF, newline must precede
3094 It is an error to end any statement with end-of-file:  the last
3095 character of any input file should be a newline.
3097 An empty statement is allowed, and may include whitespace.  It is ignored.
3099 @cindex instructions and directives
3100 @cindex directives and instructions
3101 @c "key symbol" is not used elsewhere in the document; seems pedantic to
3102 @c @defn{} it in that case, as was done previously...  doc@cygnus.com,
3103 @c 13feb91.
3104 A statement begins with zero or more labels, optionally followed by a
3105 key symbol which determines what kind of statement it is.  The key
3106 symbol determines the syntax of the rest of the statement.  If the
3107 symbol begins with a dot @samp{.} then the statement is an assembler
3108 directive: typically valid for any computer.  If the symbol begins with
3109 a letter the statement is an assembly language @dfn{instruction}: it
3110 assembles into a machine language instruction.
3111 @ifset GENERIC
3112 Different versions of @command{@value{AS}} for different computers
3113 recognize different instructions.  In fact, the same symbol may
3114 represent a different instruction in a different computer's assembly
3115 language.
3116 @end ifset
3118 @cindex @code{:} (label)
3119 @cindex label (@code{:})
3120 A label is a symbol immediately followed by a colon (@code{:}).
3121 Whitespace before a label or after a colon is permitted, but you may not
3122 have whitespace between a label's symbol and its colon. @xref{Labels}.
3124 @ifset HPPA
3125 For HPPA targets, labels need not be immediately followed by a colon, but
3126 the definition of a label must begin in column zero.  This also implies that
3127 only one label may be defined on each line.
3128 @end ifset
3130 @smallexample
3131 label:     .directive    followed by something
3132 another_label:           # This is an empty statement.
3133            instruction   operand_1, operand_2, @dots{}
3134 @end smallexample
3136 @node Constants
3137 @section Constants
3139 @cindex constants
3140 A constant is a number, written so that its value is known by
3141 inspection, without knowing any context.  Like this:
3142 @smallexample
3143 @group
3144 .byte  74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
3145 .ascii "Ring the bell\7"                  # A string constant.
3146 .octa  0x123456789abcdef0123456789ABCDEF0 # A bignum.
3147 .float 0f-314159265358979323846264338327\
3148 95028841971.693993751E-40                 # - pi, a flonum.
3149 @end group
3150 @end smallexample
3152 @menu
3153 * Characters::                  Character Constants
3154 * Numbers::                     Number Constants
3155 @end menu
3157 @node Characters
3158 @subsection Character Constants
3160 @cindex character constants
3161 @cindex constants, character
3162 There are two kinds of character constants.  A @dfn{character} stands
3163 for one character in one byte and its value may be used in
3164 numeric expressions.  String constants (properly called string
3165 @emph{literals}) are potentially many bytes and their values may not be
3166 used in arithmetic expressions.
3168 @menu
3169 * Strings::                     Strings
3170 * Chars::                       Characters
3171 @end menu
3173 @node Strings
3174 @subsubsection Strings
3176 @cindex string constants
3177 @cindex constants, string
3178 A @dfn{string} is written between double-quotes.  It may contain
3179 double-quotes or null characters.  The way to get special characters
3180 into a string is to @dfn{escape} these characters: precede them with
3181 a backslash @samp{\} character.  For example @samp{\\} represents
3182 one backslash:  the first @code{\} is an escape which tells
3183 @command{@value{AS}} to interpret the second character literally as a backslash
3184 (which prevents @command{@value{AS}} from recognizing the second @code{\} as an
3185 escape character).  The complete list of escapes follows.
3187 @cindex escape codes, character
3188 @cindex character escape codes
3189 @c NOTE: Cindex entries must not start with a backlash character.
3190 @c NOTE: This confuses the pdf2texi script when it is creating the
3191 @c NOTE: index based upon the first character and so it generates:
3192 @c NOTE:   \initial {\\}
3193 @c NOTE: which then results in the error message:
3194 @c NOTE:   Argument of \\ has an extra }.
3195 @c NOTE: So in the index entries below a space character has been
3196 @c NOTE: prepended to avoid this problem.
3197 @table @kbd
3198 @c      @item \a
3199 @c      Mnemonic for ACKnowledge; for ASCII this is octal code 007.
3201 @cindex @code{ \b} (backspace character)
3202 @cindex backspace (@code{\b})
3203 @item \b
3204 Mnemonic for backspace; for ASCII this is octal code 010.
3206 @c      @item \e
3207 @c      Mnemonic for EOText; for ASCII this is octal code 004.
3209 @cindex @code{ \f} (formfeed character)
3210 @cindex formfeed (@code{\f})
3211 @item backslash-f
3212 Mnemonic for FormFeed; for ASCII this is octal code 014.
3214 @cindex @code{ \n} (newline character)
3215 @cindex newline (@code{\n})
3216 @item \n
3217 Mnemonic for newline; for ASCII this is octal code 012.
3219 @c      @item \p
3220 @c      Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}.
3222 @cindex @code{ \r} (carriage return character)
3223 @cindex carriage return (@code{backslash-r})
3224 @item \r
3225 Mnemonic for carriage-Return; for ASCII this is octal code 015.
3227 @c      @item \s
3228 @c      Mnemonic for space; for ASCII this is octal code 040.  Included for compliance with
3229 @c      other assemblers.
3231 @cindex @code{ \t} (tab)
3232 @cindex tab (@code{\t})
3233 @item \t
3234 Mnemonic for horizontal Tab; for ASCII this is octal code 011.
3236 @c      @item \v
3237 @c      Mnemonic for Vertical tab; for ASCII this is octal code 013.
3238 @c      @item \x @var{digit} @var{digit} @var{digit}
3239 @c      A hexadecimal character code.  The numeric code is 3 hexadecimal digits.
3241 @cindex @code{ \@var{ddd}} (octal character code)
3242 @cindex octal character code (@code{\@var{ddd}})
3243 @item \ @var{digit} @var{digit} @var{digit}
3244 An octal character code.  The numeric code is 3 octal digits.
3245 For compatibility with other Unix systems, 8 and 9 are accepted as digits:
3246 for example, @code{\008} has the value 010, and @code{\009} the value 011.
3248 @cindex @code{ \@var{xd...}} (hex character code)
3249 @cindex hex character code (@code{\@var{xd...}})
3250 @item \@code{x} @var{hex-digits...}
3251 A hex character code.  All trailing hex digits are combined.  Either upper or
3252 lower case @code{x} works.
3254 @cindex @code{ \\} (@samp{\} character)
3255 @cindex backslash (@code{\\})
3256 @item \\
3257 Represents one @samp{\} character.
3259 @c      @item \'
3260 @c      Represents one @samp{'} (accent acute) character.
3261 @c      This is needed in single character literals
3262 @c      (@xref{Characters,,Character Constants}.) to represent
3263 @c      a @samp{'}.
3265 @cindex @code{ \"} (doublequote character)
3266 @cindex doublequote (@code{\"})
3267 @item \"
3268 Represents one @samp{"} character.  Needed in strings to represent
3269 this character, because an unescaped @samp{"} would end the string.
3271 @item \ @var{anything-else}
3272 Any other character when escaped by @kbd{\} gives a warning, but
3273 assembles as if the @samp{\} was not present.  The idea is that if
3274 you used an escape sequence you clearly didn't want the literal
3275 interpretation of the following character.  However @command{@value{AS}} has no
3276 other interpretation, so @command{@value{AS}} knows it is giving you the wrong
3277 code and warns you of the fact.
3278 @end table
3280 Which characters are escapable, and what those escapes represent,
3281 varies widely among assemblers.  The current set is what we think
3282 the BSD 4.2 assembler recognizes, and is a subset of what most C
3283 compilers recognize.  If you are in doubt, do not use an escape
3284 sequence.
3286 @node Chars
3287 @subsubsection Characters
3289 @cindex single character constant
3290 @cindex character, single
3291 @cindex constant, single character
3292 A single character may be written as a single quote immediately followed by
3293 that character.  Some backslash escapes apply to characters, @code{\b},
3294 @code{\f}, @code{\n}, @code{\r}, @code{\t}, and @code{\"} with the same meaning
3295 as for strings, plus @code{\'} for a single quote.  So if you want to write the
3296 character backslash, you must write @kbd{'\\} where the first @code{\} escapes
3297 the second @code{\}.  As you can see, the quote is an acute accent, not a grave
3298 accent.  A newline
3299 @ifclear GENERIC
3300 @ifclear abnormal-separator
3301 (or semicolon @samp{;})
3302 @end ifclear
3303 @ifset abnormal-separator
3304 @ifset H8
3305 (or dollar sign @samp{$}, for the H8/300; or semicolon @samp{;} for the
3306 Renesas SH)
3307 @end ifset
3308 @end ifset
3309 @end ifclear
3310 immediately following an acute accent is taken as a literal character
3311 and does not count as the end of a statement.  The value of a character
3312 constant in a numeric expression is the machine's byte-wide code for
3313 that character.  @command{@value{AS}} assumes your character code is ASCII:
3314 @kbd{'A} means 65, @kbd{'B} means 66, and so on.
3316 @node Numbers
3317 @subsection Number Constants
3319 @cindex constants, number
3320 @cindex number constants
3321 @command{@value{AS}} distinguishes three kinds of numbers according to how they
3322 are stored in the target machine.  @emph{Integers} are numbers that
3323 would fit into an @code{int} in the C language.  @emph{Bignums} are
3324 integers, but they are stored in more than 32 bits.  @emph{Flonums}
3325 are floating point numbers, described below.
3327 @menu
3328 * Integers::                    Integers
3329 * Bignums::                     Bignums
3330 * Flonums::                     Flonums
3331 @ifclear GENERIC
3332 @end ifclear
3333 @end menu
3335 @node Integers
3336 @subsubsection Integers
3337 @cindex integers
3338 @cindex constants, integer
3340 @cindex binary integers
3341 @cindex integers, binary
3342 A binary integer is @samp{0b} or @samp{0B} followed by zero or more of
3343 the binary digits @samp{01}.
3345 @cindex octal integers
3346 @cindex integers, octal
3347 An octal integer is @samp{0} followed by zero or more of the octal
3348 digits (@samp{01234567}).
3350 @cindex decimal integers
3351 @cindex integers, decimal
3352 A decimal integer starts with a non-zero digit followed by zero or
3353 more digits (@samp{0123456789}).
3355 @cindex hexadecimal integers
3356 @cindex integers, hexadecimal
3357 A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or
3358 more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}.
3360 Integers have the usual values.  To denote a negative integer, use
3361 the prefix operator @samp{-} discussed under expressions
3362 (@pxref{Prefix Ops,,Prefix Operators}).
3364 @node Bignums
3365 @subsubsection Bignums
3367 @cindex bignums
3368 @cindex constants, bignum
3369 A @dfn{bignum} has the same syntax and semantics as an integer
3370 except that the number (or its negative) takes more than 32 bits to
3371 represent in binary.  The distinction is made because in some places
3372 integers are permitted while bignums are not.
3374 @node Flonums
3375 @subsubsection Flonums
3376 @cindex flonums
3377 @cindex floating point numbers
3378 @cindex constants, floating point
3380 @cindex precision, floating point
3381 A @dfn{flonum} represents a floating point number.  The translation is
3382 indirect: a decimal floating point number from the text is converted by
3383 @command{@value{AS}} to a generic binary floating point number of more than
3384 sufficient precision.  This generic floating point number is converted
3385 to a particular computer's floating point format (or formats) by a
3386 portion of @command{@value{AS}} specialized to that computer.
3388 A flonum is written by writing (in order)
3389 @itemize @bullet
3390 @item
3391 The digit @samp{0}.
3392 @ifset HPPA
3393 (@samp{0} is optional on the HPPA.)
3394 @end ifset
3396 @item
3397 A letter, to tell @command{@value{AS}} the rest of the number is a flonum.
3398 @ifset GENERIC
3399 @kbd{e} is recommended.  Case is not important.
3400 @ignore
3401 @c FIXME: verify if flonum syntax really this vague for most cases
3402 (Any otherwise illegal letter works here, but that might be changed.  Vax BSD
3403 4.2 assembler seems to allow any of @samp{defghDEFGH}.)
3404 @end ignore
3406 On the H8/300 and Renesas / SuperH SH architectures, the letter must be
3407 one of the letters @samp{DFPRSX} (in upper or lower case).
3409 On the ARC, the letter must be one of the letters @samp{DFRS}
3410 (in upper or lower case).
3412 On the HPPA architecture, the letter must be @samp{E} (upper case only).
3413 @end ifset
3414 @ifclear GENERIC
3415 @ifset ARC
3416 One of the letters @samp{DFRS} (in upper or lower case).
3417 @end ifset
3418 @ifset H8
3419 One of the letters @samp{DFPRSX} (in upper or lower case).
3420 @end ifset
3421 @ifset HPPA
3422 The letter @samp{E} (upper case only).
3423 @end ifset
3424 @end ifclear
3426 @item
3427 An optional sign: either @samp{+} or @samp{-}.
3429 @item
3430 An optional @dfn{integer part}: zero or more decimal digits.
3432 @item
3433 An optional @dfn{fractional part}: @samp{.} followed by zero
3434 or more decimal digits.
3436 @item
3437 An optional exponent, consisting of:
3439 @itemize @bullet
3440 @item
3441 An @samp{E} or @samp{e}.
3442 @c I can't find a config where "EXP_CHARS" is other than 'eE', but in
3443 @c principle this can perfectly well be different on different targets.
3444 @item
3445 Optional sign: either @samp{+} or @samp{-}.
3446 @item
3447 One or more decimal digits.
3448 @end itemize
3450 @end itemize
3452 At least one of the integer part or the fractional part must be
3453 present.  The floating point number has the usual base-10 value.
3455 @command{@value{AS}} does all processing using integers.  Flonums are computed
3456 independently of any floating point hardware in the computer running
3457 @command{@value{AS}}.
3459 @node Sections
3460 @chapter Sections and Relocation
3461 @cindex sections
3462 @cindex relocation
3464 @menu
3465 * Secs Background::             Background
3466 * Ld Sections::                 Linker Sections
3467 * As Sections::                 Assembler Internal Sections
3468 * Sub-Sections::                Sub-Sections
3469 * bss::                         bss Section
3470 @end menu
3472 @node Secs Background
3473 @section Background
3475 Roughly, a section is a range of addresses, with no gaps; all data
3476 ``in'' those addresses is treated the same for some particular purpose.
3477 For example there may be a ``read only'' section.
3479 @cindex linker, and assembler
3480 @cindex assembler, and linker
3481 The linker @code{@value{LD}} reads many object files (partial programs) and
3482 combines their contents to form a runnable program.  When @command{@value{AS}}
3483 emits an object file, the partial program is assumed to start at address 0.
3484 @code{@value{LD}} assigns the final addresses for the partial program, so that
3485 different partial programs do not overlap.  This is actually an
3486 oversimplification, but it suffices to explain how @command{@value{AS}} uses
3487 sections.
3489 @code{@value{LD}} moves blocks of bytes of your program to their run-time
3490 addresses.  These blocks slide to their run-time addresses as rigid
3491 units; their length does not change and neither does the order of bytes
3492 within them.  Such a rigid unit is called a @emph{section}.  Assigning
3493 run-time addresses to sections is called @dfn{relocation}.  It includes
3494 the task of adjusting mentions of object-file addresses so they refer to
3495 the proper run-time addresses.
3496 @ifset H8
3497 For the H8/300, and for the Renesas / SuperH SH,
3498 @command{@value{AS}} pads sections if needed to
3499 ensure they end on a word (sixteen bit) boundary.
3500 @end ifset
3502 @cindex standard assembler sections
3503 An object file written by @command{@value{AS}} has at least three sections, any
3504 of which may be empty.  These are named @dfn{text}, @dfn{data} and
3505 @dfn{bss} sections.
3507 @ifset COFF-ELF
3508 @ifset GENERIC
3509 When it generates COFF or ELF output,
3510 @end ifset
3511 @command{@value{AS}} can also generate whatever other named sections you specify
3512 using the @samp{.section} directive (@pxref{Section,,@code{.section}}).
3513 If you do not use any directives that place output in the @samp{.text}
3514 or @samp{.data} sections, these sections still exist, but are empty.
3515 @end ifset
3517 @ifset HPPA
3518 @ifset GENERIC
3519 When @command{@value{AS}} generates SOM or ELF output for the HPPA,
3520 @end ifset
3521 @command{@value{AS}} can also generate whatever other named sections you
3522 specify using the @samp{.space} and @samp{.subspace} directives.  See
3523 @cite{HP9000 Series 800 Assembly Language Reference Manual}
3524 (HP 92432-90001) for details on the @samp{.space} and @samp{.subspace}
3525 assembler directives.
3527 @ifset SOM
3528 Additionally, @command{@value{AS}} uses different names for the standard
3529 text, data, and bss sections when generating SOM output.  Program text
3530 is placed into the @samp{$CODE$} section, data into @samp{$DATA$}, and
3531 BSS into @samp{$BSS$}.
3532 @end ifset
3533 @end ifset
3535 Within the object file, the text section starts at address @code{0}, the
3536 data section follows, and the bss section follows the data section.
3538 @ifset HPPA
3539 When generating either SOM or ELF output files on the HPPA, the text
3540 section starts at address @code{0}, the data section at address
3541 @code{0x4000000}, and the bss section follows the data section.
3542 @end ifset
3544 To let @code{@value{LD}} know which data changes when the sections are
3545 relocated, and how to change that data, @command{@value{AS}} also writes to the
3546 object file details of the relocation needed.  To perform relocation
3547 @code{@value{LD}} must know, each time an address in the object
3548 file is mentioned:
3549 @itemize @bullet
3550 @item
3551 Where in the object file is the beginning of this reference to
3552 an address?
3553 @item
3554 How long (in bytes) is this reference?
3555 @item
3556 Which section does the address refer to?  What is the numeric value of
3557 @display
3558 (@var{address}) @minus{} (@var{start-address of section})?
3559 @end display
3560 @item
3561 Is the reference to an address ``Program-Counter relative''?
3562 @end itemize
3564 @cindex addresses, format of
3565 @cindex section-relative addressing
3566 In fact, every address @command{@value{AS}} ever uses is expressed as
3567 @display
3568 (@var{section}) + (@var{offset into section})
3569 @end display
3570 @noindent
3571 Further, most expressions @command{@value{AS}} computes have this section-relative
3572 nature.
3573 @ifset SOM
3574 (For some object formats, such as SOM for the HPPA, some expressions are
3575 symbol-relative instead.)
3576 @end ifset
3578 In this manual we use the notation @{@var{secname} @var{N}@} to mean ``offset
3579 @var{N} into section @var{secname}.''
3581 Apart from text, data and bss sections you need to know about the
3582 @dfn{absolute} section.  When @code{@value{LD}} mixes partial programs,
3583 addresses in the absolute section remain unchanged.  For example, address
3584 @code{@{absolute 0@}} is ``relocated'' to run-time address 0 by
3585 @code{@value{LD}}.  Although the linker never arranges two partial programs'
3586 data sections with overlapping addresses after linking, @emph{by definition}
3587 their absolute sections must overlap.  Address @code{@{absolute@ 239@}} in one
3588 part of a program is always the same address when the program is running as
3589 address @code{@{absolute@ 239@}} in any other part of the program.
3591 The idea of sections is extended to the @dfn{undefined} section.  Any
3592 address whose section is unknown at assembly time is by definition
3593 rendered @{undefined @var{U}@}---where @var{U} is filled in later.
3594 Since numbers are always defined, the only way to generate an undefined
3595 address is to mention an undefined symbol.  A reference to a named
3596 common block would be such a symbol: its value is unknown at assembly
3597 time so it has section @emph{undefined}.
3599 By analogy the word @emph{section} is used to describe groups of sections in
3600 the linked program.  @code{@value{LD}} puts all partial programs' text
3601 sections in contiguous addresses in the linked program.  It is
3602 customary to refer to the @emph{text section} of a program, meaning all
3603 the addresses of all partial programs' text sections.  Likewise for
3604 data and bss sections.
3606 Some sections are manipulated by @code{@value{LD}}; others are invented for
3607 use of @command{@value{AS}} and have no meaning except during assembly.
3609 @node Ld Sections
3610 @section Linker Sections
3611 @code{@value{LD}} deals with just four kinds of sections, summarized below.
3613 @table @strong
3615 @ifset COFF-ELF
3616 @cindex named sections
3617 @cindex sections, named
3618 @item named sections
3619 @end ifset
3620 @ifset aout
3621 @cindex text section
3622 @cindex data section
3623 @itemx text section
3624 @itemx data section
3625 @end ifset
3626 These sections hold your program.  @command{@value{AS}} and @code{@value{LD}} treat them as
3627 separate but equal sections.  Anything you can say of one section is
3628 true of another.
3629 @c @ifset aout
3630 When the program is running, however, it is
3631 customary for the text section to be unalterable.  The
3632 text section is often shared among processes: it contains
3633 instructions, constants and the like.  The data section of a running
3634 program is usually alterable: for example, C variables would be stored
3635 in the data section.
3636 @c @end ifset
3638 @cindex bss section
3639 @item bss section
3640 This section contains zeroed bytes when your program begins running.  It
3641 is used to hold uninitialized variables or common storage.  The length of
3642 each partial program's bss section is important, but because it starts
3643 out containing zeroed bytes there is no need to store explicit zero
3644 bytes in the object file.  The bss section was invented to eliminate
3645 those explicit zeros from object files.
3647 @cindex absolute section
3648 @item absolute section
3649 Address 0 of this section is always ``relocated'' to runtime address 0.
3650 This is useful if you want to refer to an address that @code{@value{LD}} must
3651 not change when relocating.  In this sense we speak of absolute
3652 addresses being ``unrelocatable'': they do not change during relocation.
3654 @cindex undefined section
3655 @item undefined section
3656 This ``section'' is a catch-all for address references to objects not in
3657 the preceding sections.
3658 @c FIXME: ref to some other doc on obj-file formats could go here.
3659 @end table
3661 @cindex relocation example
3662 An idealized example of three relocatable sections follows.
3663 @ifset COFF-ELF
3664 The example uses the traditional section names @samp{.text} and @samp{.data}.
3665 @end ifset
3666 Memory addresses are on the horizontal axis.
3668 @c TEXI2ROFF-KILL
3669 @ifnottex
3670 @c END TEXI2ROFF-KILL
3671 @smallexample
3672                       +-----+----+--+
3673 partial program # 1:  |ttttt|dddd|00|
3674                       +-----+----+--+
3676                       text   data bss
3677                       seg.   seg. seg.
3679                       +---+---+---+
3680 partial program # 2:  |TTT|DDD|000|
3681                       +---+---+---+
3683                       +--+---+-----+--+----+---+-----+~~
3684 linked program:       |  |TTT|ttttt|  |dddd|DDD|00000|
3685                       +--+---+-----+--+----+---+-----+~~
3687     addresses:        0 @dots{}
3688 @end smallexample
3689 @c TEXI2ROFF-KILL
3690 @end ifnottex
3691 @need 5000
3692 @tex
3693 \bigskip
3694 \line{\it Partial program \#1: \hfil}
3695 \line{\ibox{2.5cm}{\tt text}\ibox{2cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
3696 \line{\boxit{2.5cm}{\tt ttttt}\boxit{2cm}{\tt dddd}\boxit{1cm}{\tt 00}\hfil}
3698 \line{\it Partial program \#2: \hfil}
3699 \line{\ibox{1cm}{\tt text}\ibox{1.5cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
3700 \line{\boxit{1cm}{\tt TTT}\boxit{1.5cm}{\tt DDDD}\boxit{1cm}{\tt 000}\hfil}
3702 \line{\it linked program: \hfil}
3703 \line{\ibox{.5cm}{}\ibox{1cm}{\tt text}\ibox{2.5cm}{}\ibox{.75cm}{}\ibox{2cm}{\tt data}\ibox{1.5cm}{}\ibox{2cm}{\tt bss}\hfil}
3704 \line{\boxit{.5cm}{}\boxit{1cm}{\tt TTT}\boxit{2.5cm}{\tt
3705 ttttt}\boxit{.75cm}{}\boxit{2cm}{\tt dddd}\boxit{1.5cm}{\tt
3706 DDDD}\boxit{2cm}{\tt 00000}\ \dots\hfil}
3708 \line{\it addresses: \hfil}
3709 \line{0\dots\hfil}
3711 @end tex
3712 @c END TEXI2ROFF-KILL
3714 @node As Sections
3715 @section Assembler Internal Sections
3717 @cindex internal assembler sections
3718 @cindex sections in messages, internal
3719 These sections are meant only for the internal use of @command{@value{AS}}.  They
3720 have no meaning at run-time.  You do not really need to know about these
3721 sections for most purposes; but they can be mentioned in @command{@value{AS}}
3722 warning messages, so it might be helpful to have an idea of their
3723 meanings to @command{@value{AS}}.  These sections are used to permit the
3724 value of every expression in your assembly language program to be a
3725 section-relative address.
3727 @table @b
3728 @cindex assembler internal logic error
3729 @item ASSEMBLER-INTERNAL-LOGIC-ERROR!
3730 An internal assembler logic error has been found.  This means there is a
3731 bug in the assembler.
3733 @cindex expr (internal section)
3734 @item expr section
3735 The assembler stores complex expressions internally as combinations of
3736 symbols.  When it needs to represent an expression as a symbol, it puts
3737 it in the expr section.
3738 @c FIXME item debug
3739 @c FIXME item transfer[t] vector preload
3740 @c FIXME item transfer[t] vector postload
3741 @c FIXME item register
3742 @end table
3744 @node Sub-Sections
3745 @section Sub-Sections
3747 @cindex numbered subsections
3748 @cindex grouping data
3749 @ifset aout
3750 Assembled bytes
3751 @ifset COFF-ELF
3752 conventionally
3753 @end ifset
3754 fall into two sections: text and data.
3755 @end ifset
3756 You may have separate groups of
3757 @ifset GENERIC
3758 data in named sections
3759 @end ifset
3760 @ifclear GENERIC
3761 @ifclear aout
3762 data in named sections
3763 @end ifclear
3764 @ifset aout
3765 text or data
3766 @end ifset
3767 @end ifclear
3768 that you want to end up near to each other in the object file, even though they
3769 are not contiguous in the assembler source.  @command{@value{AS}} allows you to
3770 use @dfn{subsections} for this purpose.  Within each section, there can be
3771 numbered subsections with values from 0 to 8192.  Objects assembled into the
3772 same subsection go into the object file together with other objects in the same
3773 subsection.  For example, a compiler might want to store constants in the text
3774 section, but might not want to have them interspersed with the program being
3775 assembled.  In this case, the compiler could issue a @samp{.text 0} before each
3776 section of code being output, and a @samp{.text 1} before each group of
3777 constants being output.
3779 Subsections are optional.  If you do not use subsections, everything
3780 goes in subsection number zero.
3782 @ifset GENERIC
3783 Each subsection is zero-padded up to a multiple of four bytes.
3784 (Subsections may be padded a different amount on different flavors
3785 of @command{@value{AS}}.)
3786 @end ifset
3787 @ifclear GENERIC
3788 @ifset H8
3789 On the H8/300 platform, each subsection is zero-padded to a word
3790 boundary (two bytes).
3791 The same is true on the Renesas SH.
3792 @end ifset
3793 @end ifclear
3795 Subsections appear in your object file in numeric order, lowest numbered
3796 to highest.  (All this to be compatible with other people's assemblers.)
3797 The object file contains no representation of subsections; @code{@value{LD}} and
3798 other programs that manipulate object files see no trace of them.
3799 They just see all your text subsections as a text section, and all your
3800 data subsections as a data section.
3802 To specify which subsection you want subsequent statements assembled
3803 into, use a numeric argument to specify it, in a @samp{.text
3804 @var{expression}} or a @samp{.data @var{expression}} statement.
3805 @ifset COFF
3806 @ifset GENERIC
3807 When generating COFF output, you
3808 @end ifset
3809 @ifclear GENERIC
3811 @end ifclear
3812 can also use an extra subsection
3813 argument with arbitrary named sections: @samp{.section @var{name},
3814 @var{expression}}.
3815 @end ifset
3816 @ifset ELF
3817 @ifset GENERIC
3818 When generating ELF output, you
3819 @end ifset
3820 @ifclear GENERIC
3822 @end ifclear
3823 can also use the @code{.subsection} directive (@pxref{SubSection})
3824 to specify a subsection: @samp{.subsection @var{expression}}.
3825 @end ifset
3826 @var{Expression} should be an absolute expression
3827 (@pxref{Expressions}).  If you just say @samp{.text} then @samp{.text 0}
3828 is assumed.  Likewise @samp{.data} means @samp{.data 0}.  Assembly
3829 begins in @code{text 0}.  For instance:
3830 @smallexample
3831 .text 0     # The default subsection is text 0 anyway.
3832 .ascii "This lives in the first text subsection. *"
3833 .text 1
3834 .ascii "But this lives in the second text subsection."
3835 .data 0
3836 .ascii "This lives in the data section,"
3837 .ascii "in the first data subsection."
3838 .text 0
3839 .ascii "This lives in the first text section,"
3840 .ascii "immediately following the asterisk (*)."
3841 @end smallexample
3843 Each section has a @dfn{location counter} incremented by one for every byte
3844 assembled into that section.  Because subsections are merely a convenience
3845 restricted to @command{@value{AS}} there is no concept of a subsection location
3846 counter.  There is no way to directly manipulate a location counter---but the
3847 @code{.align} directive changes it, and any label definition captures its
3848 current value.  The location counter of the section where statements are being
3849 assembled is said to be the @dfn{active} location counter.
3851 @node bss
3852 @section bss Section
3854 @cindex bss section
3855 @cindex common variable storage
3856 The bss section is used for local common variable storage.
3857 You may allocate address space in the bss section, but you may
3858 not dictate data to load into it before your program executes.  When
3859 your program starts running, all the contents of the bss
3860 section are zeroed bytes.
3862 The @code{.lcomm} pseudo-op defines a symbol in the bss section; see
3863 @ref{Lcomm,,@code{.lcomm}}.
3865 The @code{.comm} pseudo-op may be used to declare a common symbol, which is
3866 another form of uninitialized symbol; see @ref{Comm,,@code{.comm}}.
3868 @ifset GENERIC
3869 When assembling for a target which supports multiple sections, such as ELF or
3870 COFF, you may switch into the @code{.bss} section and define symbols as usual;
3871 see @ref{Section,,@code{.section}}.  You may only assemble zero values into the
3872 section.  Typically the section will only contain symbol definitions and
3873 @code{.skip} directives (@pxref{Skip,,@code{.skip}}).
3874 @end ifset
3876 @node Symbols
3877 @chapter Symbols
3879 @cindex symbols
3880 Symbols are a central concept: the programmer uses symbols to name
3881 things, the linker uses symbols to link, and the debugger uses symbols
3882 to debug.
3884 @quotation
3885 @cindex debuggers, and symbol order
3886 @emph{Warning:} @command{@value{AS}} does not place symbols in the object file in
3887 the same order they were declared.  This may break some debuggers.
3888 @end quotation
3890 @menu
3891 * Labels::                      Labels
3892 * Setting Symbols::             Giving Symbols Other Values
3893 * Symbol Names::                Symbol Names
3894 * Dot::                         The Special Dot Symbol
3895 * Symbol Attributes::           Symbol Attributes
3896 @end menu
3898 @node Labels
3899 @section Labels
3901 @cindex labels
3902 A @dfn{label} is written as a symbol immediately followed by a colon
3903 @samp{:}.  The symbol then represents the current value of the
3904 active location counter, and is, for example, a suitable instruction
3905 operand.  You are warned if you use the same symbol to represent two
3906 different locations: the first definition overrides any other
3907 definitions.
3909 @ifset HPPA
3910 On the HPPA, the usual form for a label need not be immediately followed by a
3911 colon, but instead must start in column zero.  Only one label may be defined on
3912 a single line.  To work around this, the HPPA version of @command{@value{AS}} also
3913 provides a special directive @code{.label} for defining labels more flexibly.
3914 @end ifset
3916 @node Setting Symbols
3917 @section Giving Symbols Other Values
3919 @cindex assigning values to symbols
3920 @cindex symbol values, assigning
3921 A symbol can be given an arbitrary value by writing a symbol, followed
3922 by an equals sign @samp{=}, followed by an expression
3923 (@pxref{Expressions}).  This is equivalent to using the @code{.set}
3924 directive.  @xref{Set,,@code{.set}}.  In the same way, using a double
3925 equals sign @samp{=}@samp{=} here represents an equivalent of the
3926 @code{.eqv} directive.  @xref{Eqv,,@code{.eqv}}.
3928 @ifset Blackfin
3929 Blackfin does not support symbol assignment with @samp{=}.
3930 @end ifset
3932 @node Symbol Names
3933 @section Symbol Names
3935 @cindex symbol names
3936 @cindex names, symbol
3937 @ifclear SPECIAL-SYMS
3938 Symbol names begin with a letter or with one of @samp{._}.  On most
3939 machines, you can also use @code{$} in symbol names; exceptions are
3940 noted in @ref{Machine Dependencies}.  That character may be followed by any
3941 string of digits, letters, dollar signs (unless otherwise noted for a
3942 particular target machine), and underscores.  These restrictions do not
3943 apply when quoting symbol names by @samp{"}, which is permitted for most
3944 targets.  Escaping characters in quoted symbol names with @samp{\} generally
3945 extends only to @samp{\} itself and @samp{"}, at the time of writing.
3946 @end ifclear
3947 @ifset SPECIAL-SYMS
3948 @ifset H8
3949 Symbol names begin with a letter or with one of @samp{._}.  On the
3950 Renesas SH you can also use @code{$} in symbol names.  That
3951 character may be followed by any string of digits, letters, dollar signs (save
3952 on the H8/300), and underscores.
3953 @end ifset
3954 @end ifset
3956 Case of letters is significant: @code{foo} is a different symbol name
3957 than @code{Foo}.
3959 Symbol names do not start with a digit.  An exception to this rule is made for
3960 Local Labels.  See below.
3962 Multibyte characters are supported, but note that the setting of the
3963 @option{multibyte-handling} option might prevent their use.
3964 To generate a symbol name containing
3965 multibyte characters enclose it within double quotes and use escape codes. cf
3966 @xref{Strings}.  Generating a multibyte symbol name from a label is not
3967 currently supported.
3969 Since multibyte symbol names are unusual, and could possibly be used
3970 maliciously, @command{@value{AS}} provides a command line option
3971 (@option{--multibyte-handling=warn-sym-only}) which can be used to generate a
3972 warning message whenever a symbol name containing multibyte characters is defined.
3974 Each symbol has exactly one name.  Each name in an assembly language program
3975 refers to exactly one symbol.  You may use that symbol name any number of times
3976 in a program.
3978 @subheading Local Symbol Names
3980 @cindex local symbol names
3981 @cindex symbol names, local
3982 A local symbol is any symbol beginning with certain local label prefixes.
3983 By default, the local label prefix is @samp{.L} for ELF systems or
3984 @samp{L} for traditional a.out systems, but each target may have its own
3985 set of local label prefixes.
3986 @ifset HPPA
3987 On the HPPA local symbols begin with @samp{L$}.
3988 @end ifset
3990 Local symbols are defined and used within the assembler, but they are
3991 normally not saved in object files.  Thus, they are not visible when debugging.
3992 You may use the @samp{-L} option (@pxref{L, ,Include Local Symbols})
3993 to retain the local symbols in the object files.
3995 @subheading Local Labels
3997 @cindex local labels
3998 @cindex temporary symbol names
3999 @cindex symbol names, temporary
4000 Local labels are different from local symbols.  Local labels help compilers and
4001 programmers use names temporarily.  They create symbols which are guaranteed to
4002 be unique over the entire scope of the input source code and which can be
4003 referred to by a simple notation.  To define a local label, write a label of
4004 the form @samp{@b{N}:} (where @b{N} represents any non-negative integer).
4005 To refer to the most recent previous definition of that label write
4006 @samp{@b{N}b}, using the same number as when you defined the label.  To refer
4007 to the next definition of a local label, write @samp{@b{N}f}.  The @samp{b}
4008 stands for ``backwards'' and the @samp{f} stands for ``forwards''.
4010 There is no restriction on how you can use these labels, and you can reuse them
4011 too.  So that it is possible to repeatedly define the same local label (using
4012 the same number @samp{@b{N}}), although you can only refer to the most recently
4013 defined local label of that number (for a backwards reference) or the next
4014 definition of a specific local label for a forward reference.  It is also worth
4015 noting that the first 10 local labels (@samp{@b{0:}}@dots{}@samp{@b{9:}}) are
4016 implemented in a slightly more efficient manner than the others.
4018 Here is an example:
4020 @smallexample
4021 1:        branch 1f
4022 2:        branch 1b
4023 1:        branch 2f
4024 2:        branch 1b
4025 @end smallexample
4027 Which is the equivalent of:
4029 @smallexample
4030 label_1:  branch label_3
4031 label_2:  branch label_1
4032 label_3:  branch label_4
4033 label_4:  branch label_3
4034 @end smallexample
4036 Local label names are only a notational device.  They are immediately
4037 transformed into more conventional symbol names before the assembler uses them.
4038 The symbol names are stored in the symbol table, appear in error messages, and
4039 are optionally emitted to the object file.  The names are constructed using
4040 these parts:
4042 @table @code
4043 @item @emph{local label prefix}
4044 All local symbols begin with the system-specific local label prefix.
4045 Normally both @command{@value{AS}} and @code{@value{LD}} forget symbols
4046 that start with the local label prefix.  These labels are
4047 used for symbols you are never intended to see.  If you use the
4048 @samp{-L} option then @command{@value{AS}} retains these symbols in the
4049 object file. If you also instruct @code{@value{LD}} to retain these symbols,
4050 you may use them in debugging.
4052 @item @var{number}
4053 This is the number that was used in the local label definition.  So if the
4054 label is written @samp{55:} then the number is @samp{55}.
4056 @item @kbd{C-B}
4057 This unusual character is included so you do not accidentally invent a symbol
4058 of the same name.  The character has ASCII value of @samp{\002} (control-B).
4060 @item @emph{ordinal number}
4061 This is a serial number to keep the labels distinct.  The first definition of
4062 @samp{0:} gets the number @samp{1}.  The 15th definition of @samp{0:} gets the
4063 number @samp{15}, and so on.  Likewise the first definition of @samp{1:} gets
4064 the number @samp{1} and its 15th definition gets @samp{15} as well.
4065 @end table
4067 So for example, the first @code{1:} may be named @code{.L1@kbd{C-B}1}, and
4068 the 44th @code{3:} may be named @code{.L3@kbd{C-B}44}.
4070 @subheading Dollar Local Labels
4071 @cindex dollar local symbols
4073 On some targets @code{@value{AS}} also supports an even more local form of
4074 local labels called dollar labels.  These labels go out of scope (i.e., they
4075 become undefined) as soon as a non-local label is defined.  Thus they remain
4076 valid for only a small region of the input source code.  Normal local labels,
4077 by contrast, remain in scope for the entire file, or until they are redefined
4078 by another occurrence of the same local label.
4080 Dollar labels are defined in exactly the same way as ordinary local labels,
4081 except that they have a dollar sign suffix to their numeric value, e.g.,
4082 @samp{@b{55$:}}.
4084 They can also be distinguished from ordinary local labels by their transformed
4085 names which use ASCII character @samp{\001} (control-A) as the magic character
4086 to distinguish them from ordinary labels.  For example, the fifth definition of
4087 @samp{6$} may be named @samp{.L6@kbd{C-A}5}.
4089 @node Dot
4090 @section The Special Dot Symbol
4092 @cindex dot (symbol)
4093 @cindex @code{.} (symbol)
4094 @cindex current address
4095 @cindex location counter
4096 The special symbol @samp{.} refers to the current address that
4097 @command{@value{AS}} is assembling into.  Thus, the expression @samp{melvin:
4098 .long .} defines @code{melvin} to contain its own address.
4099 Assigning a value to @code{.} is treated the same as a @code{.org}
4100 directive.
4101 @ifclear no-space-dir
4102 Thus, the expression @samp{.=.+4} is the same as saying
4103 @samp{.space 4}.
4104 @end ifclear
4106 @node Symbol Attributes
4107 @section Symbol Attributes
4109 @cindex symbol attributes
4110 @cindex attributes, symbol
4111 Every symbol has, as well as its name, the attributes ``Value'' and
4112 ``Type''.  Depending on output format, symbols can also have auxiliary
4113 attributes.
4114 @ifset INTERNALS
4115 The detailed definitions are in @file{a.out.h}.
4116 @end ifset
4118 If you use a symbol without defining it, @command{@value{AS}} assumes zero for
4119 all these attributes, and probably won't warn you.  This makes the
4120 symbol an externally defined symbol, which is generally what you
4121 would want.
4123 @menu
4124 * Symbol Value::                Value
4125 * Symbol Type::                 Type
4126 @ifset aout
4127 * a.out Symbols::               Symbol Attributes: @code{a.out}
4128 @end ifset
4129 @ifset COFF
4130 * COFF Symbols::                Symbol Attributes for COFF
4131 @end ifset
4132 @ifset SOM
4133 * SOM Symbols::                Symbol Attributes for SOM
4134 @end ifset
4135 @end menu
4137 @node Symbol Value
4138 @subsection Value
4140 @cindex value of a symbol
4141 @cindex symbol value
4142 The value of a symbol is (usually) 32 bits.  For a symbol which labels a
4143 location in the text, data, bss or absolute sections the value is the
4144 number of addresses from the start of that section to the label.
4145 Naturally for text, data and bss sections the value of a symbol changes
4146 as @code{@value{LD}} changes section base addresses during linking.  Absolute
4147 symbols' values do not change during linking: that is why they are
4148 called absolute.
4150 The value of an undefined symbol is treated in a special way.  If it is
4151 0 then the symbol is not defined in this assembler source file, and
4152 @code{@value{LD}} tries to determine its value from other files linked into the
4153 same program.  You make this kind of symbol simply by mentioning a symbol
4154 name without defining it.  A non-zero value represents a @code{.comm}
4155 common declaration.  The value is how much common storage to reserve, in
4156 bytes (addresses).  The symbol refers to the first address of the
4157 allocated storage.
4159 @node Symbol Type
4160 @subsection Type
4162 @cindex type of a symbol
4163 @cindex symbol type
4164 The type attribute of a symbol contains relocation (section)
4165 information, any flag settings indicating that a symbol is external, and
4166 (optionally), other information for linkers and debuggers.  The exact
4167 format depends on the object-code output format in use.
4169 @ifset aout
4170 @node a.out Symbols
4171 @subsection Symbol Attributes: @code{a.out}
4173 @cindex @code{a.out} symbol attributes
4174 @cindex symbol attributes, @code{a.out}
4176 @menu
4177 * Symbol Desc::                 Descriptor
4178 * Symbol Other::                Other
4179 @end menu
4181 @node Symbol Desc
4182 @subsubsection Descriptor
4184 @cindex descriptor, of @code{a.out} symbol
4185 This is an arbitrary 16-bit value.  You may establish a symbol's
4186 descriptor value by using a @code{.desc} statement
4187 (@pxref{Desc,,@code{.desc}}).  A descriptor value means nothing to
4188 @command{@value{AS}}.
4190 @node Symbol Other
4191 @subsubsection Other
4193 @cindex other attribute, of @code{a.out} symbol
4194 This is an arbitrary 8-bit value.  It means nothing to @command{@value{AS}}.
4195 @end ifset
4197 @ifset COFF
4198 @node COFF Symbols
4199 @subsection Symbol Attributes for COFF
4201 @cindex COFF symbol attributes
4202 @cindex symbol attributes, COFF
4204 The COFF format supports a multitude of auxiliary symbol attributes;
4205 like the primary symbol attributes, they are set between @code{.def} and
4206 @code{.endef} directives.
4208 @subsubsection Primary Attributes
4210 @cindex primary attributes, COFF symbols
4211 The symbol name is set with @code{.def}; the value and type,
4212 respectively, with @code{.val} and @code{.type}.
4214 @subsubsection Auxiliary Attributes
4216 @cindex auxiliary attributes, COFF symbols
4217 The @command{@value{AS}} directives @code{.dim}, @code{.line}, @code{.scl},
4218 @code{.size}, @code{.tag}, and @code{.weak} can generate auxiliary symbol
4219 table information for COFF.
4220 @end ifset
4222 @ifset SOM
4223 @node SOM Symbols
4224 @subsection Symbol Attributes for SOM
4226 @cindex SOM symbol attributes
4227 @cindex symbol attributes, SOM
4229 The SOM format for the HPPA supports a multitude of symbol attributes set with
4230 the @code{.EXPORT} and @code{.IMPORT} directives.
4232 The attributes are described in @cite{HP9000 Series 800 Assembly
4233 Language Reference Manual} (HP 92432-90001) under the @code{IMPORT} and
4234 @code{EXPORT} assembler directive documentation.
4235 @end ifset
4237 @node Expressions
4238 @chapter Expressions
4240 @cindex expressions
4241 @cindex addresses
4242 @cindex numeric values
4243 An @dfn{expression} specifies an address or numeric value.
4244 Whitespace may precede and/or follow an expression.
4246 The result of an expression must be an absolute number, or else an offset into
4247 a particular section.  If an expression is not absolute, and there is not
4248 enough information when @command{@value{AS}} sees the expression to know its
4249 section, a second pass over the source program might be necessary to interpret
4250 the expression---but the second pass is currently not implemented.
4251 @command{@value{AS}} aborts with an error message in this situation.
4253 @menu
4254 * Empty Exprs::                 Empty Expressions
4255 * Integer Exprs::               Integer Expressions
4256 @end menu
4258 @node Empty Exprs
4259 @section Empty Expressions
4261 @cindex empty expressions
4262 @cindex expressions, empty
4263 An empty expression has no value: it is just whitespace or null.
4264 Wherever an absolute expression is required, you may omit the
4265 expression, and @command{@value{AS}} assumes a value of (absolute) 0.  This
4266 is compatible with other assemblers.
4268 @node Integer Exprs
4269 @section Integer Expressions
4271 @cindex integer expressions
4272 @cindex expressions, integer
4273 An @dfn{integer expression} is one or more @emph{arguments} delimited
4274 by @emph{operators}.
4276 @menu
4277 * Arguments::                   Arguments
4278 * Operators::                   Operators
4279 * Prefix Ops::                  Prefix Operators
4280 * Infix Ops::                   Infix Operators
4281 @end menu
4283 @node Arguments
4284 @subsection Arguments
4286 @cindex expression arguments
4287 @cindex arguments in expressions
4288 @cindex operands in expressions
4289 @cindex arithmetic operands
4290 @dfn{Arguments} are symbols, numbers or subexpressions.  In other
4291 contexts arguments are sometimes called ``arithmetic operands''.  In
4292 this manual, to avoid confusing them with the ``instruction operands'' of
4293 the machine language, we use the term ``argument'' to refer to parts of
4294 expressions only, reserving the word ``operand'' to refer only to machine
4295 instruction operands.
4297 Symbols are evaluated to yield @{@var{section} @var{NNN}@} where
4298 @var{section} is one of text, data, bss, absolute,
4299 or undefined.  @var{NNN} is a signed, 2's complement 32 bit
4300 integer.
4302 Numbers are usually integers.
4304 A number can be a flonum or bignum.  In this case, you are warned
4305 that only the low order 32 bits are used, and @command{@value{AS}} pretends
4306 these 32 bits are an integer.  You may write integer-manipulating
4307 instructions that act on exotic constants, compatible with other
4308 assemblers.
4310 @cindex subexpressions
4311 Subexpressions are a left parenthesis @samp{(} followed by an integer
4312 expression, followed by a right parenthesis @samp{)}; or a prefix
4313 operator followed by an argument.
4315 @node Operators
4316 @subsection Operators
4318 @cindex operators, in expressions
4319 @cindex arithmetic functions
4320 @cindex functions, in expressions
4321 @dfn{Operators} are arithmetic functions, like @code{+} or @code{%}.  Prefix
4322 operators are followed by an argument.  Infix operators appear
4323 between their arguments.  Operators may be preceded and/or followed by
4324 whitespace.
4326 @node Prefix Ops
4327 @subsection Prefix Operator
4329 @cindex prefix operators
4330 @command{@value{AS}} has the following @dfn{prefix operators}.  They each take
4331 one argument, which must be absolute.
4333 @c the tex/end tex stuff surrounding this small table is meant to make
4334 @c it align, on the printed page, with the similar table in the next
4335 @c section (which is inside an enumerate).
4336 @tex
4337 \global\advance\leftskip by \itemindent
4338 @end tex
4340 @table @code
4341 @item -
4342 @dfn{Negation}.  Two's complement negation.
4343 @item ~
4344 @dfn{Complementation}.  Bitwise not.
4345 @end table
4347 @tex
4348 \global\advance\leftskip by -\itemindent
4349 @end tex
4351 @node Infix Ops
4352 @subsection Infix Operators
4354 @cindex infix operators
4355 @cindex operators, permitted arguments
4356 @dfn{Infix operators} take two arguments, one on either side.  Operators
4357 have precedence, but operations with equal precedence are performed left
4358 to right.  Apart from @code{+} or @option{-}, both arguments must be
4359 absolute, and the result is absolute.
4361 @enumerate
4362 @cindex operator precedence
4363 @cindex precedence of operators
4365 @item
4366 Highest Precedence
4368 @table @code
4369 @item *
4370 @dfn{Multiplication}.
4372 @item /
4373 @dfn{Division}.  Truncation is the same as the C operator @samp{/}
4375 @item %
4376 @dfn{Remainder}.
4378 @item <<
4379 @dfn{Shift Left}.  Same as the C operator @samp{<<}.
4381 @item >>
4382 @dfn{Shift Right}.  Same as the C operator @samp{>>}.
4383 @end table
4385 @item
4386 Intermediate precedence
4388 @table @code
4389 @item |
4391 @dfn{Bitwise Inclusive Or}.
4393 @item &
4394 @dfn{Bitwise And}.
4396 @item ^
4397 @dfn{Bitwise Exclusive Or}.
4399 @item !
4400 @dfn{Bitwise Or Not}.
4401 @end table
4403 @item
4404 Low Precedence
4406 @table @code
4407 @cindex addition, permitted arguments
4408 @cindex plus, permitted arguments
4409 @cindex arguments for addition
4410 @item +
4411 @dfn{Addition}.  If either argument is absolute, the result has the section of
4412 the other argument.  You may not add together arguments from different
4413 sections.
4415 @cindex subtraction, permitted arguments
4416 @cindex minus, permitted arguments
4417 @cindex arguments for subtraction
4418 @item -
4419 @dfn{Subtraction}.  If the right argument is absolute, the
4420 result has the section of the left argument.
4421 If both arguments are in the same section, the result is absolute.
4422 You may not subtract arguments from different sections.
4423 @c FIXME is there still something useful to say about undefined - undefined ?
4425 @cindex comparison expressions
4426 @cindex expressions, comparison
4427 @item  ==
4428 @dfn{Is Equal To}
4429 @item <>
4430 @itemx !=
4431 @dfn{Is Not Equal To}
4432 @item <
4433 @dfn{Is Less Than}
4434 @item >
4435 @dfn{Is Greater Than}
4436 @item >=
4437 @dfn{Is Greater Than Or Equal To}
4438 @item <=
4439 @dfn{Is Less Than Or Equal To}
4441 The comparison operators can be used as infix operators.  A true result has a
4442 value of -1 whereas a false result has a value of 0.  Note, these operators
4443 perform signed comparisons.
4444 @end table
4446 @item Lowest Precedence
4448 @table @code
4449 @item &&
4450 @dfn{Logical And}.
4452 @item ||
4453 @dfn{Logical Or}.
4455 These two logical operations can be used to combine the results of sub
4456 expressions.  Note, unlike the comparison operators a true result returns a
4457 value of 1 but a false result does still return 0.  Also note that the logical
4458 or operator has a slightly lower precedence than logical and.
4460 @end table
4461 @end enumerate
4463 In short, it's only meaningful to add or subtract the @emph{offsets} in an
4464 address; you can only have a defined section in one of the two arguments.
4466 @node Pseudo Ops
4467 @chapter Assembler Directives
4469 @cindex directives, machine independent
4470 @cindex pseudo-ops, machine independent
4471 @cindex machine independent directives
4472 All assembler directives have names that begin with a period (@samp{.}).
4473 The names are case insensitive for most targets, and usually written
4474 in lower case.
4476 This chapter discusses directives that are available regardless of the
4477 target machine configuration for the @sc{gnu} assembler.
4478 @ifset GENERIC
4479 Some machine configurations provide additional directives.
4480 @xref{Machine Dependencies}.
4481 @end ifset
4482 @ifclear GENERIC
4483 @ifset machine-directives
4484 @xref{Machine Dependencies}, for additional directives.
4485 @end ifset
4486 @end ifclear
4488 @menu
4489 * Abort::                       @code{.abort}
4490 @ifset COFF
4491 * ABORT (COFF)::                @code{.ABORT}
4492 @end ifset
4494 * Align::                       @code{.align [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
4495 * Altmacro::                    @code{.altmacro}
4496 * Ascii::                       @code{.ascii "@var{string}"}@dots{}
4497 * Asciz::                       @code{.asciz "@var{string}"}@dots{}
4498 * Attach_to_group::             @code{.attach_to_group @var{name}}
4499 * Balign::                      @code{.balign [@var{abs-expr}[, @var{abs-expr}]]}
4500 @ifset ELF
4501 * Bss::                         @code{.bss @var{subsection}}
4502 @end ifset
4503 @ifclear ELF
4504 * Bss::                         @code{.bss}
4505 @end ifclear
4506 * Bundle directives::           @code{.bundle_align_mode @var{abs-expr}}, etc
4507 * Byte::                        @code{.byte @var{expressions}}
4508 * CFI directives::              @code{.cfi_startproc [simple]}, @code{.cfi_endproc}, etc.
4509 * Comm::                        @code{.comm @var{symbol} , @var{length} }
4510 * Data::                        @code{.data @var{subsection}}
4511 * Dc::                          @code{.dc[@var{size}] @var{expressions}}
4512 * Dcb::                         @code{.dcb[@var{size}] @var{number} [,@var{fill}]}
4513 * Ds::                          @code{.ds[@var{size}] @var{number} [,@var{fill}]}
4514 @ifset COFF
4515 * Def::                         @code{.def @var{name}}
4516 @end ifset
4517 @ifset aout
4518 * Desc::                        @code{.desc @var{symbol}, @var{abs-expression}}
4519 @end ifset
4520 @ifset COFF
4521 * Dim::                         @code{.dim}
4522 @end ifset
4524 * Double::                      @code{.double @var{flonums}}
4525 * Eject::                       @code{.eject}
4526 * Else::                        @code{.else}
4527 * Elseif::                      @code{.elseif}
4528 * End::                         @code{.end}
4529 @ifset COFF
4530 * Endef::                       @code{.endef}
4531 @end ifset
4533 * Endfunc::                     @code{.endfunc}
4534 * Endif::                       @code{.endif}
4535 * Equ::                         @code{.equ @var{symbol}, @var{expression}}
4536 * Equiv::                       @code{.equiv @var{symbol}, @var{expression}}
4537 * Eqv::                         @code{.eqv @var{symbol}, @var{expression}}
4538 * Err::                         @code{.err}
4539 * Error::                       @code{.error @var{string}}
4540 * Exitm::                       @code{.exitm}
4541 * Extern::                      @code{.extern}
4542 * Fail::                        @code{.fail}
4543 * File::                        @code{.file}
4544 * Fill::                        @code{.fill @var{repeat} , @var{size} , @var{value}}
4545 * Float::                       @code{.float @var{flonums}}
4546 * Func::                        @code{.func}
4547 * Global::                      @code{.global @var{symbol}}, @code{.globl @var{symbol}}
4548 @ifset ELF
4549 * Gnu_attribute::               @code{.gnu_attribute @var{tag},@var{value}}
4550 * Hidden::                      @code{.hidden @var{names}}
4551 @end ifset
4553 * hword::                       @code{.hword @var{expressions}}
4554 * Ident::                       @code{.ident}
4555 * If::                          @code{.if @var{absolute expression}}
4556 * Incbin::                      @code{.incbin "@var{file}"[,@var{skip}[,@var{count}]]}
4557 * Include::                     @code{.include "@var{file}"}
4558 * Int::                         @code{.int @var{expressions}}
4559 @ifset ELF
4560 * Internal::                    @code{.internal @var{names}}
4561 @end ifset
4563 * Irp::                         @code{.irp @var{symbol},@var{values}}@dots{}
4564 * Irpc::                        @code{.irpc @var{symbol},@var{values}}@dots{}
4565 * Lcomm::                       @code{.lcomm @var{symbol} , @var{length}}
4566 * Lflags::                      @code{.lflags}
4567 @ifclear no-line-dir
4568 * Line::                        @code{.line @var{line-number}}
4569 @end ifclear
4571 * Linkonce::                    @code{.linkonce [@var{type}]}
4572 * List::                        @code{.list}
4573 * Ln::                          @code{.ln @var{line-number}}
4574 * Loc::                         @code{.loc @var{fileno} @var{lineno}}
4575 * Loc_mark_labels::             @code{.loc_mark_labels @var{enable}}
4576 @ifset ELF
4577 * Local::                       @code{.local @var{names}}
4578 @end ifset
4580 * Long::                        @code{.long @var{expressions}}
4581 @ignore
4582 * Lsym::                        @code{.lsym @var{symbol}, @var{expression}}
4583 @end ignore
4585 * Macro::                       @code{.macro @var{name} @var{args}}@dots{}
4586 * MRI::                         @code{.mri @var{val}}
4587 * Noaltmacro::                  @code{.noaltmacro}
4588 * Nolist::                      @code{.nolist}
4589 * Nop::                         @code{.nop}
4590 * Nops::                        @code{.nops @var{size}[, @var{control}]}
4591 * Octa::                        @code{.octa @var{bignums}}
4592 * Offset::                      @code{.offset @var{loc}}
4593 * Org::                         @code{.org @var{new-lc}, @var{fill}}
4594 * P2align::                     @code{.p2align [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
4595 @ifset ELF
4596 * PopSection::                  @code{.popsection}
4597 * Previous::                    @code{.previous}
4598 @end ifset
4600 * Print::                       @code{.print @var{string}}
4601 @ifset ELF
4602 * Protected::                   @code{.protected @var{names}}
4603 @end ifset
4605 * Psize::                       @code{.psize @var{lines}, @var{columns}}
4606 * Purgem::                      @code{.purgem @var{name}}
4607 @ifset ELF
4608 * PushSection::                 @code{.pushsection @var{name}}
4609 @end ifset
4611 * Quad::                        @code{.quad @var{bignums}}
4612 * Reloc::                       @code{.reloc @var{offset}, @var{reloc_name}[, @var{expression}]}
4613 * Rept::                        @code{.rept @var{count}}
4614 * Sbttl::                       @code{.sbttl "@var{subheading}"}
4615 @ifset COFF
4616 * Scl::                         @code{.scl @var{class}}
4617 @end ifset
4618 @ifset COFF-ELF
4619 * Section::                     @code{.section @var{name}[, @var{flags}]}
4620 @end ifset
4622 * Set::                         @code{.set @var{symbol}, @var{expression}}
4623 * Short::                       @code{.short @var{expressions}}
4624 * Single::                      @code{.single @var{flonums}}
4625 @ifset COFF-ELF
4626 * Size::                        @code{.size [@var{name} , @var{expression}]}
4627 @end ifset
4628 @ifclear no-space-dir
4629 * Skip::                        @code{.skip @var{size} [,@var{fill}]}
4630 @end ifclear
4632 * Sleb128::                     @code{.sleb128 @var{expressions}}
4633 @ifclear no-space-dir
4634 * Space::                       @code{.space @var{size} [,@var{fill}]}
4635 @end ifclear
4636 @ifset have-stabs
4637 * Stab::                        @code{.stabd, .stabn, .stabs}
4638 @end ifset
4640 * String::                      @code{.string "@var{str}"}, @code{.string8 "@var{str}"}, @code{.string16 "@var{str}"}, @code{.string32 "@var{str}"}, @code{.string64 "@var{str}"}
4641 * Struct::                      @code{.struct @var{expression}}
4642 @ifset ELF
4643 * SubSection::                  @code{.subsection}
4644 * Symver::                      @code{.symver @var{name},@var{name2@@nodename}[,@var{visibility}]}
4645 @end ifset
4647 @ifset COFF
4648 * Tag::                         @code{.tag @var{structname}}
4649 @end ifset
4651 * Text::                        @code{.text @var{subsection}}
4652 * Title::                       @code{.title "@var{heading}"}
4653 @ifset ELF
4654 * Tls_common::                  @code{.tls_common @var{symbol}, @var{length}[, @var{alignment}]}
4655 @end ifset
4656 @ifset COFF-ELF
4657 * Type::                        @code{.type <@var{int} | @var{name} , @var{type description}>}
4658 @end ifset
4660 * Uleb128::                     @code{.uleb128 @var{expressions}}
4661 @ifset COFF
4662 * Val::                         @code{.val @var{addr}}
4663 @end ifset
4665 @ifset ELF
4666 * Version::                     @code{.version "@var{string}"}
4667 * VTableEntry::                 @code{.vtable_entry @var{table}, @var{offset}}
4668 * VTableInherit::               @code{.vtable_inherit @var{child}, @var{parent}}
4669 @end ifset
4671 * Warning::                     @code{.warning @var{string}}
4672 * Weak::                        @code{.weak @var{names}}
4673 * Weakref::                     @code{.weakref @var{alias}, @var{symbol}}
4674 * Word::                        @code{.word @var{expressions}}
4675 @ifclear no-space-dir
4676 * Zero::                        @code{.zero @var{size}}
4677 @end ifclear
4678 * 2byte::                       @code{.2byte @var{expressions}}
4679 * 4byte::                       @code{.4byte @var{expressions}}
4680 * 8byte::                       @code{.8byte @var{expressions}}
4681 * Deprecated::                  Deprecated Directives
4682 @end menu
4684 @node Abort
4685 @section @code{.abort}
4687 @cindex @code{abort} directive
4688 @cindex stopping the assembly
4689 This directive stops the assembly immediately.  It is for
4690 compatibility with other assemblers.  The original idea was that the
4691 assembly language source would be piped into the assembler.  If the sender
4692 of the source quit, it could use this directive tells @command{@value{AS}} to
4693 quit also.  One day @code{.abort} will not be supported.
4695 @ifset COFF
4696 @node ABORT (COFF)
4697 @section @code{.ABORT} (COFF)
4699 @cindex @code{ABORT} directive
4700 When producing COFF output, @command{@value{AS}} accepts this directive as a
4701 synonym for @samp{.abort}.
4703 @end ifset
4705 @node Align
4706 @section @code{.align [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
4708 @cindex padding the location counter
4709 @cindex @code{align} directive
4710 Pad the location counter (in the current subsection) to a particular storage
4711 boundary.  The first expression (which must be absolute) is the alignment
4712 required, as described below.  If this expression is omitted then a default
4713 value of 0 is used, effectively disabling alignment requirements.
4715 The second expression (also absolute) gives the fill value to be stored in the
4716 padding bytes.  It (and the comma) may be omitted.  If it is omitted, the
4717 padding bytes are normally zero.  However, on most systems, if the section is
4718 marked as containing code and the fill value is omitted, the space is filled
4719 with no-op instructions.
4721 The third expression is also absolute, and is also optional.  If it is present,
4722 it is the maximum number of bytes that should be skipped by this alignment
4723 directive.  If doing the alignment would require skipping more bytes than the
4724 specified maximum, then the alignment is not done at all.  You can omit the
4725 fill value (the second argument) entirely by simply using two commas after the
4726 required alignment; this can be useful if you want the alignment to be filled
4727 with no-op instructions when appropriate.
4729 The way the required alignment is specified varies from system to system.
4730 For the arc, hppa, i386 using ELF, iq2000, m68k, or1k,
4731 s390, sparc, tic4x and xtensa, the first expression is the
4732 alignment request in bytes.  For example @samp{.align 8} advances
4733 the location counter until it is a multiple of 8.  If the location counter
4734 is already a multiple of 8, no change is needed.  For the tic54x, the
4735 first expression is the alignment request in words.
4737 For other systems, including ppc, i386 using a.out format, arm and
4738 strongarm, it is the
4739 number of low-order zero bits the location counter must have after
4740 advancement.  For example @samp{.align 3} advances the location
4741 counter until it is a multiple of 8.  If the location counter is already a
4742 multiple of 8, no change is needed.
4744 This inconsistency is due to the different behaviors of the various
4745 native assemblers for these systems which GAS must emulate.
4746 GAS also provides @code{.balign} and @code{.p2align} directives,
4747 described later, which have a consistent behavior across all
4748 architectures (but are specific to GAS).
4750 @node Altmacro
4751 @section @code{.altmacro}
4752 Enable alternate macro mode, enabling:
4754 @ftable @code
4755 @item LOCAL @var{name} [ , @dots{} ]
4756 One additional directive, @code{LOCAL}, is available.  It is used to
4757 generate a string replacement for each of the @var{name} arguments, and
4758 replace any instances of @var{name} in each macro expansion.  The
4759 replacement string is unique in the assembly, and different for each
4760 separate macro expansion.  @code{LOCAL} allows you to write macros that
4761 define symbols, without fear of conflict between separate macro expansions.
4763 @item String delimiters
4764 You can write strings delimited in these other ways besides
4765 @code{"@var{string}"}:
4767 @table @code
4768 @item '@var{string}'
4769 You can delimit strings with single-quote characters.
4771 @item <@var{string}>
4772 You can delimit strings with matching angle brackets.
4773 @end table
4775 @item single-character string escape
4776 To include any single character literally in a string (even if the
4777 character would otherwise have some special meaning), you can prefix the
4778 character with @samp{!} (an exclamation mark).  For example, you can
4779 write @samp{<4.3 !> 5.4!!>} to get the literal text @samp{4.3 > 5.4!}.
4781 @item Expression results as strings
4782 You can write @samp{%@var{expr}} to evaluate the expression @var{expr}
4783 and use the result as a string.
4785 @item No passing arguments to macros based upon keyword assignment.
4786 In altmacro mode arguments cannot be passed to macros by keyword assignment.
4787 See @xref{altmacro-keyword-arguments} for more details
4788 @end ftable
4790 @node Ascii
4791 @section @code{.ascii "@var{string}"}@dots{}
4793 @cindex @code{ascii} directive
4794 @cindex string literals
4795 @code{.ascii} expects zero or more string literals (@pxref{Strings})
4796 separated by commas.  It assembles each string (with no automatic
4797 trailing zero byte) into consecutive addresses.
4799 @node Asciz
4800 @section @code{.asciz "@var{string}"}@dots{}
4802 @cindex @code{asciz} directive
4803 @cindex zero-terminated strings
4804 @cindex null-terminated strings
4805 @code{.asciz} is just like @code{.ascii}, but each string is followed by
4806 a zero byte.  The ``z'' in @samp{.asciz} stands for ``zero''.  Note that
4807 multiple string arguments not separated by commas will be concatenated
4808 together and only one final zero byte will be stored.
4810 @node Attach_to_group
4811 @section @code{.attach_to_group @var{name}}
4812 Attaches the current section to the named group.  This is like declaring
4813 the section with the @code{G} attribute, but can be done after the section
4814 has been created.  Note if the group section  does not exist at the point that
4815 this directive is used then it will be created.
4817 @node Balign
4818 @section @code{.balign[wl] [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
4820 @cindex padding the location counter given number of bytes
4821 @cindex @code{balign} directive
4822 Pad the location counter (in the current subsection) to a particular
4823 storage boundary.  The first expression (which must be absolute) is the
4824 alignment request in bytes.  For example @samp{.balign 8} advances
4825 the location counter until it is a multiple of 8.  If the location counter
4826 is already a multiple of 8, no change is needed.  If the expression is omitted
4827 then a default value of 0 is used, effectively disabling alignment requirements.
4829 The second expression (also absolute) gives the fill value to be stored in the
4830 padding bytes.  It (and the comma) may be omitted.  If it is omitted, the
4831 padding bytes are normally zero.  However, on most systems, if the section is
4832 marked as containing code and the fill value is omitted, the space is filled
4833 with no-op instructions.
4835 The third expression is also absolute, and is also optional.  If it is present,
4836 it is the maximum number of bytes that should be skipped by this alignment
4837 directive.  If doing the alignment would require skipping more bytes than the
4838 specified maximum, then the alignment is not done at all.  You can omit the
4839 fill value (the second argument) entirely by simply using two commas after the
4840 required alignment; this can be useful if you want the alignment to be filled
4841 with no-op instructions when appropriate.
4843 @cindex @code{balignw} directive
4844 @cindex @code{balignl} directive
4845 The @code{.balignw} and @code{.balignl} directives are variants of the
4846 @code{.balign} directive.  The @code{.balignw} directive treats the fill
4847 pattern as a two byte word value.  The @code{.balignl} directives treats the
4848 fill pattern as a four byte longword value.  For example, @code{.balignw
4849 4,0x368d} will align to a multiple of 4.  If it skips two bytes, they will be
4850 filled in with the value 0x368d (the exact placement of the bytes depends upon
4851 the endianness of the processor).  If it skips 1 or 3 bytes, the fill value is
4852 undefined.
4854 @ifset ELF
4855 @node Bss
4856 @section @code{.bss @var{subsection}}
4857 @end ifset
4858 @ifclear ELF
4859 @node Bss
4860 @section @code{.bss}
4861 @end ifclear
4862 @cindex @code{bss} directive
4864 @code{.bss} tells @command{@value{AS}} to assemble the following statements
4865 onto the end of the bss section.
4866 @ifset ELF
4867 For most ELF based targets an optional @var{subsection} expression (which must
4868 evaluate to a positive integer) can be provided.  In this case the statements
4869 are appended to the end of the indicated bss subsection.
4870 @end ifset
4872 @node Bundle directives
4873 @section Bundle directives
4874 @subsection @code{.bundle_align_mode @var{abs-expr}}
4875 @cindex @code{bundle_align_mode} directive
4876 @cindex bundle
4877 @cindex instruction bundle
4878 @cindex aligned instruction bundle
4879 @code{.bundle_align_mode} enables or disables @dfn{aligned instruction
4880 bundle} mode.  In this mode, sequences of adjacent instructions are grouped
4881 into fixed-sized @dfn{bundles}.  If the argument is zero, this mode is
4882 disabled (which is the default state).  If the argument it not zero, it
4883 gives the size of an instruction bundle as a power of two (as for the
4884 @code{.p2align} directive, @pxref{P2align}).
4886 For some targets, it's an ABI requirement that no instruction may span a
4887 certain aligned boundary.  A @dfn{bundle} is simply a sequence of
4888 instructions that starts on an aligned boundary.  For example, if
4889 @var{abs-expr} is @code{5} then the bundle size is 32, so each aligned
4890 chunk of 32 bytes is a bundle.  When aligned instruction bundle mode is in
4891 effect, no single instruction may span a boundary between bundles.  If an
4892 instruction would start too close to the end of a bundle for the length of
4893 that particular instruction to fit within the bundle, then the space at the
4894 end of that bundle is filled with no-op instructions so the instruction
4895 starts in the next bundle.  As a corollary, it's an error if any single
4896 instruction's encoding is longer than the bundle size.
4898 @subsection @code{.bundle_lock} and @code{.bundle_unlock}
4899 @cindex @code{bundle_lock} directive
4900 @cindex @code{bundle_unlock} directive
4901 The @code{.bundle_lock} and directive @code{.bundle_unlock} directives
4902 allow explicit control over instruction bundle padding.  These directives
4903 are only valid when @code{.bundle_align_mode} has been used to enable
4904 aligned instruction bundle mode.  It's an error if they appear when
4905 @code{.bundle_align_mode} has not been used at all, or when the last
4906 directive was @w{@code{.bundle_align_mode 0}}.
4908 @cindex bundle-locked
4909 For some targets, it's an ABI requirement that certain instructions may
4910 appear only as part of specified permissible sequences of multiple
4911 instructions, all within the same bundle.  A pair of @code{.bundle_lock}
4912 and @code{.bundle_unlock} directives define a @dfn{bundle-locked}
4913 instruction sequence.  For purposes of aligned instruction bundle mode, a
4914 sequence starting with @code{.bundle_lock} and ending with
4915 @code{.bundle_unlock} is treated as a single instruction.  That is, the
4916 entire sequence must fit into a single bundle and may not span a bundle
4917 boundary.  If necessary, no-op instructions will be inserted before the
4918 first instruction of the sequence so that the whole sequence starts on an
4919 aligned bundle boundary.  It's an error if the sequence is longer than the
4920 bundle size.
4922 For convenience when using @code{.bundle_lock} and @code{.bundle_unlock}
4923 inside assembler macros (@pxref{Macro}), bundle-locked sequences may be
4924 nested.  That is, a second @code{.bundle_lock} directive before the next
4925 @code{.bundle_unlock} directive has no effect except that it must be
4926 matched by another closing @code{.bundle_unlock} so that there is the
4927 same number of @code{.bundle_lock} and @code{.bundle_unlock} directives.
4929 @node Byte
4930 @section @code{.byte @var{expressions}}
4932 @cindex @code{byte} directive
4933 @cindex integers, one byte
4934 @code{.byte} expects zero or more expressions, separated by commas.
4935 Each expression is assembled into the next byte.
4937 Note - this directive is not intended for encoding instructions, and it will
4938 not trigger effects like DWARF line number generation.  Instead some targets
4939 support special directives for encoding arbitrary binary sequences as
4940 instructions such as @code{.insn} or @code{.inst}.
4942 @node CFI directives
4943 @section CFI directives
4944 @subsection @code{.cfi_sections @var{section_list}}
4945 @cindex @code{cfi_sections} directive
4946 @code{.cfi_sections} may be used to specify whether CFI directives
4947 should emit @code{.eh_frame} section, @code{.debug_frame} section and/or
4948 @code{.sframe} section.  If @var{section_list} contains @code{.eh_frame},
4949 @code{.eh_frame} is emitted, if @var{section_list} contains
4950 @code{.debug_frame}, @code{.debug_frame} is emitted, and finally, if
4951 @var{section_list} contains @code{.sframe}, @code{.sframe} is emitted.
4952 To emit multiple sections, specify them together in a list.  For example, to
4953 emit both @code{.eh_frame} and @code{.debug_frame}, use
4954 @code{.eh_frame, .debug_frame}.  The default if this directive is not used
4955 is @code{.cfi_sections .eh_frame}.
4957 On targets that support compact unwinding tables these can be generated
4958 by specifying @code{.eh_frame_entry} instead of @code{.eh_frame}.
4960 Some targets may support an additional name, such as @code{.c6xabi.exidx}
4961 which is used by the @value{TIC6X} target.
4963 The @code{.cfi_sections} directive can be repeated, with the same or different
4964 arguments, provided that CFI generation has not yet started.  Once CFI
4965 generation has started however the section list is fixed and any attempts to
4966 redefine it will result in an error.
4968 @subsection @code{.cfi_startproc [simple]}
4969 @cindex @code{cfi_startproc} directive
4970 @code{.cfi_startproc} is used at the beginning of each function that
4971 should have an entry in @code{.eh_frame}. It initializes some internal
4972 data structures. Don't forget to close the function by
4973 @code{.cfi_endproc}.
4975 Unless @code{.cfi_startproc} is used along with parameter @code{simple}
4976 it also emits some architecture dependent initial CFI instructions.
4978 @subsection @code{.cfi_endproc}
4979 @cindex @code{cfi_endproc} directive
4980 @code{.cfi_endproc} is used at the end of a function where it closes its
4981 unwind entry previously opened by
4982 @code{.cfi_startproc}, and emits it to @code{.eh_frame}.
4984 @subsection @code{.cfi_personality @var{encoding} [, @var{exp}]}
4985 @cindex @code{cfi_personality} directive
4986 @code{.cfi_personality} defines personality routine and its encoding.
4987 @var{encoding} must be a constant determining how the personality
4988 should be encoded.  If it is 255 (@code{DW_EH_PE_omit}), second
4989 argument is not present, otherwise second argument should be
4990 a constant or a symbol name.  When using indirect encodings,
4991 the symbol provided should be the location where personality
4992 can be loaded from, not the personality routine itself.
4993 The default after @code{.cfi_startproc} is @code{.cfi_personality 0xff},
4994 no personality routine.
4996 @subsection @code{.cfi_personality_id @var{id}}
4997 @cindex @code{cfi_personality_id} directive
4998 @code{cfi_personality_id} defines a personality routine by its index as
4999 defined in a compact unwinding format.
5000 Only valid when generating compact EH frames (i.e.
5001 with @code{.cfi_sections eh_frame_entry}.
5003 @subsection @code{.cfi_fde_data [@var{opcode1} [, @dots{}]]}
5004 @cindex @code{cfi_fde_data} directive
5005 @code{cfi_fde_data} is used to describe the compact unwind opcodes to be
5006 used for the current function.  These are emitted inline in the
5007 @code{.eh_frame_entry} section if small enough and there is no LSDA, or
5008 in the @code{.gnu.extab} section otherwise.
5009 Only valid when generating compact EH frames (i.e.
5010 with @code{.cfi_sections eh_frame_entry}.
5012 @subsection @code{.cfi_lsda @var{encoding} [, @var{exp}]}
5013 @code{.cfi_lsda} defines LSDA and its encoding.
5014 @var{encoding} must be a constant determining how the LSDA
5015 should be encoded.  If it is 255 (@code{DW_EH_PE_omit}), the second
5016 argument is not present, otherwise the second argument should be a constant
5017 or a symbol name.  The default after @code{.cfi_startproc} is @code{.cfi_lsda 0xff},
5018 meaning that no LSDA is present.
5020 @subsection @code{.cfi_inline_lsda} [@var{align}]
5021 @code{.cfi_inline_lsda} marks the start of a LSDA data section and
5022 switches to the corresponding @code{.gnu.extab} section.
5023 Must be preceded by a CFI block containing a @code{.cfi_lsda} directive.
5024 Only valid when generating compact EH frames (i.e.
5025 with @code{.cfi_sections eh_frame_entry}.
5027 The table header and unwinding opcodes will be generated at this point,
5028 so that they are immediately followed by the LSDA data.  The symbol
5029 referenced by the @code{.cfi_lsda} directive should still be defined
5030 in case a fallback FDE based encoding is used.  The LSDA data is terminated
5031 by a section directive.
5033 The optional @var{align} argument specifies the alignment required.
5034 The alignment is specified as a power of two, as with the
5035 @code{.p2align} directive.
5037 @subsection @code{.cfi_def_cfa @var{register}, @var{offset}}
5038 @code{.cfi_def_cfa} defines a rule for computing CFA as: @i{take
5039 address from @var{register} and add @var{offset} to it}.
5041 @subsection @code{.cfi_def_cfa_register @var{register}}
5042 @code{.cfi_def_cfa_register} modifies a rule for computing CFA. From
5043 now on @var{register} will be used instead of the old one. Offset
5044 remains the same.
5046 @subsection @code{.cfi_def_cfa_offset @var{offset}}
5047 @code{.cfi_def_cfa_offset} modifies a rule for computing CFA. Register
5048 remains the same, but @var{offset} is new. Note that it is the
5049 absolute offset that will be added to a defined register to compute
5050 CFA address.
5052 @subsection @code{.cfi_adjust_cfa_offset @var{offset}}
5053 Same as @code{.cfi_def_cfa_offset} but @var{offset} is a relative
5054 value that is added/subtracted from the previous offset.
5056 @subsection @code{.cfi_offset @var{register}, @var{offset}}
5057 Previous value of @var{register} is saved at offset @var{offset} from
5058 CFA.
5060 @subsection @code{.cfi_val_offset @var{register}, @var{offset}}
5061 Previous value of @var{register} is CFA + @var{offset}.
5063 @subsection @code{.cfi_rel_offset @var{register}, @var{offset}}
5064 Previous value of @var{register} is saved at offset @var{offset} from
5065 the current CFA register.  This is transformed to @code{.cfi_offset}
5066 using the known displacement of the CFA register from the CFA.
5067 This is often easier to use, because the number will match the
5068 code it's annotating.
5070 @subsection @code{.cfi_register @var{register1}, @var{register2}}
5071 Previous value of @var{register1} is saved in register @var{register2}.
5073 @subsection @code{.cfi_restore @var{register}}
5074 @code{.cfi_restore} says that the rule for @var{register} is now the
5075 same as it was at the beginning of the function, after all initial
5076 instruction added by @code{.cfi_startproc} were executed.
5078 @subsection @code{.cfi_undefined @var{register}}
5079 From now on the previous value of @var{register} can't be restored anymore.
5081 @subsection @code{.cfi_same_value @var{register}}
5082 Current value of @var{register} is the same like in the previous frame,
5083 i.e. no restoration needed.
5085 @subsection @code{.cfi_remember_state} and @code{.cfi_restore_state}
5086 @code{.cfi_remember_state} pushes the set of rules for every register onto an
5087 implicit stack, while @code{.cfi_restore_state} pops them off the stack and
5088 places them in the current row.  This is useful for situations where you have
5089 multiple @code{.cfi_*} directives that need to be undone due to the control
5090 flow of the program.  For example, we could have something like this (assuming
5091 the CFA is the value of @code{rbp}):
5093 @smallexample
5094         je label
5095         popq %rbx
5096         .cfi_restore %rbx
5097         popq %r12
5098         .cfi_restore %r12
5099         popq %rbp
5100         .cfi_restore %rbp
5101         .cfi_def_cfa %rsp, 8
5102         ret
5103 label:
5104         /* Do something else */
5105 @end smallexample
5107 Here, we want the @code{.cfi} directives to affect only the rows corresponding
5108 to the instructions before @code{label}.  This means we'd have to add multiple
5109 @code{.cfi} directives after @code{label} to recreate the original save
5110 locations of the registers, as well as setting the CFA back to the value of
5111 @code{rbp}.  This would be clumsy, and result in a larger binary size. Instead,
5112 we can write:
5114 @smallexample
5115         je label
5116         popq %rbx
5117         .cfi_remember_state
5118         .cfi_restore %rbx
5119         popq %r12
5120         .cfi_restore %r12
5121         popq %rbp
5122         .cfi_restore %rbp
5123         .cfi_def_cfa %rsp, 8
5124         ret
5125 label:
5126         .cfi_restore_state
5127         /* Do something else */
5128 @end smallexample
5130 That way, the rules for the instructions after @code{label} will be the same
5131 as before the first @code{.cfi_restore} without having to use multiple
5132 @code{.cfi} directives.
5134 @subsection @code{.cfi_return_column @var{register}}
5135 Change return column @var{register}, i.e. the return address is either
5136 directly in @var{register} or can be accessed by rules for @var{register}.
5138 @subsection @code{.cfi_signal_frame}
5139 Mark current function as signal trampoline.
5141 @subsection @code{.cfi_window_save}
5142 SPARC register window has been saved.
5144 @subsection @code{.cfi_escape} @var{expression}[, @dots{}]
5145 Allows the user to add arbitrary bytes to the unwind info.  One
5146 might use this to add OS-specific CFI opcodes, or generic CFI
5147 opcodes that GAS does not yet support.
5149 @subsection @code{.cfi_val_encoded_addr @var{register}, @var{encoding}, @var{label}}
5150 The current value of @var{register} is @var{label}.  The value of @var{label}
5151 will be encoded in the output file according to @var{encoding}; see the
5152 description of @code{.cfi_personality} for details on this encoding.
5154 The usefulness of equating a register to a fixed label is probably
5155 limited to the return address register.  Here, it can be useful to
5156 mark a code segment that has only one return address which is reached
5157 by a direct branch and no copy of the return address exists in memory
5158 or another register.
5160 @node Comm
5161 @section @code{.comm @var{symbol} , @var{length} }
5163 @cindex @code{comm} directive
5164 @cindex symbol, common
5165 @code{.comm} declares a common symbol named @var{symbol}.  When linking, a
5166 common symbol in one object file may be merged with a defined or common symbol
5167 of the same name in another object file.  If @code{@value{LD}} does not see a
5168 definition for the symbol--just one or more common symbols--then it will
5169 allocate @var{length} bytes of uninitialized memory.  @var{length} must be an
5170 absolute expression.  If @code{@value{LD}} sees multiple common symbols with
5171 the same name, and they do not all have the same size, it will allocate space
5172 using the largest size.
5174 @ifset COFF-ELF
5175 When using ELF or (as a GNU extension) PE, the @code{.comm} directive takes
5176 an optional third argument.  This is the desired alignment of the symbol,
5177 specified for ELF as a byte boundary (for example, an alignment of 16 means
5178 that the least significant 4 bits of the address should be zero), and for PE
5179 as a power of two (for example, an alignment of 5 means aligned to a 32-byte
5180 boundary).  The alignment must be an absolute expression, and it must be a
5181 power of two.  If @code{@value{LD}} allocates uninitialized memory for the
5182 common symbol, it will use the alignment when placing the symbol.  If no
5183 alignment is specified, @command{@value{AS}} will set the alignment to the
5184 largest power of two less than or equal to the size of the symbol, up to a
5185 maximum of 16 on ELF, or the default section alignment of 4 on PE@footnote{This
5186 is not the same as the executable image file alignment controlled by @code{@value{LD}}'s
5187 @samp{--section-alignment} option; image file sections in PE are aligned to
5188 multiples of 4096, which is far too large an alignment for ordinary variables.
5189 It is rather the default alignment for (non-debug) sections within object
5190 (@samp{*.o}) files, which are less strictly aligned.}.
5191 @end ifset
5193 @ifset HPPA
5194 The syntax for @code{.comm} differs slightly on the HPPA.  The syntax is
5195 @samp{@var{symbol} .comm, @var{length}}; @var{symbol} is optional.
5196 @end ifset
5198 @node Data
5199 @section @code{.data @var{subsection}}
5200 @cindex @code{data} directive
5202 @code{.data} tells @command{@value{AS}} to assemble the following statements onto the
5203 end of the data subsection numbered @var{subsection} (which is an
5204 absolute expression).  If @var{subsection} is omitted, it defaults
5205 to zero.
5207 @node Dc
5208 @section @code{.dc[@var{size}] @var{expressions}}
5209 @cindex @code{dc} directive
5211 The @code{.dc} directive expects zero or more @var{expressions} separated by
5212 commas.  These expressions are evaluated and their values inserted into the
5213 current section.  The size of the emitted value depends upon the suffix to the
5214 @code{.dc} directive:
5216 @table @code
5217 @item @samp{.a}
5218 Emits N-bit values, where N is the size of an address on the target system.
5219 @item @samp{.b}
5220 Emits 8-bit values.
5221 @item @samp{.d}
5222 Emits double precision floating-point values.
5223 @item @samp{.l}
5224 Emits 32-bit values.
5225 @item @samp{.s}
5226 Emits single precision floating-point values.
5227 @item @samp{.w}
5228 Emits 16-bit values.
5229 Note - this is true even on targets where the @code{.word} directive would emit
5230 32-bit values.
5231 @item @samp{.x}
5232 Emits long double precision floating-point values.
5233 @end table
5235 If no suffix is used then @samp{.w} is assumed.
5237 The byte ordering is target dependent, as is the size and format of floating
5238 point values.
5240 Note - these directives are not intended for encoding instructions, and they
5241 will not trigger effects like DWARF line number generation.  Instead some
5242 targets support special directives for encoding arbitrary binary sequences as
5243 instructions such as @code{.insn} or @code{.inst}.
5245 @node Dcb
5246 @section @code{.dcb[@var{size}] @var{number} [,@var{fill}]}
5247 @cindex @code{dcb} directive
5248 This directive emits @var{number} copies of @var{fill}, each of @var{size}
5249 bytes.  Both @var{number} and @var{fill} are absolute expressions.  If the
5250 comma and @var{fill} are omitted, @var{fill} is assumed to be zero.  The
5251 @var{size} suffix, if present, must be one of:
5253 @table @code
5254 @item @samp{.b}
5255 Emits single byte values.
5256 @item @samp{.d}
5257 Emits double-precision floating point values.
5258 @item @samp{.l}
5259 Emits 4-byte values.
5260 @item @samp{.s}
5261 Emits single-precision floating point values.
5262 @item @samp{.w}
5263 Emits 2-byte values.
5264 @item @samp{.x}
5265 Emits long double-precision floating point values.
5266 @end table
5268 If the @var{size} suffix is omitted then @samp{.w} is assumed.
5270 The byte ordering is target dependent, as is the size and format of floating
5271 point values.
5273 @node Ds
5274 @section @code{.ds[@var{size}] @var{number} [,@var{fill}]}
5275 @cindex @code{ds} directive
5276 This directive emits @var{number} copies of @var{fill}, each of @var{size}
5277 bytes.  Both @var{number} and @var{fill} are absolute expressions.  If the
5278 comma and @var{fill} are omitted, @var{fill} is assumed to be zero.  The
5279 @var{size} suffix, if present, must be one of:
5281 @table @code
5282 @item @samp{.b}
5283 Emits single byte values.
5284 @item @samp{.d}
5285 Emits 8-byte values.
5286 @item @samp{.l}
5287 Emits 4-byte values.
5288 @item @samp{.p}
5289 Emits values with size matching packed-decimal floating-point ones.
5290 @item @samp{.s}
5291 Emits 4-byte values.
5292 @item @samp{.w}
5293 Emits 2-byte values.
5294 @item @samp{.x}
5295 Emits values with size matching long double precision floating-point ones.
5296 @end table
5298 Note - unlike the @code{.dcb} directive the @samp{.d}, @samp{.s} and @samp{.x}
5299 suffixes do not indicate that floating-point values are to be inserted.
5301 If the @var{size} suffix is omitted then @samp{.w} is assumed.
5303 The byte ordering is target dependent.
5305 @ifset COFF
5306 @node Def
5307 @section @code{.def @var{name}}
5309 @cindex @code{def} directive
5310 @cindex COFF symbols, debugging
5311 @cindex debugging COFF symbols
5312 Begin defining debugging information for a symbol @var{name}; the
5313 definition extends until the @code{.endef} directive is encountered.
5314 @end ifset
5316 @ifset aout
5317 @node Desc
5318 @section @code{.desc @var{symbol}, @var{abs-expression}}
5320 @cindex @code{desc} directive
5321 @cindex COFF symbol descriptor
5322 @cindex symbol descriptor, COFF
5323 This directive sets the descriptor of the symbol (@pxref{Symbol Attributes})
5324 to the low 16 bits of an absolute expression.
5326 @ifset COFF
5327 The @samp{.desc} directive is not available when @command{@value{AS}} is
5328 configured for COFF output; it is only for @code{a.out} or @code{b.out}
5329 object format.  For the sake of compatibility, @command{@value{AS}} accepts
5330 it, but produces no output, when configured for COFF.
5331 @end ifset
5332 @end ifset
5334 @ifset COFF
5335 @node Dim
5336 @section @code{.dim}
5338 @cindex @code{dim} directive
5339 @cindex COFF auxiliary symbol information
5340 @cindex auxiliary symbol information, COFF
5341 This directive is generated by compilers to include auxiliary debugging
5342 information in the symbol table.  It is only permitted inside
5343 @code{.def}/@code{.endef} pairs.
5344 @end ifset
5346 @node Double
5347 @section @code{.double @var{flonums}}
5349 @cindex @code{double} directive
5350 @cindex floating point numbers (double)
5351 @code{.double} expects zero or more flonums, separated by commas.  It
5352 assembles floating point numbers.
5353 @ifset GENERIC
5354 The exact kind of floating point numbers emitted depends on how
5355 @command{@value{AS}} is configured.  @xref{Machine Dependencies}.
5356 @end ifset
5357 @ifclear GENERIC
5358 @ifset IEEEFLOAT
5359 On the @value{TARGET} family @samp{.double} emits 64-bit floating-point numbers
5360 in @sc{ieee} format.
5361 @end ifset
5362 @end ifclear
5364 @node Eject
5365 @section @code{.eject}
5367 @cindex @code{eject} directive
5368 @cindex new page, in listings
5369 @cindex page, in listings
5370 @cindex listing control: new page
5371 Force a page break at this point, when generating assembly listings.
5373 @node Else
5374 @section @code{.else}
5376 @cindex @code{else} directive
5377 @code{.else} is part of the @command{@value{AS}} support for conditional
5378 assembly; see @ref{If,,@code{.if}}.  It marks the beginning of a section
5379 of code to be assembled if the condition for the preceding @code{.if}
5380 was false.
5382 @node Elseif
5383 @section @code{.elseif}
5385 @cindex @code{elseif} directive
5386 @code{.elseif} is part of the @command{@value{AS}} support for conditional
5387 assembly; see @ref{If,,@code{.if}}.  It is shorthand for beginning a new
5388 @code{.if} block that would otherwise fill the entire @code{.else} section.
5390 @node End
5391 @section @code{.end}
5393 @cindex @code{end} directive
5394 @code{.end} marks the end of the assembly file.  @command{@value{AS}} does not
5395 process anything in the file past the @code{.end} directive.
5397 @ifset COFF
5398 @node Endef
5399 @section @code{.endef}
5401 @cindex @code{endef} directive
5402 This directive flags the end of a symbol definition begun with
5403 @code{.def}.
5404 @end ifset
5406 @node Endfunc
5407 @section @code{.endfunc}
5408 @cindex @code{endfunc} directive
5409 @code{.endfunc} marks the end of a function specified with @code{.func}.
5411 @node Endif
5412 @section @code{.endif}
5414 @cindex @code{endif} directive
5415 @code{.endif} is part of the @command{@value{AS}} support for conditional assembly;
5416 it marks the end of a block of code that is only assembled
5417 conditionally.  @xref{If,,@code{.if}}.
5419 @node Equ
5420 @section @code{.equ @var{symbol}, @var{expression}}
5422 @cindex @code{equ} directive
5423 @cindex assigning values to symbols
5424 @cindex symbols, assigning values to
5425 This directive sets the value of @var{symbol} to @var{expression}.
5426 It is synonymous with @samp{.set}; see @ref{Set,,@code{.set}}.
5428 @ifset HPPA
5429 The syntax for @code{equ} on the HPPA is
5430 @samp{@var{symbol} .equ @var{expression}}.
5431 @end ifset
5433 @ifset Z80
5434 The syntax for @code{equ} on the Z80 is
5435 @samp{@var{symbol} equ @var{expression}}.
5436 On the Z80 it is an error if @var{symbol} is already defined,
5437 but the symbol is not protected from later redefinition.
5438 Compare @ref{Equiv}.
5439 @end ifset
5441 @node Equiv
5442 @section @code{.equiv @var{symbol}, @var{expression}}
5443 @cindex @code{equiv} directive
5444 The @code{.equiv} directive is like @code{.equ} and @code{.set}, except that
5445 the assembler will signal an error if @var{symbol} is already defined.  Note a
5446 symbol which has been referenced but not actually defined is considered to be
5447 undefined.
5449 Except for the contents of the error message, this is roughly equivalent to
5450 @smallexample
5451 .ifdef SYM
5452 .err
5453 .endif
5454 .equ SYM,VAL
5455 @end smallexample
5456 plus it protects the symbol from later redefinition.
5458 @node Eqv
5459 @section @code{.eqv @var{symbol}, @var{expression}}
5460 @cindex @code{eqv} directive
5461 The @code{.eqv} directive is like @code{.equiv}, but no attempt is made to
5462 evaluate the expression or any part of it immediately.  Instead each time
5463 the resulting symbol is used in an expression, a snapshot of its current
5464 value is taken.
5466 @node Err
5467 @section @code{.err}
5468 @cindex @code{err} directive
5469 If @command{@value{AS}} assembles a @code{.err} directive, it will print an error
5470 message and, unless the @option{-Z} option was used, it will not generate an
5471 object file.  This can be used to signal an error in conditionally compiled code.
5473 @node Error
5474 @section @code{.error "@var{string}"}
5475 @cindex error directive
5477 Similarly to @code{.err}, this directive emits an error, but you can specify a
5478 string that will be emitted as the error message.  If you don't specify the
5479 message, it defaults to @code{".error directive invoked in source file"}.
5480 @xref{Errors, ,Error and Warning Messages}.
5482 @smallexample
5483  .error "This code has not been assembled and tested."
5484 @end smallexample
5486 @node Exitm
5487 @section @code{.exitm}
5488 Exit early from the current macro definition.  @xref{Macro}.
5490 @node Extern
5491 @section @code{.extern}
5493 @cindex @code{extern} directive
5494 @code{.extern} is accepted in the source program---for compatibility
5495 with other assemblers---but it is ignored.  @command{@value{AS}} treats
5496 all undefined symbols as external.
5498 @node Fail
5499 @section @code{.fail @var{expression}}
5501 @cindex @code{fail} directive
5502 Generates an error or a warning.  If the value of the @var{expression} is 500
5503 or more, @command{@value{AS}} will print a warning message.  If the value is less
5504 than 500, @command{@value{AS}} will print an error message.  The message will
5505 include the value of @var{expression}.  This can occasionally be useful inside
5506 complex nested macros or conditional assembly.
5508 @node File
5509 @section @code{.file}
5510 @cindex @code{file} directive
5512 @ifclear no-file-dir
5513 There are two different versions of the @code{.file} directive.  Targets
5514 that support DWARF2 line number information use the DWARF2 version of
5515 @code{.file}.  Other targets use the default version.
5517 @subheading Default Version
5519 @cindex logical file name
5520 @cindex file name, logical
5521 This version of the @code{.file} directive tells @command{@value{AS}} that we
5522 are about to start a new logical file.  The syntax is:
5524 @smallexample
5525 .file @var{string}
5526 @end smallexample
5528 @var{string} is the new file name.  In general, the filename is
5529 recognized whether or not it is surrounded by quotes @samp{"}; but if you wish
5530 to specify an empty file name, you must give the quotes--@code{""}.  This
5531 statement may go away in future: it is only recognized to be compatible with
5532 old @command{@value{AS}} programs.
5534 @subheading DWARF2 Version
5535 @end ifclear
5537 When emitting DWARF2 line number information, @code{.file} assigns filenames
5538 to the @code{.debug_line} file name table.  The syntax is:
5540 @smallexample
5541 .file @var{fileno} @var{filename}
5542 @end smallexample
5544 The @var{fileno} operand should be a unique positive integer to use as the
5545 index of the entry in the table.  The @var{filename} operand is a C string
5546 literal enclosed in double quotes.  The @var{filename} can include directory
5547 elements.  If it does, then the directory will be added to the directory table
5548 and the basename will be added to the file table.
5550 The detail of filename indices is exposed to the user because the filename
5551 table is shared with the @code{.debug_info} section of the DWARF2 debugging
5552 information, and thus the user must know the exact indices that table
5553 entries will have.
5555 If DWARF5 support has been enabled via the @option{-gdwarf-5} option then
5556 an extended version of @code{.file} is also allowed:
5558 @smallexample
5559 .file @var{fileno} [@var{dirname}] @var{filename} [md5 @var{value}]
5560 @end smallexample
5562 With this version a separate directory name is allowed, although if this is
5563 used then @var{filename} should not contain any directory component, except
5564 for @var{fileno} equal to 0: in this case, @var{dirname} is expected to be
5565 the current directory and @var{filename} the currently processed file, and
5566 the latter need not be located in the former. In addition an MD5 hash value
5567 of the contents of @var{filename} can be provided. This will be stored in
5568 the the file table as well, and can be used by tools reading the debug
5569 information to verify that the contents of the source file match the
5570 contents of the compiled file.
5572 @node Fill
5573 @section @code{.fill @var{repeat} , @var{size} , @var{value}}
5575 @cindex @code{fill} directive
5576 @cindex writing patterns in memory
5577 @cindex patterns, writing in memory
5578 @var{repeat}, @var{size} and @var{value} are absolute expressions.
5579 This emits @var{repeat} copies of @var{size} bytes.  @var{Repeat}
5580 may be zero or more.  @var{Size} may be zero or more, but if it is
5581 more than 8, then it is deemed to have the value 8, compatible with
5582 other people's assemblers.  The contents of each @var{repeat} bytes
5583 is taken from an 8-byte number.  The highest order 4 bytes are
5584 zero.  The lowest order 4 bytes are @var{value} rendered in the
5585 byte-order of an integer on the computer @command{@value{AS}} is assembling for.
5586 Each @var{size} bytes in a repetition is taken from the lowest order
5587 @var{size} bytes of this number.  Again, this bizarre behavior is
5588 compatible with other people's assemblers.
5590 @var{size} and @var{value} are optional.
5591 If the second comma and @var{value} are absent, @var{value} is
5592 assumed zero.  If the first comma and following tokens are absent,
5593 @var{size} is assumed to be 1.
5595 @node Float
5596 @section @code{.float @var{flonums}}
5598 @cindex floating point numbers (single)
5599 @cindex @code{float} directive
5600 This directive assembles zero or more flonums, separated by commas.  It
5601 has the same effect as @code{.single}.
5602 @ifset GENERIC
5603 The exact kind of floating point numbers emitted depends on how
5604 @command{@value{AS}} is configured.
5605 @xref{Machine Dependencies}.
5606 @end ifset
5607 @ifclear GENERIC
5608 @ifset IEEEFLOAT
5609 On the @value{TARGET} family, @code{.float} emits 32-bit floating point numbers
5610 in @sc{ieee} format.
5611 @end ifset
5612 @end ifclear
5614 @node Func
5615 @section @code{.func @var{name}[,@var{label}]}
5616 @cindex @code{func} directive
5617 @code{.func} emits debugging information to denote function @var{name}, and
5618 is ignored unless the file is assembled with debugging enabled.
5619 Only @samp{--gstabs[+]} is currently supported.
5620 @var{label} is the entry point of the function and if omitted @var{name}
5621 prepended with the @samp{leading char} is used.
5622 @samp{leading char} is usually @code{_} or nothing, depending on the target.
5623 All functions are currently defined to have @code{void} return type.
5624 The function must be terminated with @code{.endfunc}.
5626 @node Global
5627 @section @code{.global @var{symbol}}, @code{.globl @var{symbol}}
5629 @cindex @code{global} directive
5630 @cindex symbol, making visible to linker
5631 @code{.global} makes the symbol visible to @code{@value{LD}}.  If you define
5632 @var{symbol} in your partial program, its value is made available to
5633 other partial programs that are linked with it.  Otherwise,
5634 @var{symbol} takes its attributes from a symbol of the same name
5635 from another file linked into the same program.
5637 Both spellings (@samp{.globl} and @samp{.global}) are accepted, for
5638 compatibility with other assemblers.
5640 @ifset HPPA
5641 On the HPPA, @code{.global} is not always enough to make it accessible to other
5642 partial programs.  You may need the HPPA-only @code{.EXPORT} directive as well.
5643 @xref{HPPA Directives, ,HPPA Assembler Directives}.
5644 @end ifset
5646 @ifset ELF
5647 @node Gnu_attribute
5648 @section @code{.gnu_attribute @var{tag},@var{value}}
5649 Record a @sc{gnu} object attribute for this file.  @xref{Object Attributes}.
5651 @node Hidden
5652 @section @code{.hidden @var{names}}
5654 @cindex @code{hidden} directive
5655 @cindex visibility
5656 This is one of the ELF visibility directives.  The other two are
5657 @code{.internal} (@pxref{Internal,,@code{.internal}}) and
5658 @code{.protected} (@pxref{Protected,,@code{.protected}}).
5660 This directive overrides the named symbols default visibility (which is set by
5661 their binding: local, global or weak).  The directive sets the visibility to
5662 @code{hidden} which means that the symbols are not visible to other components.
5663 Such symbols are always considered to be @code{protected} as well.
5664 @end ifset
5666 @node hword
5667 @section @code{.hword @var{expressions}}
5669 @cindex @code{hword} directive
5670 @cindex integers, 16-bit
5671 @cindex numbers, 16-bit
5672 @cindex sixteen bit integers
5673 This expects zero or more @var{expressions}, and emits
5674 a 16 bit number for each.
5676 @ifset GENERIC
5677 This directive is a synonym for @samp{.short}; depending on the target
5678 architecture, it may also be a synonym for @samp{.word}.
5679 @end ifset
5680 @ifclear GENERIC
5681 @ifset W32
5682 This directive is a synonym for @samp{.short}.
5683 @end ifset
5684 @ifset W16
5685 This directive is a synonym for both @samp{.short} and @samp{.word}.
5686 @end ifset
5687 @end ifclear
5689 @node Ident
5690 @section @code{.ident}
5692 @cindex @code{ident} directive
5694 This directive is used by some assemblers to place tags in object files.  The
5695 behavior of this directive varies depending on the target.  When using the
5696 a.out object file format, @command{@value{AS}} simply accepts the directive for
5697 source-file compatibility with existing assemblers, but does not emit anything
5698 for it.  When using COFF, comments are emitted to the @code{.comment} or
5699 @code{.rdata} section, depending on the target.  When using ELF, comments are
5700 emitted to the @code{.comment} section.
5702 @node If
5703 @section @code{.if @var{absolute expression}}
5705 @cindex conditional assembly
5706 @cindex @code{if} directive
5707 @code{.if} marks the beginning of a section of code which is only
5708 considered part of the source program being assembled if the argument
5709 (which must be an @var{absolute expression}) is non-zero.  The end of
5710 the conditional section of code must be marked by @code{.endif}
5711 (@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
5712 alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}).
5713 If you have several conditions to check, @code{.elseif} may be used to avoid
5714 nesting blocks if/else within each subsequent @code{.else} block.
5716 The following variants of @code{.if} are also supported:
5717 @table @code
5718 @cindex @code{ifdef} directive
5719 @item .ifdef @var{symbol}
5720 Assembles the following section of code if the specified @var{symbol}
5721 has been defined.  Note a symbol which has been referenced but not yet defined
5722 is considered to be undefined.
5724 @cindex @code{ifb} directive
5725 @item .ifb @var{text}
5726 Assembles the following section of code if the operand is blank (empty).
5728 @cindex @code{ifc} directive
5729 @item .ifc @var{string1},@var{string2}
5730 Assembles the following section of code if the two strings are the same.  The
5731 strings may be optionally quoted with single quotes.  If they are not quoted,
5732 the first string stops at the first comma, and the second string stops at the
5733 end of the line.  Strings which contain whitespace should be quoted.  The
5734 string comparison is case sensitive.
5736 @cindex @code{ifeq} directive
5737 @item .ifeq @var{absolute expression}
5738 Assembles the following section of code if the argument is zero.
5740 @cindex @code{ifeqs} directive
5741 @item .ifeqs @var{string1},@var{string2}
5742 Another form of @code{.ifc}.  The strings must be quoted using double quotes.
5744 @cindex @code{ifge} directive
5745 @item .ifge @var{absolute expression}
5746 Assembles the following section of code if the argument is greater than or
5747 equal to zero.
5749 @cindex @code{ifgt} directive
5750 @item .ifgt @var{absolute expression}
5751 Assembles the following section of code if the argument is greater than zero.
5753 @cindex @code{ifle} directive
5754 @item .ifle @var{absolute expression}
5755 Assembles the following section of code if the argument is less than or equal
5756 to zero.
5758 @cindex @code{iflt} directive
5759 @item .iflt @var{absolute expression}
5760 Assembles the following section of code if the argument is less than zero.
5762 @cindex @code{ifnb} directive
5763 @item .ifnb @var{text}
5764 Like @code{.ifb}, but the sense of the test is reversed: this assembles the
5765 following section of code if the operand is non-blank (non-empty).
5767 @cindex @code{ifnc} directive
5768 @item .ifnc @var{string1},@var{string2}.
5769 Like @code{.ifc}, but the sense of the test is reversed: this assembles the
5770 following section of code if the two strings are not the same.
5772 @cindex @code{ifndef} directive
5773 @cindex @code{ifnotdef} directive
5774 @item .ifndef @var{symbol}
5775 @itemx .ifnotdef @var{symbol}
5776 Assembles the following section of code if the specified @var{symbol}
5777 has not been defined.  Both spelling variants are equivalent.  Note a symbol
5778 which has been referenced but not yet defined is considered to be undefined.
5780 @cindex @code{ifne} directive
5781 @item .ifne @var{absolute expression}
5782 Assembles the following section of code if the argument is not equal to zero
5783 (in other words, this is equivalent to @code{.if}).
5785 @cindex @code{ifnes} directive
5786 @item .ifnes @var{string1},@var{string2}
5787 Like @code{.ifeqs}, but the sense of the test is reversed: this assembles the
5788 following section of code if the two strings are not the same.
5789 @end table
5791 @node Incbin
5792 @section @code{.incbin "@var{file}"[,@var{skip}[,@var{count}]]}
5794 @cindex @code{incbin} directive
5795 @cindex binary files, including
5796 The @code{incbin} directive includes @var{file} verbatim at the current
5797 location. You can control the search paths used with the @samp{-I} command-line
5798 option (@pxref{Invoking,,Command-Line Options}).  Quotation marks are required
5799 around @var{file}.
5801 The @var{skip} argument skips a number of bytes from the start of the
5802 @var{file}.  The @var{count} argument indicates the maximum number of bytes to
5803 read.  Note that the data is not aligned in any way, so it is the user's
5804 responsibility to make sure that proper alignment is provided both before and
5805 after the @code{incbin} directive.
5807 @node Include
5808 @section @code{.include "@var{file}"}
5810 @cindex @code{include} directive
5811 @cindex supporting files, including
5812 @cindex files, including
5813 This directive provides a way to include supporting files at specified
5814 points in your source program.  The code from @var{file} is assembled as
5815 if it followed the point of the @code{.include}; when the end of the
5816 included file is reached, assembly of the original file continues.  You
5817 can control the search paths used with the @samp{-I} command-line option
5818 (@pxref{Invoking,,Command-Line Options}).  Quotation marks are required
5819 around @var{file}.
5821 @node Int
5822 @section @code{.int @var{expressions}}
5824 @cindex @code{int} directive
5825 @cindex integers, 32-bit
5826 Expect zero or more @var{expressions}, of any section, separated by commas.
5827 For each expression, emit a number that, at run time, is the value of that
5828 expression.  The byte order and bit size of the number depends on what kind
5829 of target the assembly is for.
5831 @ifclear GENERIC
5832 @ifset H8
5833 On most forms of the H8/300, @code{.int} emits 16-bit
5834 integers.  On the H8/300H and the Renesas SH, however, @code{.int} emits
5835 32-bit integers.
5836 @end ifset
5837 @end ifclear
5839 Note - this directive is not intended for encoding instructions, and it will
5840 not trigger effects like DWARF line number generation.  Instead some targets
5841 support special directives for encoding arbitrary binary sequences as
5842 instructions such as eg @code{.insn} or @code{.inst}.
5844 @ifset ELF
5845 @node Internal
5846 @section @code{.internal @var{names}}
5848 @cindex @code{internal} directive
5849 @cindex visibility
5850 This is one of the ELF visibility directives.  The other two are
5851 @code{.hidden} (@pxref{Hidden,,@code{.hidden}}) and
5852 @code{.protected} (@pxref{Protected,,@code{.protected}}).
5854 This directive overrides the named symbols default visibility (which is set by
5855 their binding: local, global or weak).  The directive sets the visibility to
5856 @code{internal} which means that the symbols are considered to be @code{hidden}
5857 (i.e., not visible to other components), and that some extra, processor specific
5858 processing must also be performed upon the  symbols as well.
5859 @end ifset
5861 @node Irp
5862 @section @code{.irp @var{symbol},@var{values}}@dots{}
5864 @cindex @code{irp} directive
5865 Evaluate a sequence of statements assigning different values to @var{symbol}.
5866 The sequence of statements starts at the @code{.irp} directive, and is
5867 terminated by an @code{.endr} directive.  For each @var{value}, @var{symbol} is
5868 set to @var{value}, and the sequence of statements is assembled.  If no
5869 @var{value} is listed, the sequence of statements is assembled once, with
5870 @var{symbol} set to the null string.  To refer to @var{symbol} within the
5871 sequence of statements, use @var{\symbol}.
5873 For example, assembling
5875 @example
5876         .irp    param,1,2,3
5877         move    d\param,sp@@-
5878         .endr
5879 @end example
5881 is equivalent to assembling
5883 @example
5884         move    d1,sp@@-
5885         move    d2,sp@@-
5886         move    d3,sp@@-
5887 @end example
5889 For some caveats with the spelling of @var{symbol}, see also @ref{Macro}.
5891 @node Irpc
5892 @section @code{.irpc @var{symbol},@var{values}}@dots{}
5894 @cindex @code{irpc} directive
5895 Evaluate a sequence of statements assigning different values to @var{symbol}.
5896 The sequence of statements starts at the @code{.irpc} directive, and is
5897 terminated by an @code{.endr} directive.  For each character in @var{value},
5898 @var{symbol} is set to the character, and the sequence of statements is
5899 assembled.  If no @var{value} is listed, the sequence of statements is
5900 assembled once, with @var{symbol} set to the null string.  To refer to
5901 @var{symbol} within the sequence of statements, use @var{\symbol}.
5903 For example, assembling
5905 @example
5906         .irpc    param,123
5907         move    d\param,sp@@-
5908         .endr
5909 @end example
5911 is equivalent to assembling
5913 @example
5914         move    d1,sp@@-
5915         move    d2,sp@@-
5916         move    d3,sp@@-
5917 @end example
5919 For some caveats with the spelling of @var{symbol}, see also the discussion
5920 at @xref{Macro}.
5922 @node Lcomm
5923 @section @code{.lcomm @var{symbol} , @var{length}}
5925 @cindex @code{lcomm} directive
5926 @cindex local common symbols
5927 @cindex symbols, local common
5928 Reserve @var{length} (an absolute expression) bytes for a local common
5929 denoted by @var{symbol}.  The section and value of @var{symbol} are
5930 those of the new local common.  The addresses are allocated in the bss
5931 section, so that at run-time the bytes start off zeroed.  @var{Symbol}
5932 is not declared global (@pxref{Global,,@code{.global}}), so is normally
5933 not visible to @code{@value{LD}}.
5935 @ifset GENERIC
5936 Some targets permit a third argument to be used with @code{.lcomm}.  This
5937 argument specifies the desired alignment of the symbol in the bss section.
5938 @end ifset
5940 @ifset HPPA
5941 The syntax for @code{.lcomm} differs slightly on the HPPA.  The syntax is
5942 @samp{@var{symbol} .lcomm, @var{length}}; @var{symbol} is optional.
5943 @end ifset
5945 @node Lflags
5946 @section @code{.lflags}
5948 @cindex @code{lflags} directive (ignored)
5949 @command{@value{AS}} accepts this directive, for compatibility with other
5950 assemblers, but ignores it.
5952 @ifclear no-line-dir
5953 @node Line
5954 @section @code{.line @var{line-number}}
5956 @cindex @code{line} directive
5957 @cindex logical line number
5958 @ifset aout
5959 Change the logical line number.  @var{line-number} must be an absolute
5960 expression.  The next line has that logical line number.  Therefore any other
5961 statements on the current line (after a statement separator character) are
5962 reported as on logical line number @var{line-number} @minus{} 1.  One day
5963 @command{@value{AS}} will no longer support this directive: it is recognized only
5964 for compatibility with existing assembler programs.
5965 @end ifset
5967 Even though this is a directive associated with the @code{a.out} or
5968 @code{b.out} object-code formats, @command{@value{AS}} still recognizes it
5969 when producing COFF output, and treats @samp{.line} as though it
5970 were the COFF @samp{.ln} @emph{if} it is found outside a
5971 @code{.def}/@code{.endef} pair.
5973 Inside a @code{.def}, @samp{.line} is, instead, one of the directives
5974 used by compilers to generate auxiliary symbol information for
5975 debugging.
5976 @end ifclear
5978 @node Linkonce
5979 @section @code{.linkonce [@var{type}]}
5980 @cindex COMDAT
5981 @cindex @code{linkonce} directive
5982 @cindex common sections
5983 Mark the current section so that the linker only includes a single copy of it.
5984 This may be used to include the same section in several different object files,
5985 but ensure that the linker will only include it once in the final output file.
5986 The @code{.linkonce} pseudo-op must be used for each instance of the section.
5987 Duplicate sections are detected based on the section name, so it should be
5988 unique.
5990 This directive is only supported by a few object file formats; as of this
5991 writing, the only object file format which supports it is the Portable
5992 Executable format used on Windows NT.
5994 The @var{type} argument is optional.  If specified, it must be one of the
5995 following strings.  For example:
5996 @smallexample
5997 .linkonce same_size
5998 @end smallexample
5999 Not all types may be supported on all object file formats.
6001 @table @code
6002 @item discard
6003 Silently discard duplicate sections.  This is the default.
6005 @item one_only
6006 Warn if there are duplicate sections, but still keep only one copy.
6008 @item same_size
6009 Warn if any of the duplicates have different sizes.
6011 @item same_contents
6012 Warn if any of the duplicates do not have exactly the same contents.
6013 @end table
6015 @node List
6016 @section @code{.list}
6018 @cindex @code{list} directive
6019 @cindex listing control, turning on
6020 Control (in conjunction with the @code{.nolist} directive) whether or
6021 not assembly listings are generated.  These two directives maintain an
6022 internal counter (which is zero initially).   @code{.list} increments the
6023 counter, and @code{.nolist} decrements it.  Assembly listings are
6024 generated whenever the counter is greater than zero.
6026 By default, listings are disabled.  When you enable them (with the
6027 @samp{-a} command-line option; @pxref{Invoking,,Command-Line Options}),
6028 the initial value of the listing counter is one.
6030 @node Ln
6031 @section @code{.ln @var{line-number}}
6033 @cindex @code{ln} directive
6034 @ifclear no-line-dir
6035 @samp{.ln} is a synonym for @samp{.line}.
6036 @end ifclear
6037 @ifset no-line-dir
6038 Tell @command{@value{AS}} to change the logical line number.  @var{line-number}
6039 must be an absolute expression.  The next line has that logical
6040 line number, so any other statements on the current line (after a
6041 statement separator character @code{;}) are reported as on logical
6042 line number @var{line-number} @minus{} 1.
6043 @end ifset
6045 @node Loc
6046 @section @code{.loc @var{fileno} @var{lineno} [@var{column}] [@var{options}]}
6047 @cindex @code{loc} directive
6048 When emitting DWARF2 line number information,
6049 the @code{.loc} directive will add a row to the @code{.debug_line} line
6050 number matrix corresponding to the immediately following assembly
6051 instruction.  The @var{fileno}, @var{lineno}, and optional @var{column}
6052 arguments will be applied to the @code{.debug_line} state machine before
6053 the row is added.  It is an error for the input assembly file to generate
6054 a non-empty @code{.debug_line} and also use @code{loc} directives.
6056 The @var{options} are a sequence of the following tokens in any order:
6058 @table @code
6059 @item basic_block
6060 This option will set the @code{basic_block} register in the
6061 @code{.debug_line} state machine to @code{true}.
6063 @item prologue_end
6064 This option will set the @code{prologue_end} register in the
6065 @code{.debug_line} state machine to @code{true}.
6067 @item epilogue_begin
6068 This option will set the @code{epilogue_begin} register in the
6069 @code{.debug_line} state machine to @code{true}.
6071 @item is_stmt @var{value}
6072 This option will set the @code{is_stmt} register in the
6073 @code{.debug_line} state machine to @code{value}, which must be
6074 either 0 or 1.
6076 @item isa @var{value}
6077 This directive will set the @code{isa} register in the @code{.debug_line}
6078 state machine to @var{value}, which must be an unsigned integer.
6080 @item discriminator @var{value}
6081 This directive will set the @code{discriminator} register in the @code{.debug_line}
6082 state machine to @var{value}, which must be an unsigned integer.
6084 @item view @var{value}
6085 This option causes a row to be added to @code{.debug_line} in reference to the
6086 current address (which might not be the same as that of the following assembly
6087 instruction), and to associate @var{value} with the @code{view} register in the
6088 @code{.debug_line} state machine.  If @var{value} is a label, both the
6089 @code{view} register and the label are set to the number of prior @code{.loc}
6090 directives at the same program location.  If @var{value} is the literal
6091 @code{0}, the @code{view} register is set to zero, and the assembler asserts
6092 that there aren't any prior @code{.loc} directives at the same program
6093 location.  If @var{value} is the literal @code{-0}, the assembler arrange for
6094 the @code{view} register to be reset in this row, even if there are prior
6095 @code{.loc} directives at the same program location.
6097 @end table
6099 @node Loc_mark_labels
6100 @section @code{.loc_mark_labels @var{enable}}
6101 @cindex @code{loc_mark_labels} directive
6102 When emitting DWARF2 line number information,
6103 the @code{.loc_mark_labels} directive makes the assembler emit an entry
6104 to the @code{.debug_line} line number matrix with the @code{basic_block}
6105 register in the state machine set whenever a code label is seen.
6106 The @var{enable} argument should be either 1 or 0, to enable or disable
6107 this function respectively.
6109 @ifset ELF
6110 @node Local
6111 @section @code{.local @var{names}}
6113 @cindex @code{local} directive
6114 This directive, which is available for ELF targets, marks each symbol in
6115 the comma-separated list of @code{names} as a local symbol so that it
6116 will not be externally visible.  If the symbols do not already exist,
6117 they will be created.
6119 For targets where the @code{.lcomm} directive (@pxref{Lcomm}) does not
6120 accept an alignment argument, which is the case for most ELF targets,
6121 the @code{.local} directive can be used in combination with @code{.comm}
6122 (@pxref{Comm}) to define aligned local common data.
6123 @end ifset
6125 @node Long
6126 @section @code{.long @var{expressions}}
6128 @cindex @code{long} directive
6129 @code{.long} is the same as @samp{.int}.  @xref{Int,,@code{.int}}.
6131 @ignore
6132 @c no one seems to know what this is for or whether this description is
6133 @c what it really ought to do
6134 @node Lsym
6135 @section @code{.lsym @var{symbol}, @var{expression}}
6137 @cindex @code{lsym} directive
6138 @cindex symbol, not referenced in assembly
6139 @code{.lsym} creates a new symbol named @var{symbol}, but does not put it in
6140 the hash table, ensuring it cannot be referenced by name during the
6141 rest of the assembly.  This sets the attributes of the symbol to be
6142 the same as the expression value:
6143 @smallexample
6144 @var{other} = @var{descriptor} = 0
6145 @var{type} = @r{(section of @var{expression})}
6146 @var{value} = @var{expression}
6147 @end smallexample
6148 @noindent
6149 The new symbol is not flagged as external.
6150 @end ignore
6152 @node Macro
6153 @section @code{.macro}
6155 @cindex macros
6156 The commands @code{.macro} and @code{.endm} allow you to define macros that
6157 generate assembly output.  For example, this definition specifies a macro
6158 @code{sum} that puts a sequence of numbers into memory:
6160 @example
6161         .macro  sum from=0, to=5
6162         .long   \from
6163         .if     \to-\from
6164         sum     "(\from+1)",\to
6165         .endif
6166         .endm
6167 @end example
6169 @noindent
6170 With that definition, @samp{SUM 0,5} is equivalent to this assembly input:
6172 @example
6173         .long   0
6174         .long   1
6175         .long   2
6176         .long   3
6177         .long   4
6178         .long   5
6179 @end example
6181 @ftable @code
6182 @item .macro @var{macname}
6183 @itemx .macro @var{macname} @var{macargs} @dots{}
6184 @cindex @code{macro} directive
6185 Begin the definition of a macro called @var{macname}.  If your macro
6186 definition requires arguments, specify their names after the macro name,
6187 separated by commas or spaces.  You can qualify the macro argument to
6188 indicate whether all invocations must specify a non-blank value (through
6189 @samp{:@code{req}}), or whether it takes all of the remaining arguments
6190 (through @samp{:@code{vararg}}).  You can supply a default value for any
6191 macro argument by following the name with @samp{=@var{deflt}}.  You
6192 cannot define two macros with the same @var{macname} unless it has been
6193 subject to the @code{.purgem} directive (@pxref{Purgem}) between the two
6194 definitions.  For example, these are all valid @code{.macro} statements:
6196 @table @code
6197 @item .macro comm
6198 Begin the definition of a macro called @code{comm}, which takes no
6199 arguments.
6201 @item  .macro plus1 p, p1
6202 @itemx .macro plus1 p p1
6203 Either statement begins the definition of a macro called @code{plus1},
6204 which takes two arguments; within the macro definition, write
6205 @samp{\p} or @samp{\p1} to evaluate the arguments.
6207 @item .macro reserve_str p1=0 p2
6208 Begin the definition of a macro called @code{reserve_str}, with two
6209 arguments.  The first argument has a default value, but not the second.
6210 After the definition is complete, you can call the macro either as
6211 @samp{reserve_str @var{a},@var{b}} (with @samp{\p1} evaluating to
6212 @var{a} and @samp{\p2} evaluating to @var{b}), or as @samp{reserve_str
6213 ,@var{b}} (with @samp{\p1} evaluating as the default, in this case
6214 @samp{0}, and @samp{\p2} evaluating to @var{b}).
6216 @item .macro m p1:req, p2=0, p3:vararg
6217 Begin the definition of a macro called @code{m}, with at least three
6218 arguments.  The first argument must always have a value specified, but
6219 not the second, which instead has a default value. The third formal
6220 will get assigned all remaining arguments specified at invocation time.
6222 When you call a macro, you can specify the argument values either by
6223 position, or by keyword.  For example, @samp{sum 9,17} is equivalent to
6224 @samp{sum to=17, from=9}.  You can also omit values when using keywords,
6225 so for example @samp{sum to=6} is equivalent to @samp{sum 0, 6}.
6227 @anchor{altmacro-keyword-arguments}
6228 Note however that when operating in altmacro mode arguments can only be
6229 specified by position, not keyword.  @xref{Altmacro,,@code{.altmacro}}.
6231 Thus for example:
6233 @example
6234 .macro foo bar=1, baz=2
6235 .print "\bar \baz"
6236 .endm
6238 foo baz=3
6239 .altmacro
6240 foo baz=3
6241 @end example
6243 Will print:
6245 @smallexample
6246 1 3
6247 baz=3 2
6248 @end smallexample
6250 @end table
6252 Note that since each of the @var{macargs} can be an identifier exactly
6253 as any other one permitted by the target architecture, there may be
6254 occasional problems if the target hand-crafts special meanings to certain
6255 characters when they occur in a special position.  For example, if the colon
6256 (@code{:}) is generally permitted to be part of a symbol name, but the
6257 architecture specific code special-cases it when occurring as the final
6258 character of a symbol (to denote a label), then the macro parameter
6259 replacement code will have no way of knowing that and consider the whole
6260 construct (including the colon) an identifier, and check only this
6261 identifier for being the subject to parameter substitution.  So for example
6262 this macro definition:
6264 @example
6265         .macro label l
6267         .endm
6268 @end example
6270 might not work as expected.  Invoking @samp{label foo} might not create a label
6271 called @samp{foo} but instead just insert the text @samp{\l:} into the
6272 assembler source, probably generating an error about an unrecognised
6273 identifier.
6275 Similarly problems might occur with the period character (@samp{.})
6276 which is often allowed inside opcode names (and hence identifier names).  So
6277 for example constructing a macro to build an opcode from a base name and a
6278 length specifier like this:
6280 @example
6281         .macro opcode base length
6282         \base.\length
6283         .endm
6284 @end example
6286 and invoking it as @samp{opcode store l} will not create a @samp{store.l}
6287 instruction but instead generate some kind of error as the assembler tries to
6288 interpret the text @samp{\base.\length}.
6290 There are several possible ways around this problem:
6292 @table @code
6293 @item Insert white space
6294 If it is possible to use white space characters then this is the simplest
6295 solution.  eg:
6297 @example
6298         .macro label l
6299 \l :
6300         .endm
6301 @end example
6303 @item Use @samp{\()}
6304 The string @samp{\()} can be used to separate the end of a macro argument from
6305 the following text.  eg:
6307 @example
6308         .macro opcode base length
6309         \base\().\length
6310         .endm
6311 @end example
6313 @item Use the alternate macro syntax mode
6314 In the alternative macro syntax mode the ampersand character (@samp{&}) can be
6315 used as a separator.  eg:
6317 @example
6318         .altmacro
6319         .macro label l
6321         .endm
6322 @end example
6323 @end table
6325 Note: this problem of correctly identifying string parameters to pseudo ops
6326 also applies to the identifiers used in @code{.irp} (@pxref{Irp})
6327 and @code{.irpc} (@pxref{Irpc}) as well.
6329 Another issue can occur with the actual arguments passed during macro
6330 invocation: Multiple arguments can be separated by blanks or commas.  To have
6331 arguments actually contain blanks or commas (or potentially other non-alpha-
6332 numeric characters), individual arguments will need to be enclosed in either
6333 parentheses @code{()}, square brackets @code{[]}, or double quote @code{"}
6334 characters.  The latter may be the only viable option in certain situations,
6335 as only double quotes are actually stripped while establishing arguments.  It
6336 may be important to be aware of two escaping models used when processing such
6337 quoted argument strings: For one two adjacent double quotes represent a single
6338 double quote in the resulting argument, going along the lines of the stripping
6339 of the enclosing quotes.  But then double quotes can also be escaped by a
6340 backslash @code{\}, but this backslash will not be retained in the resulting
6341 actual argument as then seen / used while expanding the macro.
6343 As a consequence to the first of these escaping mechanisms two string literals
6344 intended to be representing separate macro arguments need to be separated by
6345 white space (or, better yet, by a comma).  To state it differently, such
6346 adjacent string literals - even if separated only by a blank - will not be
6347 concatenated when determining macro arguments, even if they're only separated
6348 by white space.  This is unlike certain other pseudo ops, e.g. @code{.ascii}.
6350 @item .endm
6351 @cindex @code{endm} directive
6352 Mark the end of a macro definition.
6354 @item .exitm
6355 @cindex @code{exitm} directive
6356 Exit early from the current macro definition.
6358 @cindex number of macros executed
6359 @cindex macros, count executed
6360 @item \@@
6361 @command{@value{AS}} maintains a counter of how many macros it has
6362 executed in this pseudo-variable; you can copy that number to your
6363 output with @samp{\@@}, but @emph{only within a macro definition}.
6365 @item LOCAL @var{name} [ , @dots{} ]
6366 @emph{Warning: @code{LOCAL} is only available if you select ``alternate
6367 macro syntax'' with @samp{--alternate} or @code{.altmacro}.}
6368 @xref{Altmacro,,@code{.altmacro}}.
6369 @end ftable
6371 @node MRI
6372 @section @code{.mri @var{val}}
6374 @cindex @code{mri} directive
6375 @cindex MRI mode, temporarily
6376 If @var{val} is non-zero, this tells @command{@value{AS}} to enter MRI mode.  If
6377 @var{val} is zero, this tells @command{@value{AS}} to exit MRI mode.  This change
6378 affects code assembled until the next @code{.mri} directive, or until the end
6379 of the file.  @xref{M, MRI mode, MRI mode}.
6381 @node Noaltmacro
6382 @section @code{.noaltmacro}
6383 Disable alternate macro mode.  @xref{Altmacro}.
6385 @node Nolist
6386 @section @code{.nolist}
6388 @cindex @code{nolist} directive
6389 @cindex listing control, turning off
6390 Control (in conjunction with the @code{.list} directive) whether or
6391 not assembly listings are generated.  These two directives maintain an
6392 internal counter (which is zero initially).   @code{.list} increments the
6393 counter, and @code{.nolist} decrements it.  Assembly listings are
6394 generated whenever the counter is greater than zero.
6396 @node Nop
6397 @section @code{.nop [@var{size}]}
6399 @cindex @code{nop} directive
6400 @cindex filling memory with no-op instructions
6401 This directive emits no-op instructions.  It is provided on all architectures,
6402 allowing the creation of architecture neutral tests involving actual code.  The
6403 size of the generated instruction is target specific, but if the optional
6404 @var{size} argument is given and resolves to an absolute positive value at that
6405 point in assembly (no forward expressions allowed) then the fewest no-op
6406 instructions are emitted that equal or exceed a total @var{size} in bytes.
6407 @code{.nop} does affect the generation of DWARF debug line information.
6408 Some targets do not support using @code{.nop} with @var{size}.
6410 @node Nops
6411 @section @code{.nops @var{size}[, @var{control}]}
6413 @cindex @code{nops} directive
6414 @cindex filling memory with no-op instructions
6415 This directive emits no-op instructions.  It is specific to the Intel 80386 and
6416 AMD x86-64 targets.  It takes a @var{size} argument and generates @var{size}
6417 bytes of no-op instructions.  @var{size} must be absolute and positive.  These
6418 bytes do not affect the generation of DWARF debug line information.
6420 The optional @var{control} argument specifies a size limit for a single no-op
6421 instruction.  If not provided then a value of 0 is assumed.  The valid values
6422 of @var{control} are between 0 and 4 in 16-bit mode, between 0 and 7 when
6423 tuning for older processors in 32-bit mode, between 0 and 11 in 64-bit mode or
6424 when tuning for newer processors in 32-bit mode.  When 0 is used, the no-op
6425 instruction size limit is set to the maximum supported size.
6427 @node Octa
6428 @section @code{.octa @var{bignums}}
6430 @c FIXME: double size emitted for "octa" on some?  Or warn?
6431 @cindex @code{octa} directive
6432 @cindex integer, 16-byte
6433 @cindex sixteen byte integer
6434 This directive expects zero or more bignums, separated by commas.  For each
6435 bignum, it emits a 16-byte integer.
6437 The term ``octa'' comes from contexts in which a ``word'' is two bytes;
6438 hence @emph{octa}-word for 16 bytes.
6440 @node Offset
6441 @section @code{.offset @var{loc}}
6443 @cindex @code{offset} directive
6444 Set the location counter to @var{loc} in the absolute section.  @var{loc} must
6445 be an absolute expression.  This directive may be useful for defining
6446 symbols with absolute values.  Do not confuse it with the @code{.org}
6447 directive.
6449 @node Org
6450 @section @code{.org @var{new-lc} , @var{fill}}
6452 @cindex @code{org} directive
6453 @cindex location counter, advancing
6454 @cindex advancing location counter
6455 @cindex current address, advancing
6456 Advance the location counter of the current section to
6457 @var{new-lc}.  @var{new-lc} is either an absolute expression or an
6458 expression with the same section as the current subsection.  That is,
6459 you can't use @code{.org} to cross sections: if @var{new-lc} has the
6460 wrong section, the @code{.org} directive is ignored.  To be compatible
6461 with former assemblers, if the section of @var{new-lc} is absolute,
6462 @command{@value{AS}} issues a warning, then pretends the section of @var{new-lc}
6463 is the same as the current subsection.
6465 @code{.org} may only increase the location counter, or leave it
6466 unchanged; you cannot use @code{.org} to move the location counter
6467 backwards.
6469 @c double negative used below "not undefined" because this is a specific
6470 @c reference to "undefined" (as SEG_UNKNOWN is called in this manual)
6471 @c section. doc@cygnus.com 18feb91
6472 Because @command{@value{AS}} tries to assemble programs in one pass, @var{new-lc}
6473 may not be undefined.  If you really detest this restriction we eagerly await
6474 a chance to share your improved assembler.
6476 Beware that the origin is relative to the start of the section, not
6477 to the start of the subsection.  This is compatible with other
6478 people's assemblers.
6480 When the location counter (of the current subsection) is advanced, the
6481 intervening bytes are filled with @var{fill} which should be an
6482 absolute expression.  If the comma and @var{fill} are omitted,
6483 @var{fill} defaults to zero.
6485 @node P2align
6486 @section @code{.p2align[wl] [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
6488 @cindex padding the location counter given a power of two
6489 @cindex @code{p2align} directive
6490 Pad the location counter (in the current subsection) to a particular
6491 storage boundary.  The first expression (which must be absolute) is the
6492 number of low-order zero bits the location counter must have after
6493 advancement.  For example @samp{.p2align 3} advances the location
6494 counter until it is a multiple of 8.  If the location counter is already a
6495 multiple of 8, no change is needed.  If the expression is omitted then a
6496 default value of 0 is used, effectively disabling alignment requirements.
6498 The second expression (also absolute) gives the fill value to be stored in the
6499 padding bytes.  It (and the comma) may be omitted.  If it is omitted, the
6500 padding bytes are normally zero.  However, on most systems, if the section is
6501 marked as containing code and the fill value is omitted, the space is filled
6502 with no-op instructions.
6504 The third expression is also absolute, and is also optional.  If it is present,
6505 it is the maximum number of bytes that should be skipped by this alignment
6506 directive.  If doing the alignment would require skipping more bytes than the
6507 specified maximum, then the alignment is not done at all.  You can omit the
6508 fill value (the second argument) entirely by simply using two commas after the
6509 required alignment; this can be useful if you want the alignment to be filled
6510 with no-op instructions when appropriate.
6512 @cindex @code{p2alignw} directive
6513 @cindex @code{p2alignl} directive
6514 The @code{.p2alignw} and @code{.p2alignl} directives are variants of the
6515 @code{.p2align} directive.  The @code{.p2alignw} directive treats the fill
6516 pattern as a two byte word value.  The @code{.p2alignl} directives treats the
6517 fill pattern as a four byte longword value.  For example, @code{.p2alignw
6518 2,0x368d} will align to a multiple of 4.  If it skips two bytes, they will be
6519 filled in with the value 0x368d (the exact placement of the bytes depends upon
6520 the endianness of the processor).  If it skips 1 or 3 bytes, the fill value is
6521 undefined.
6523 @ifset ELF
6524 @node PopSection
6525 @section @code{.popsection}
6527 @cindex @code{popsection} directive
6528 @cindex Section Stack
6529 This is one of the ELF section stack manipulation directives.  The others are
6530 @code{.section} (@pxref{Section}), @code{.subsection} (@pxref{SubSection}),
6531 @code{.pushsection} (@pxref{PushSection}), and @code{.previous}
6532 (@pxref{Previous}).
6534 This directive replaces the current section (and subsection) with the top
6535 section (and subsection) on the section stack.  This section is popped off the
6536 stack.
6537 @end ifset
6539 @ifset ELF
6540 @node Previous
6541 @section @code{.previous}
6543 @cindex @code{previous} directive
6544 @cindex Section Stack
6545 This is one of the ELF section stack manipulation directives.  The others are
6546 @code{.section} (@pxref{Section}), @code{.subsection} (@pxref{SubSection}),
6547 @code{.pushsection} (@pxref{PushSection}), and @code{.popsection}
6548 (@pxref{PopSection}).
6550 This directive swaps the current section (and subsection) with most recently
6551 referenced section/subsection pair prior to this one.  Multiple
6552 @code{.previous} directives in a row will flip between two sections (and their
6553 subsections).  For example:
6555 @smallexample
6556 .section A
6557  .subsection 1
6558   .word 0x1234
6559  .subsection 2
6560   .word 0x5678
6561 .previous
6562  .word 0x9abc
6563 @end smallexample
6565 Will place 0x1234 and 0x9abc into subsection 1 and 0x5678 into subsection 2 of
6566 section A.  Whilst:
6568 @smallexample
6569 .section A
6570 .subsection 1
6571   # Now in section A subsection 1
6572   .word 0x1234
6573 .section B
6574 .subsection 0
6575   # Now in section B subsection 0
6576   .word 0x5678
6577 .subsection 1
6578   # Now in section B subsection 1
6579   .word 0x9abc
6580 .previous
6581   # Now in section B subsection 0
6582   .word 0xdef0
6583 @end smallexample
6585 Will place 0x1234 into section A, 0x5678 and 0xdef0 into subsection 0 of
6586 section B and 0x9abc into subsection 1 of section B.
6588 In terms of the section stack, this directive swaps the current section with
6589 the top section on the section stack.
6590 @end ifset
6592 @node Print
6593 @section @code{.print @var{string}}
6595 @cindex @code{print} directive
6596 @command{@value{AS}} will print @var{string} on the standard output during
6597 assembly.  You must put @var{string} in double quotes.
6599 @ifset ELF
6600 @node Protected
6601 @section @code{.protected @var{names}}
6603 @cindex @code{protected} directive
6604 @cindex visibility
6605 This is one of the ELF visibility directives.  The other two are
6606 @code{.hidden} (@pxref{Hidden}) and @code{.internal} (@pxref{Internal}).
6608 This directive overrides the named symbols default visibility (which is set by
6609 their binding: local, global or weak).  The directive sets the visibility to
6610 @code{protected} which means that any references to the symbols from within the
6611 components that defines them must be resolved to the definition in that
6612 component, even if a definition in another component would normally preempt
6613 this.
6614 @end ifset
6616 @node Psize
6617 @section @code{.psize @var{lines} , @var{columns}}
6619 @cindex @code{psize} directive
6620 @cindex listing control: paper size
6621 @cindex paper size, for listings
6622 Use this directive to declare the number of lines---and, optionally, the
6623 number of columns---to use for each page, when generating listings.
6625 If you do not use @code{.psize}, listings use a default line-count
6626 of 60.  You may omit the comma and @var{columns} specification; the
6627 default width is 200 columns.
6629 @command{@value{AS}} generates formfeeds whenever the specified number of
6630 lines is exceeded (or whenever you explicitly request one, using
6631 @code{.eject}).
6633 If you specify @var{lines} as @code{0}, no formfeeds are generated save
6634 those explicitly specified with @code{.eject}.
6636 @node Purgem
6637 @section @code{.purgem @var{name}}
6639 @cindex @code{purgem} directive
6640 Undefine the macro @var{name}, so that later uses of the string will not be
6641 expanded.  @xref{Macro}.
6643 @ifset ELF
6644 @node PushSection
6645 @section @code{.pushsection @var{name} [, @var{subsection}] [, "@var{flags}"[, @@@var{type}[,@var{arguments}]]]}
6647 @cindex @code{pushsection} directive
6648 @cindex Section Stack
6649 This is one of the ELF section stack manipulation directives.  The others are
6650 @code{.section} (@pxref{Section}), @code{.subsection} (@pxref{SubSection}),
6651 @code{.popsection} (@pxref{PopSection}), and @code{.previous}
6652 (@pxref{Previous}).
6654 This directive pushes the current section (and subsection) onto the
6655 top of the section stack, and then replaces the current section and
6656 subsection with @code{name} and @code{subsection}. The optional
6657 @code{flags}, @code{type} and @code{arguments} are treated the same
6658 as in the @code{.section} (@pxref{Section}) directive.
6659 @end ifset
6661 @node Quad
6662 @section @code{.quad @var{expressions}}
6664 @cindex @code{quad} directive
6665 @ifclear bignum-16
6666 For 64-bit architectures, or more generally with any GAS configured to support
6667 64-bit target virtual addresses, this is like @samp{.int}, but emitting 64-bit
6668 quantities.  Otherwise @code{.quad} expects zero or more bignums, separated by
6669 commas.  For each item, it emits an 8-byte integer.  If a bignum won't fit in
6670 8 bytes, a warning message is printed and just the lowest order 8 bytes of the
6671 bignum are taken.
6672 @cindex eight-byte integer
6673 @cindex integer, 8-byte
6675 The term ``quad'' comes from contexts in which a ``word'' is two bytes;
6676 hence @emph{quad}-word for 8 bytes.
6677 @end ifclear
6678 @ifset bignum-16
6679 @code{.quad} expects zero or more bignums, separated by commas.  For
6680 each bignum, it emits a 16-byte integer.  If the bignum won't fit in 16
6681 bytes, it prints a warning message; and just takes the lowest order 16
6682 bytes of the bignum.
6683 @xref{Octa,,@code{.octa @var{bignums}}}.
6684 @cindex sixteen-byte integer
6685 @cindex integer, 16-byte
6686 @end ifset
6688 Note - this directive is not intended for encoding instructions, and it will
6689 not trigger effects like DWARF line number generation.  Instead some targets
6690 support special directives for encoding arbitrary binary sequences as
6691 instructions such as @code{.insn} or @code{.inst}.
6693 @node Reloc
6694 @section @code{.reloc @var{offset}, @var{reloc_name}[, @var{expression}]}
6696 @cindex @code{reloc} directive
6697 Generate a relocation at @var{offset} of type @var{reloc_name} with value
6698 @var{expression}.  If @var{offset} is a number, the relocation is generated in
6699 the current section.  If @var{offset} is an expression that resolves to a
6700 symbol plus offset, the relocation is generated in the given symbol's section.
6701 @var{expression}, if present, must resolve to a symbol plus addend or to an
6702 absolute value, but note that not all targets support an addend.  e.g. ELF REL
6703 targets such as i386 store an addend in the section contents rather than in the
6704 relocation.  This low level interface does not support addends stored in the
6705 section.
6707 @node Rept
6708 @section @code{.rept @var{count}}
6710 @cindex @code{rept} directive
6711 Repeat the sequence of lines between the @code{.rept} directive and the next
6712 @code{.endr} directive @var{count} times.
6714 For example, assembling
6716 @example
6717         .rept   3
6718         .long   0
6719         .endr
6720 @end example
6722 is equivalent to assembling
6724 @example
6725         .long   0
6726         .long   0
6727         .long   0
6728 @end example
6730 A count of zero is allowed, but nothing is generated.  Negative counts are not
6731 allowed and if encountered will be treated as if they were zero.
6733 @node Sbttl
6734 @section @code{.sbttl "@var{subheading}"}
6736 @cindex @code{sbttl} directive
6737 @cindex subtitles for listings
6738 @cindex listing control: subtitle
6739 Use @var{subheading} as the title (third line, immediately after the
6740 title line) when generating assembly listings.
6742 This directive affects subsequent pages, as well as the current page if
6743 it appears within ten lines of the top of a page.
6745 @ifset COFF
6746 @node Scl
6747 @section @code{.scl @var{class}}
6749 @cindex @code{scl} directive
6750 @cindex symbol storage class (COFF)
6751 @cindex COFF symbol storage class
6752 Set the storage-class value for a symbol.  This directive may only be
6753 used inside a @code{.def}/@code{.endef} pair.  Storage class may flag
6754 whether a symbol is static or external, or it may record further
6755 symbolic debugging information.
6756 @end ifset
6758 @ifset COFF-ELF
6759 @node Section
6760 @section @code{.section @var{name}}
6762 @cindex named section
6763 Use the @code{.section} directive to assemble the following code into a section
6764 named @var{name}.
6766 This directive is only supported for targets that actually support arbitrarily
6767 named sections; on @code{a.out} targets, for example, it is not accepted, even
6768 with a standard @code{a.out} section name.
6770 @ifset COFF
6771 @ifset ELF
6772 @c only print the extra heading if both COFF and ELF are set
6773 @subheading COFF Version
6774 @end ifset
6776 @cindex @code{section} directive (COFF version)
6777 For COFF targets, the @code{.section} directive is used in one of the following
6778 ways:
6780 @smallexample
6781 .section @var{name}[, "@var{flags}"]
6782 .section @var{name}[, @var{subsection}]
6783 @end smallexample
6785 If the optional argument is quoted, it is taken as flags to use for the
6786 section.  Each flag is a single character.  The following flags are recognized:
6788 @table @code
6789 @item b
6790 bss section (uninitialized data)
6791 @item n
6792 section is not loaded
6793 @item w
6794 writable section
6795 @item d
6796 data section
6797 @item e
6798 exclude section from linking
6799 @item r
6800 read-only section
6801 @item x
6802 executable section
6803 @item s
6804 shared section (meaningful for PE targets)
6805 @item a
6806 ignored.  (For compatibility with the ELF version)
6807 @item y
6808 section is not readable (meaningful for PE targets)
6809 @item 0-9
6810 single-digit power-of-two section alignment (GNU extension)
6811 @end table
6813 If no flags are specified, the default flags depend upon the section name.  If
6814 the section name is not recognized, the default will be for the section to be
6815 loaded and writable.  Note the @code{n} and @code{w} flags remove attributes
6816 from the section, rather than adding them, so if they are used on their own it
6817 will be as if no flags had been specified at all.
6819 If the optional argument to the @code{.section} directive is not quoted, it is
6820 taken as a subsection number (@pxref{Sub-Sections}).
6821 @end ifset
6823 @ifset ELF
6824 @ifset COFF
6825 @c only print the extra heading if both COFF and ELF are set
6826 @subheading ELF Version
6827 @end ifset
6829 @cindex Section Stack
6830 This is one of the ELF section stack manipulation directives.  The others are
6831 @code{.subsection} (@pxref{SubSection}), @code{.pushsection}
6832 (@pxref{PushSection}), @code{.popsection} (@pxref{PopSection}), and
6833 @code{.previous} (@pxref{Previous}).
6835 @cindex @code{section} directive (ELF version)
6836 For ELF targets, the @code{.section} directive is used like this:
6838 @smallexample
6839 .section @var{name} [, "@var{flags}"[, @@@var{type}[,@var{flag_specific_arguments}]]]
6840 @end smallexample
6842 @anchor{Section Name Substitutions}
6843 @kindex --sectname-subst
6844 @cindex section name substitution
6845 If the @samp{--sectname-subst} command-line option is provided, the @var{name}
6846 argument may contain a substitution sequence. Only @code{%S} is supported
6847 at the moment, and substitutes the current section name. For example:
6849 @smallexample
6850 .macro exception_code
6851 .section %S.exception
6852 [exception code here]
6853 .previous
6854 .endm
6856 .text
6857 [code]
6858 exception_code
6859 [...]
6861 .section .init
6862 [init code]
6863 exception_code
6864 [...]
6865 @end smallexample
6867 The two @code{exception_code} invocations above would create the
6868 @code{.text.exception} and @code{.init.exception} sections respectively.
6869 This is useful e.g. to discriminate between ancillary sections that are
6870 tied to setup code to be discarded after use from ancillary sections that
6871 need to stay resident without having to define multiple @code{exception_code}
6872 macros just for that purpose.
6874 The optional @var{flags} argument is a quoted string which may contain any
6875 combination of the following characters:
6877 @table @code
6878 @item a
6879 section is allocatable
6880 @item d
6881 section is a GNU_MBIND section
6882 @item e
6883 section is excluded from executable and shared library.
6884 @item o
6885 section references a symbol defined in another section (the linked-to
6886 section) in the same file.
6887 @item w
6888 section is writable
6889 @item x
6890 section is executable
6891 @item M
6892 section is mergeable
6893 @item S
6894 section contains zero terminated strings
6895 @item G
6896 section is a member of a section group
6897 @item T
6898 section is used for thread-local-storage
6899 @item ?
6900 section is a member of the previously-current section's group, if any
6901 @item +
6902 section inherits attributes and (unless explicitly specified) type from the
6903 previously-current section, adding other attributes as specified
6904 @item -
6905 section inherits attributes and (unless explicitly specified) type from the
6906 previously-current section, removing other attributes as specified
6907 @item R
6908 retained section (apply SHF_GNU_RETAIN to prevent linker garbage
6909 collection, GNU ELF extension)
6910 @item @code{<number>}
6911 a numeric value indicating the bits to be set in the ELF section header's flags
6912 field.  Note - if one or more of the alphabetic characters described above is
6913 also included in the flags field, their bit values will be ORed into the
6914 resulting value.
6915 @item @code{<target specific>}
6916 some targets extend this list with their own flag characters
6917 @end table
6919 Note - once a section's flags have been set they cannot be changed.  There are
6920 a few exceptions to this rule however.  Processor and application specific
6921 flags can be added to an already defined section.  The @code{.interp},
6922 @code{.strtab} and @code{.symtab} sections can have the allocate flag
6923 (@code{a}) set after they are initially defined, and the @code{.note-GNU-stack}
6924 section may have the executable (@code{x}) flag added.  Also note that the
6925 @code{.attach_to_group} directive can be used to add a section to a group even
6926 if the section was not originally declared to be part of that group.
6928 Note further that @code{+} and @code{-} need to come first and can only take
6929 the effect described here unless overridden by a target.  The attributes
6930 inherited are those in effect at the time the directive is processed.
6931 Attributes added later (see above) will not be inherited.  Using either
6932 together with @code{?} is undefined at this point.
6934 The optional @var{type} argument may contain one of the following constants:
6936 @table @code
6937 @item @@progbits
6938 section contains data
6939 @item @@nobits
6940 section does not contain data (i.e., section only occupies space)
6941 @item @@note
6942 section contains data which is used by things other than the program
6943 @item @@init_array
6944 section contains an array of pointers to init functions
6945 @item @@fini_array
6946 section contains an array of pointers to finish functions
6947 @item @@preinit_array
6948 section contains an array of pointers to pre-init functions
6949 @item @@@code{<number>}
6950 a numeric value to be set as the ELF section header's type field.
6951 @item @@@code{<target specific>}
6952 some targets extend this list with their own types
6953 @end table
6955 Many targets only support the first three section types.  The type may be
6956 enclosed in double quotes if necessary.
6958 Note on targets where the @code{@@} character is the start of a comment (eg
6959 ARM) then another character is used instead.  For example the ARM port uses the
6960 @code{%} character.
6962 Note - some sections, eg @code{.text} and @code{.data} are considered to be
6963 special and have fixed types.  Any attempt to declare them with a different
6964 type will generate an error from the assembler.
6966 If @var{flags} contains the @code{M} symbol then the @var{type} argument must
6967 be specified as well as an extra argument---@var{entsize}---like this:
6969 @smallexample
6970 .section @var{name} , "@var{flags}"M, @@@var{type}, @var{entsize}
6971 @end smallexample
6973 Sections with the @code{M} flag but not @code{S} flag must contain fixed size
6974 constants, each @var{entsize} octets long. Sections with both @code{M} and
6975 @code{S} must contain zero terminated strings where each character is
6976 @var{entsize} bytes long. The linker may remove duplicates within sections with
6977 the same name, same entity size and same flags.  @var{entsize} must be an
6978 absolute expression.  For sections with both @code{M} and @code{S}, a string
6979 which is a suffix of a larger string is considered a duplicate.  Thus
6980 @code{"def"} will be merged with @code{"abcdef"};  A reference to the first
6981 @code{"def"} will be changed to a reference to @code{"abcdef"+3}.
6983 If @var{flags} contains the @code{o} flag, then the @var{type} argument
6984 must be present along with an additional field like this:
6986 @smallexample
6987 .section @var{name},"@var{flags}"o,@@@var{type},@var{SymbolName}|@var{SectionIndex}
6988 @end smallexample
6990 The @var{SymbolName} field specifies the symbol name which the section
6991 references.  Alternatively a numeric @var{SectionIndex} can be provided.  This
6992 is not generally a good idea as section indices are rarely known at assembly
6993 time, but the facility is provided for testing purposes.  An index of zero is
6994 allowed.  It indicates that the linked-to section has already been discarded.
6996 Note: If both the @var{M} and @var{o} flags are present, then the fields
6997 for the Merge flag should come first, like this:
6999 @smallexample
7000 .section @var{name},"@var{flags}"Mo,@@@var{type},@var{entsize},@var{SymbolName}
7001 @end smallexample
7003 If @var{flags} contains the @code{G} symbol then the @var{type} argument must
7004 be present along with an additional field like this:
7006 @smallexample
7007 .section @var{name} , "@var{flags}"G, @@@var{type}, @var{GroupName}[, @var{linkage}]
7008 @end smallexample
7010 The @var{GroupName} field specifies the name of the section group to which this
7011 particular section belongs.  The optional linkage field can contain:
7013 @table @code
7014 @item comdat
7015 indicates that only one copy of this section should be retained
7016 @item .gnu.linkonce
7017 an alias for comdat
7018 @end table
7020 Note: if both the @var{M} and @var{G} flags are present then the fields for
7021 the Merge flag should come first, like this:
7023 @smallexample
7024 .section @var{name} , "@var{flags}"MG, @@@var{type}, @var{entsize}, @var{GroupName}[, @var{linkage}]
7025 @end smallexample
7027 If both @code{o} flag and @code{G} flag are present, then the
7028 @var{SymbolName} field for @code{o} comes first, like this:
7030 @smallexample
7031 .section @var{name},"@var{flags}"oG,@@@var{type},@var{SymbolName},@var{GroupName}[,@var{linkage}]
7032 @end smallexample
7034 If @var{flags} contains the @code{?} symbol then it may not also contain the
7035 @code{G} symbol and the @var{GroupName} or @var{linkage} fields should not be
7036 present.  Instead, @code{?} says to consider the section that's current before
7037 this directive.  If that section used @code{G}, then the new section will use
7038 @code{G} with those same @var{GroupName} and @var{linkage} fields implicitly.
7039 If not, then the @code{?} symbol has no effect.
7041 The optional @var{unique,@code{<number>}} argument must come last.  It
7042 assigns @var{@code{<number>}} as a unique section ID to distinguish
7043 different sections with the same section name like these:
7045 @smallexample
7046 .section @var{name},"@var{flags}",@@@var{type},@var{unique,@code{<number>}}
7047 .section @var{name},"@var{flags}"G,@@@var{type},@var{GroupName},[@var{linkage}],@var{unique,@code{<number>}}
7048 .section @var{name},"@var{flags}"MG,@@@var{type},@var{entsize},@var{GroupName}[,@var{linkage}],@var{unique,@code{<number>}}
7049 @end smallexample
7051 The valid values of @var{@code{<number>}} are between 0 and 4294967295.
7053 If no flags are specified, the default flags depend upon the section name.  If
7054 the section name is not recognized, the default will be for the section to have
7055 none of the above flags: it will not be allocated in memory, nor writable, nor
7056 executable.  The section will contain data.
7058 For SPARC ELF targets, the assembler supports another type of @code{.section}
7059 directive for compatibility with the Solaris assembler:
7061 @smallexample
7062 .section "@var{name}"[, @var{flags}...]
7063 @end smallexample
7065 Note that the section name is quoted.  There may be a sequence of comma
7066 separated flags:
7068 @table @code
7069 @item #alloc
7070 section is allocatable
7071 @item #write
7072 section is writable
7073 @item #execinstr
7074 section is executable
7075 @item #exclude
7076 section is excluded from executable and shared library.
7077 @item #tls
7078 section is used for thread local storage
7079 @end table
7081 This directive replaces the current section and subsection.  See the
7082 contents of the gas testsuite directory @code{gas/testsuite/gas/elf} for
7083 some examples of how this directive and the other section stack directives
7084 work.
7085 @end ifset
7086 @end ifset
7088 @node Set
7089 @section @code{.set @var{symbol}, @var{expression}}
7091 @cindex @code{set} directive
7092 @cindex symbol value, setting
7093 Set the value of @var{symbol} to @var{expression}.  This
7094 changes @var{symbol}'s value and type to conform to
7095 @var{expression}.  If @var{symbol} was flagged as external, it remains
7096 flagged (@pxref{Symbol Attributes}).
7098 You may @code{.set} a symbol many times in the same assembly provided that the
7099 values given to the symbol are constants.  Values that are based on expressions
7100 involving other symbols are allowed, but some targets may restrict this to only
7101 being done once per assembly.  This is because those targets do not set the
7102 addresses of symbols at assembly time, but rather delay the assignment until a
7103 final link is performed.  This allows the linker a chance to change the code in
7104 the files, changing the location of, and the relative distance between, various
7105 different symbols.
7107 If you @code{.set} a global symbol, the value stored in the object
7108 file is the last value stored into it.
7110 @ifset Z80
7111 On Z80 @code{set} is a real instruction, use @code{.set} or
7112 @samp{@var{symbol} defl @var{expression}} instead.
7113 @end ifset
7115 @node Short
7116 @section @code{.short @var{expressions}}
7118 @cindex @code{short} directive
7119 @ifset GENERIC
7120 @code{.short} is normally the same as @samp{.word}.
7121 @xref{Word,,@code{.word}}.
7123 In some configurations, however, @code{.short} and @code{.word} generate
7124 numbers of different lengths.  @xref{Machine Dependencies}.
7125 @end ifset
7126 @ifclear GENERIC
7127 @ifset W16
7128 @code{.short} is the same as @samp{.word}.  @xref{Word,,@code{.word}}.
7129 @end ifset
7130 @ifset W32
7131 This expects zero or more @var{expressions}, and emits
7132 a 16 bit number for each.
7133 @end ifset
7134 @end ifclear
7136 Note - this directive is not intended for encoding instructions, and it will
7137 not trigger effects like DWARF line number generation.  Instead some targets
7138 support special directives for encoding arbitrary binary sequences as
7139 instructions such as @code{.insn} or @code{.inst}.
7141 @node Single
7142 @section @code{.single @var{flonums}}
7144 @cindex @code{single} directive
7145 @cindex floating point numbers (single)
7146 This directive assembles zero or more flonums, separated by commas.  It
7147 has the same effect as @code{.float}.
7148 @ifset GENERIC
7149 The exact kind of floating point numbers emitted depends on how
7150 @command{@value{AS}} is configured.  @xref{Machine Dependencies}.
7151 @end ifset
7152 @ifclear GENERIC
7153 @ifset IEEEFLOAT
7154 On the @value{TARGET} family, @code{.single} emits 32-bit floating point
7155 numbers in @sc{ieee} format.
7156 @end ifset
7157 @end ifclear
7159 @ifset COFF-ELF
7160 @node Size
7161 @section @code{.size}
7163 This directive is used to set the size associated with a symbol.
7165 @ifset COFF
7166 @ifset ELF
7167 @c only print the extra heading if both COFF and ELF are set
7168 @subheading COFF Version
7169 @end ifset
7171 @cindex @code{size} directive (COFF version)
7172 For COFF targets, the @code{.size} directive is only permitted inside
7173 @code{.def}/@code{.endef} pairs.  It is used like this:
7175 @smallexample
7176 .size @var{expression}
7177 @end smallexample
7179 @end ifset
7181 @ifset ELF
7182 @ifset COFF
7183 @c only print the extra heading if both COFF and ELF are set
7184 @subheading ELF Version
7185 @end ifset
7187 @cindex @code{size} directive (ELF version)
7188 For ELF targets, the @code{.size} directive is used like this:
7190 @smallexample
7191 .size @var{name} , @var{expression}
7192 @end smallexample
7194 This directive sets the size associated with a symbol @var{name}.
7195 The size in bytes is computed from @var{expression} which can make use of label
7196 arithmetic.  This directive is typically used to set the size of function
7197 symbols.
7198 @end ifset
7199 @end ifset
7201 @ifclear no-space-dir
7202 @node Skip
7203 @section @code{.skip @var{size} [,@var{fill}]}
7205 @cindex @code{skip} directive
7206 @cindex filling memory
7207 This directive emits @var{size} bytes, each of value @var{fill}.  Both
7208 @var{size} and @var{fill} are absolute expressions.  If the comma and
7209 @var{fill} are omitted, @var{fill} is assumed to be zero.  This is the same as
7210 @samp{.space}.
7211 @end ifclear
7213 @node Sleb128
7214 @section @code{.sleb128 @var{expressions}}
7216 @cindex @code{sleb128} directive
7217 @var{sleb128} stands for ``signed little endian base 128.''  This is a
7218 compact, variable length representation of numbers used by the DWARF
7219 symbolic debugging format.  @xref{Uleb128, ,@code{.uleb128}}.
7221 @ifclear no-space-dir
7222 @node Space
7223 @section @code{.space @var{size} [,@var{fill}]}
7225 @cindex @code{space} directive
7226 @cindex filling memory
7227 This directive emits @var{size} bytes, each of value @var{fill}.  Both
7228 @var{size} and @var{fill} are absolute expressions.  If the comma
7229 and @var{fill} are omitted, @var{fill} is assumed to be zero.  This is the same
7230 as @samp{.skip}.
7232 @ifset HPPA
7233 @quotation
7234 @emph{Warning:} @code{.space} has a completely different meaning for HPPA
7235 targets; use @code{.block} as a substitute.  See @cite{HP9000 Series 800
7236 Assembly Language Reference Manual} (HP 92432-90001) for the meaning of the
7237 @code{.space} directive.  @xref{HPPA Directives,,HPPA Assembler Directives},
7238 for a summary.
7239 @end quotation
7240 @end ifset
7241 @end ifclear
7243 @ifset have-stabs
7244 @node Stab
7245 @section @code{.stabd, .stabn, .stabs}
7247 @cindex symbolic debuggers, information for
7248 @cindex @code{stab@var{x}} directives
7249 There are three directives that begin @samp{.stab}.
7250 All emit symbols (@pxref{Symbols}), for use by symbolic debuggers.
7251 The symbols are not entered in the @command{@value{AS}} hash table: they
7252 cannot be referenced elsewhere in the source file.
7253 Up to five fields are required:
7255 @table @var
7256 @item string
7257 This is the symbol's name.  It may contain any character except
7258 @samp{\000}, so is more general than ordinary symbol names.  Some
7259 debuggers used to code arbitrarily complex structures into symbol names
7260 using this field.
7262 @item type
7263 An absolute expression.  The symbol's type is set to the low 8 bits of
7264 this expression.  Any bit pattern is permitted, but @code{@value{LD}}
7265 and debuggers choke on silly bit patterns.
7267 @item other
7268 An absolute expression.  The symbol's ``other'' attribute is set to the
7269 low 8 bits of this expression.
7271 @item desc
7272 An absolute expression.  The symbol's descriptor is set to the low 16
7273 bits of this expression.
7275 @item value
7276 An absolute expression which becomes the symbol's value.
7277 @end table
7279 If a warning is detected while reading a @code{.stabd}, @code{.stabn},
7280 or @code{.stabs} statement, the symbol has probably already been created;
7281 you get a half-formed symbol in your object file.  This is
7282 compatible with earlier assemblers!
7284 @table @code
7285 @cindex @code{stabd} directive
7286 @item .stabd @var{type} , @var{other} , @var{desc}
7288 The ``name'' of the symbol generated is not even an empty string.
7289 It is a null pointer, for compatibility.  Older assemblers used a
7290 null pointer so they didn't waste space in object files with empty
7291 strings.
7293 The symbol's value is set to the location counter,
7294 relocatably.  When your program is linked, the value of this symbol
7295 is the address of the location counter when the @code{.stabd} was
7296 assembled.
7298 @cindex @code{stabn} directive
7299 @item .stabn @var{type} , @var{other} , @var{desc} , @var{value}
7300 The name of the symbol is set to the empty string @code{""}.
7302 @cindex @code{stabs} directive
7303 @item .stabs @var{string} ,  @var{type} , @var{other} , @var{desc} , @var{value}
7304 All five fields are specified.
7305 @end table
7306 @end ifset
7307 @c end     have-stabs
7309 @node String
7310 @section @code{.string} "@var{str}", @code{.string8} "@var{str}", @code{.string16}
7311 "@var{str}", @code{.string32} "@var{str}", @code{.string64} "@var{str}"
7313 @cindex string, copying to object file
7314 @cindex string8, copying to object file
7315 @cindex string16, copying to object file
7316 @cindex string32, copying to object file
7317 @cindex string64, copying to object file
7318 @cindex @code{string} directive
7319 @cindex @code{string8} directive
7320 @cindex @code{string16} directive
7321 @cindex @code{string32} directive
7322 @cindex @code{string64} directive
7324 Copy the characters in @var{str} to the object file.  You may specify more than
7325 one string to copy, separated by commas.  Unless otherwise specified for a
7326 particular machine, the assembler marks the end of each string with a 0 byte.
7327 You can use any of the escape sequences described in @ref{Strings,,Strings}.
7329 The variants @code{string16}, @code{string32} and @code{string64} differ from
7330 the @code{string} pseudo opcode in that each 8-bit character from @var{str} is
7331 copied and expanded to 16, 32 or 64 bits respectively.  The expanded characters
7332 are stored in target endianness byte order.
7334 Example:
7335 @smallexample
7336         .string32 "BYE"
7337 expands to:
7338         .string   "B\0\0\0Y\0\0\0E\0\0\0"  /* On little endian targets.  */
7339         .string   "\0\0\0B\0\0\0Y\0\0\0E"  /* On big endian targets.  */
7340 @end smallexample
7343 @node Struct
7344 @section @code{.struct @var{expression}}
7346 @cindex @code{struct} directive
7347 Switch to the absolute section, and set the section offset to @var{expression},
7348 which must be an absolute expression.  You might use this as follows:
7349 @smallexample
7350         .struct 0
7351 field1:
7352         .struct field1 + 4
7353 field2:
7354         .struct field2 + 4
7355 field3:
7356 @end smallexample
7357 This would define the symbol @code{field1} to have the value 0, the symbol
7358 @code{field2} to have the value 4, and the symbol @code{field3} to have the
7359 value 8.  Assembly would be left in the absolute section, and you would need to
7360 use a @code{.section} directive of some sort to change to some other section
7361 before further assembly.
7363 @ifset ELF
7364 @node SubSection
7365 @section @code{.subsection @var{name}}
7367 @cindex @code{subsection} directive
7368 @cindex Section Stack
7369 This is one of the ELF section stack manipulation directives.  The others are
7370 @code{.section} (@pxref{Section}), @code{.pushsection} (@pxref{PushSection}),
7371 @code{.popsection} (@pxref{PopSection}), and @code{.previous}
7372 (@pxref{Previous}).
7374 This directive replaces the current subsection with @code{name}.  The current
7375 section is not changed.  The replaced subsection is put onto the section stack
7376 in place of the then current top of stack subsection.
7377 @end ifset
7379 @ifset ELF
7380 @node Symver
7381 @section @code{.symver}
7382 @cindex @code{symver} directive
7383 @cindex symbol versioning
7384 @cindex versions of symbols
7385 Use the @code{.symver} directive to bind symbols to specific version nodes
7386 within a source file.  This is only supported on ELF platforms, and is
7387 typically used when assembling files to be linked into a shared library.
7388 There are cases where it may make sense to use this in objects to be bound
7389 into an application itself so as to override a versioned symbol from a
7390 shared library.
7392 For ELF targets, the @code{.symver} directive can be used like this:
7393 @smallexample
7394 .symver @var{name}, @var{name2@@nodename}[ ,@var{visibility}]
7395 @end smallexample
7396 If the original symbol @var{name} is defined within the file
7397 being assembled, the @code{.symver} directive effectively creates a symbol
7398 alias with the name @var{name2@@nodename}, and in fact the main reason that we
7399 just don't try and create a regular alias is that the @var{@@} character isn't
7400 permitted in symbol names.  The @var{name2} part of the name is the actual name
7401 of the symbol by which it will be externally referenced.  The name @var{name}
7402 itself is merely a name of convenience that is used so that it is possible to
7403 have definitions for multiple versions of a function within a single source
7404 file, and so that the compiler can unambiguously know which version of a
7405 function is being mentioned.  The @var{nodename} portion of the alias should be
7406 the name of a node specified in the version script supplied to the linker when
7407 building a shared library.  If you are attempting to override a versioned
7408 symbol from a shared library, then @var{nodename} should correspond to the
7409 nodename of the symbol you are trying to override.  The optional argument
7410 @var{visibility} updates the visibility of the original symbol.  The valid
7411 visibilities are @code{local}, @code{hidden}, and @code{remove}.  The
7412 @code{local} visibility makes the original symbol a local symbol
7413 (@pxref{Local}).  The @code{hidden} visibility sets the visibility of the
7414 original symbol to @code{hidden} (@pxref{Hidden}).  The @code{remove}
7415 visibility removes the original symbol from the symbol table.  If visibility
7416 isn't specified, the original symbol is unchanged.
7418 If the symbol @var{name} is not defined within the file being assembled, all
7419 references to @var{name} will be changed to @var{name2@@nodename}.  If no
7420 reference to @var{name} is made, @var{name2@@nodename} will be removed from the
7421 symbol table.
7423 Another usage of the @code{.symver} directive is:
7424 @smallexample
7425 .symver @var{name}, @var{name2@@@@nodename}
7426 @end smallexample
7427 In this case, the symbol @var{name} must exist and be defined within
7428 the file being assembled. It is similar to @var{name2@@nodename}. The
7429 difference is @var{name2@@@@nodename} will also be used to resolve
7430 references to @var{name2} by the linker.
7432 The third usage of the @code{.symver} directive is:
7433 @smallexample
7434 .symver @var{name}, @var{name2@@@@@@nodename}
7435 @end smallexample
7436 When @var{name} is not defined within the
7437 file being assembled, it is treated as @var{name2@@nodename}. When
7438 @var{name} is defined within the file being assembled, the symbol
7439 name, @var{name}, will be changed to @var{name2@@@@nodename}.
7440 @end ifset
7442 @ifset COFF
7443 @node Tag
7444 @section @code{.tag @var{structname}}
7446 @cindex COFF structure debugging
7447 @cindex structure debugging, COFF
7448 @cindex @code{tag} directive
7449 This directive is generated by compilers to include auxiliary debugging
7450 information in the symbol table.  It is only permitted inside
7451 @code{.def}/@code{.endef} pairs.  Tags are used to link structure
7452 definitions in the symbol table with instances of those structures.
7453 @end ifset
7455 @node Text
7456 @section @code{.text @var{subsection}}
7458 @cindex @code{text} directive
7459 Tells @command{@value{AS}} to assemble the following statements onto the end of
7460 the text subsection numbered @var{subsection}, which is an absolute
7461 expression.  If @var{subsection} is omitted, subsection number zero
7462 is used.
7464 @node Title
7465 @section @code{.title "@var{heading}"}
7467 @cindex @code{title} directive
7468 @cindex listing control: title line
7469 Use @var{heading} as the title (second line, immediately after the
7470 source file name and pagenumber) when generating assembly listings.
7472 This directive affects subsequent pages, as well as the current page if
7473 it appears within ten lines of the top of a page.
7475 @ifset ELF
7476 @node Tls_common
7477 @section @code{.tls_common @var{symbol}, @var{length}[, @var{alignment}]}
7479 @cindex @code{tls_common} directive
7480 This directive behaves in the same way as the @code{.comm} directive
7481 (@pxref{Comm}) except that @var{symbol} has type of STT_TLS instead of
7482 STT_OBJECT.
7483 @end ifset
7485 @ifset COFF-ELF
7486 @node Type
7487 @section @code{.type}
7489 This directive is used to set the type of a symbol.
7491 @ifset COFF
7492 @ifset ELF
7493 @c only print the extra heading if both COFF and ELF are set
7494 @subheading COFF Version
7495 @end ifset
7497 @cindex COFF symbol type
7498 @cindex symbol type, COFF
7499 @cindex @code{type} directive (COFF version)
7500 For COFF targets, this directive is permitted only within
7501 @code{.def}/@code{.endef} pairs.  It is used like this:
7503 @smallexample
7504 .type @var{int}
7505 @end smallexample
7507 This records the integer @var{int} as the type attribute of a symbol table
7508 entry.
7510 @end ifset
7512 @ifset ELF
7513 @ifset COFF
7514 @c only print the extra heading if both COFF and ELF are set
7515 @subheading ELF Version
7516 @end ifset
7518 @cindex ELF symbol type
7519 @cindex symbol type, ELF
7520 @cindex @code{type} directive (ELF version)
7521 For ELF targets, the @code{.type} directive is used like this:
7523 @smallexample
7524 .type @var{name} , @var{type description}
7525 @end smallexample
7527 This sets the type of symbol @var{name} to be either a
7528 function symbol or an object symbol.  There are five different syntaxes
7529 supported for the @var{type description} field, in order to provide
7530 compatibility with various other assemblers.
7532 Because some of the characters used in these syntaxes (such as @samp{@@} and
7533 @samp{#}) are comment characters for some architectures, some of the syntaxes
7534 below do not work on all architectures.  The first variant will be accepted by
7535 the GNU assembler on all architectures so that variant should be used for
7536 maximum portability, if you do not need to assemble your code with other
7537 assemblers.
7539 The syntaxes supported are:
7541 @smallexample
7542   .type <name> STT_<TYPE_IN_UPPER_CASE>
7543   .type <name>,#<type>
7544   .type <name>,@@<type>
7545   .type <name>,%<type>
7546   .type <name>,"<type>"
7547 @end smallexample
7549 The types supported are:
7551 @table @gcctabopt
7552 @item STT_FUNC
7553 @itemx function
7554 Mark the symbol as being a function name.
7556 @item STT_GNU_IFUNC
7557 @itemx gnu_indirect_function
7558 Mark the symbol as an indirect function when evaluated during reloc
7559 processing.  (This is only supported on assemblers targeting GNU systems).
7561 @item STT_OBJECT
7562 @itemx object
7563 Mark the symbol as being a data object.
7565 @item STT_TLS
7566 @itemx tls_object
7567 Mark the symbol as being a thread-local data object.
7569 @item STT_COMMON
7570 @itemx common
7571 Mark the symbol as being a common data object.
7573 @item STT_NOTYPE
7574 @itemx notype
7575 Does not mark the symbol in any way.  It is supported just for completeness.
7577 @item gnu_unique_object
7578 Marks the symbol as being a globally unique data object.  The dynamic linker
7579 will make sure that in the entire process there is just one symbol with this
7580 name and type in use.  (This is only supported on assemblers targeting GNU
7581 systems).
7583 @end table
7585 Changing between incompatible types other than from/to STT_NOTYPE will
7586 result in a diagnostic.  An intermediate change to STT_NOTYPE will silence
7587 this.
7589 Note: Some targets support extra types in addition to those listed above.
7591 @end ifset
7592 @end ifset
7594 @node Uleb128
7595 @section @code{.uleb128 @var{expressions}}
7597 @cindex @code{uleb128} directive
7598 @var{uleb128} stands for ``unsigned little endian base 128.''  This is a
7599 compact, variable length representation of numbers used by the DWARF
7600 symbolic debugging format.  @xref{Sleb128, ,@code{.sleb128}}.
7602 @ifset COFF
7603 @node Val
7604 @section @code{.val @var{addr}}
7606 @cindex @code{val} directive
7607 @cindex COFF value attribute
7608 @cindex value attribute, COFF
7609 This directive, permitted only within @code{.def}/@code{.endef} pairs,
7610 records the address @var{addr} as the value attribute of a symbol table
7611 entry.
7612 @end ifset
7614 @ifset ELF
7615 @node Version
7616 @section @code{.version "@var{string}"}
7618 @cindex @code{version} directive
7619 This directive creates a @code{.note} section and places into it an ELF
7620 formatted note of type NT_VERSION.  The note's name is set to @code{string}.
7621 @end ifset
7623 @ifset ELF
7624 @node VTableEntry
7625 @section @code{.vtable_entry @var{table}, @var{offset}}
7627 @cindex @code{vtable_entry} directive
7628 This directive finds or creates a symbol @code{table} and creates a
7629 @code{VTABLE_ENTRY} relocation for it with an addend of @code{offset}.
7631 @node VTableInherit
7632 @section @code{.vtable_inherit @var{child}, @var{parent}}
7634 @cindex @code{vtable_inherit} directive
7635 This directive finds the symbol @code{child} and finds or creates the symbol
7636 @code{parent} and then creates a @code{VTABLE_INHERIT} relocation for the
7637 parent whose addend is the value of the child symbol.  As a special case the
7638 parent name of @code{0} is treated as referring to the @code{*ABS*} section.
7639 @end ifset
7641 @node Warning
7642 @section @code{.warning "@var{string}"}
7643 @cindex warning directive
7644 Similar to the directive @code{.error}
7645 (@pxref{Error,,@code{.error "@var{string}"}}), but just emits a warning.
7647 @node Weak
7648 @section @code{.weak @var{names}}
7650 @cindex @code{weak} directive
7651 This directive sets the weak attribute on the comma separated list of symbol
7652 @code{names}.  If the symbols do not already exist, they will be created.
7654 On COFF targets other than PE, weak symbols are a GNU extension.  This
7655 directive sets the weak attribute on the comma separated list of symbol
7656 @code{names}.  If the symbols do not already exist, they will be created.
7658 On the PE target, weak symbols are supported natively as weak aliases.
7659 When a weak symbol is created that is not an alias, GAS creates an
7660 alternate symbol to hold the default value.
7662 @node Weakref
7663 @section @code{.weakref @var{alias}, @var{target}}
7665 @cindex @code{weakref} directive
7666 This directive creates an alias to the target symbol that enables the symbol to
7667 be referenced with weak-symbol semantics, but without actually making it weak.
7668 If direct references or definitions of the symbol are present, then the symbol
7669 will not be weak, but if all references to it are through weak references, the
7670 symbol will be marked as weak in the symbol table.
7672 The effect is equivalent to moving all references to the alias to a separate
7673 assembly source file, renaming the alias to the symbol in it, declaring the
7674 symbol as weak there, and running a reloadable link to merge the object files
7675 resulting from the assembly of the new source file and the old source file that
7676 had the references to the alias removed.
7678 The alias itself never makes to the symbol table, and is entirely handled
7679 within the assembler.
7681 @node Word
7682 @section @code{.word @var{expressions}}
7684 @cindex @code{word} directive
7685 This directive expects zero or more @var{expressions}, of any section,
7686 separated by commas.
7687 @ifclear GENERIC
7688 @ifset W32
7689 For each expression, @command{@value{AS}} emits a 32-bit number.
7690 @end ifset
7691 @ifset W16
7692 For each expression, @command{@value{AS}} emits a 16-bit number.
7693 @end ifset
7694 @end ifclear
7695 @ifset GENERIC
7697 The size of the number emitted, and its byte order,
7698 depend on what target computer the assembly is for.
7699 @end ifset
7701 @c on sparc the "special treatment to support compilers" doesn't
7702 @c happen---32-bit addressability, period; no long/short jumps.
7703 @ifset DIFF-TBL-KLUGE
7704 @cindex difference tables altered
7705 @cindex altered difference tables
7706 @quotation
7707 @emph{Warning: Special Treatment to support Compilers}
7708 @end quotation
7710 @ifset GENERIC
7711 Machines with a 32-bit address space, but that do less than 32-bit
7712 addressing, require the following special treatment.  If the machine of
7713 interest to you does 32-bit addressing (or doesn't require it;
7714 @pxref{Machine Dependencies}), you can ignore this issue.
7716 @end ifset
7717 In order to assemble compiler output into something that works,
7718 @command{@value{AS}} occasionally does strange things to @samp{.word} directives.
7719 Directives of the form @samp{.word sym1-sym2} are often emitted by
7720 compilers as part of jump tables.  Therefore, when @command{@value{AS}} assembles a
7721 directive of the form @samp{.word sym1-sym2}, and the difference between
7722 @code{sym1} and @code{sym2} does not fit in 16 bits, @command{@value{AS}}
7723 creates a @dfn{secondary jump table}, immediately before the next label.
7724 This secondary jump table is preceded by a short-jump to the
7725 first byte after the secondary table.  This short-jump prevents the flow
7726 of control from accidentally falling into the new table.  Inside the
7727 table is a long-jump to @code{sym2}.  The original @samp{.word}
7728 contains @code{sym1} minus the address of the long-jump to
7729 @code{sym2}.
7731 If there were several occurrences of @samp{.word sym1-sym2} before the
7732 secondary jump table, all of them are adjusted.  If there was a
7733 @samp{.word sym3-sym4}, that also did not fit in sixteen bits, a
7734 long-jump to @code{sym4} is included in the secondary jump table,
7735 and the @code{.word} directives are adjusted to contain @code{sym3}
7736 minus the address of the long-jump to @code{sym4}; and so on, for as many
7737 entries in the original jump table as necessary.
7739 @ifset INTERNALS
7740 @emph{This feature may be disabled by compiling @command{@value{AS}} with the
7741 @samp{-DWORKING_DOT_WORD} option.} This feature is likely to confuse
7742 assembly language programmers.
7743 @end ifset
7744 @end ifset
7745 @c end     DIFF-TBL-KLUGE
7747 @ifclear no-space-dir
7748 @node Zero
7749 @section @code{.zero @var{size}}
7751 @cindex @code{zero} directive
7752 @cindex filling memory with zero bytes
7753 This directive emits @var{size} 0-valued bytes.  @var{size} must be an absolute
7754 expression.  This directive is actually an alias for the @samp{.skip} directive
7755 so it can take an optional second argument of the value to store in the bytes
7756 instead of zero.  Using @samp{.zero} in this way would be confusing however.
7757 @end ifclear
7759 @node 2byte
7760 @section @code{.2byte @var{expression} [, @var{expression}]*}
7761 @cindex @code{2byte} directive
7762 @cindex two-byte integer
7763 @cindex integer, 2-byte
7765 This directive expects zero or more expressions, separated by commas.  If there
7766 are no expressions then the directive does nothing.  Otherwise each expression
7767 is evaluated in turn and placed in the next two bytes of the current output
7768 section, using the endian model of the target.  If an expression will not fit
7769 in two bytes, a warning message is displayed and the least significant two
7770 bytes of the expression's value are used.  If an expression cannot be evaluated
7771 at assembly time then relocations will be generated in order to compute the
7772 value at link time.  
7774 This directive does not apply any alignment before or after inserting the
7775 values.  As a result of this, if relocations are generated, they may be
7776 different from those used for inserting values with a guaranteed alignment.
7778 @node 4byte
7779 @section @code{.4byte @var{expression} [, @var{expression}]*}
7780 @cindex @code{4byte} directive
7781 @cindex four-byte integer
7782 @cindex integer, 4-byte
7784 Like the @option{.2byte} directive, except that it inserts unaligned, four byte
7785 long values into the output.
7787 @node 8byte
7788 @section @code{.8byte @var{expression} [, @var{expression}]*}
7789 @cindex @code{8byte} directive
7790 @cindex eight-byte integer
7791 @cindex integer, 8-byte
7793 For 64-bit architectures, or more generally with any GAS configured to support
7794 64-bit target virtual addresses, this is like the @option{.2byte} directive,
7795 except that it inserts unaligned, eight byte long values into the output.
7796 Otherwise, like @ref{Quad,,@code{.quad @var{expressions}}}, it expects zero or
7797 more bignums, separated by commas.
7799 @node Deprecated
7800 @section Deprecated Directives
7802 @cindex deprecated directives
7803 @cindex obsolescent directives
7804 One day these directives won't work.
7805 They are included for compatibility with older assemblers.
7806 @table @t
7807 @item .abort
7808 @item .line
7809 @end table
7811 @ifset ELF
7812 @node Object Attributes
7813 @chapter Object Attributes
7814 @cindex object attributes
7816 @command{@value{AS}} assembles source files written for a specific architecture
7817 into object files for that architecture.  But not all object files are alike.
7818 Many architectures support incompatible variations.  For instance, floating
7819 point arguments might be passed in floating point registers if the object file
7820 requires hardware floating point support---or floating point arguments might be
7821 passed in integer registers if the object file supports processors with no
7822 hardware floating point unit.  Or, if two objects are built for different
7823 generations of the same architecture, the combination may require the
7824 newer generation at run-time.
7826 This information is useful during and after linking.  At link time,
7827 @command{@value{LD}} can warn about incompatible object files.  After link
7828 time, tools like @command{gdb} can use it to process the linked file
7829 correctly.
7831 Compatibility information is recorded as a series of object attributes.  Each
7832 attribute has a @dfn{vendor}, @dfn{tag}, and @dfn{value}.  The vendor is a
7833 string, and indicates who sets the meaning of the tag.  The tag is an integer,
7834 and indicates what property the attribute describes.  The value may be a string
7835 or an integer, and indicates how the property affects this object.  Missing
7836 attributes are the same as attributes with a zero value or empty string value.
7838 Object attributes were developed as part of the ABI for the ARM Architecture.
7839 The file format is documented in @cite{ELF for the ARM Architecture}.
7841 @menu
7842 * GNU Object Attributes::               @sc{gnu} Object Attributes
7843 * Defining New Object Attributes::      Defining New Object Attributes
7844 @end menu
7846 @node GNU Object Attributes
7847 @section @sc{gnu} Object Attributes
7849 The @code{.gnu_attribute} directive records an object attribute
7850 with vendor @samp{gnu}.
7852 Except for @samp{Tag_compatibility}, which has both an integer and a string for
7853 its value, @sc{gnu} attributes have a string value if the tag number is odd and
7854 an integer value if the tag number is even.  The second bit (@code{@var{tag} &
7855 2} is set for architecture-independent attributes and clear for
7856 architecture-dependent ones.
7858 @subsection Common @sc{gnu} attributes
7860 These attributes are valid on all architectures.
7862 @table @r
7863 @item Tag_compatibility (32)
7864 The compatibility attribute takes an integer flag value and a vendor name.  If
7865 the flag value is 0, the file is compatible with other toolchains.  If it is 1,
7866 then the file is only compatible with the named toolchain.  If it is greater
7867 than 1, the file can only be processed by other toolchains under some private
7868 arrangement indicated by the flag value and the vendor name.
7869 @end table
7871 @subsection M680x0 Attributes
7873 @table @r
7874 @item Tag_GNU_M68K_ABI_FP (4)
7875 The floating-point ABI used by this object file.  The value will be:
7877 @itemize @bullet
7878 @item
7879 0 for files not affected by the floating-point ABI.
7880 @item
7881 1 for files using double-precision hardware floating-point ABI.
7882 @item
7883 2 for files using the software floating-point ABI.
7884 @end itemize
7885 @end table
7887 @subsection MIPS Attributes
7889 @table @r
7890 @item Tag_GNU_MIPS_ABI_FP (4)
7891 The floating-point ABI used by this object file.  The value will be:
7893 @itemize @bullet
7894 @item
7895 0 for files not affected by the floating-point ABI.
7896 @item
7897 1 for files using the hardware floating-point ABI with a standard
7898 double-precision FPU.
7899 @item
7900 2 for files using the hardware floating-point ABI with a single-precision FPU.
7901 @item
7902 3 for files using the software floating-point ABI.
7903 @item
7904 4 for files using the deprecated hardware floating-point ABI which used 64-bit
7905 floating-point registers, 32-bit general-purpose registers and increased the
7906 number of callee-saved floating-point registers.
7907 @item
7908 5 for files using the hardware floating-point ABI with a double-precision FPU
7909 with either 32-bit or 64-bit floating-point registers and 32-bit
7910 general-purpose registers.
7911 @item
7912 6 for files using the hardware floating-point ABI with 64-bit floating-point
7913 registers and 32-bit general-purpose registers.
7914 @item
7915 7 for files using the hardware floating-point ABI with 64-bit floating-point
7916 registers, 32-bit general-purpose registers and a rule that forbids the
7917 direct use of odd-numbered single-precision floating-point registers.
7918 @end itemize
7920 @item Tag_GNU_MIPS_ABI_MSA (8)
7921 The MIPS SIMD Architecture (MSA) ABI used by this object file.  The value
7922 will be:
7924 @itemize @bullet
7925 @item
7926 0 for files not affected by the MSA ABI.
7927 @item
7928 1 for files using the 128-bit MSA ABI.
7929 @end itemize
7931 @end table
7933 @subsection PowerPC Attributes
7935 @table @r
7936 @item Tag_GNU_Power_ABI_FP (4)
7937 The floating-point ABI used by this object file.  The value will be:
7939 @itemize @bullet
7940 @item
7941 0 for files not affected by the floating-point ABI.
7942 @item
7943 1 for files using double-precision hardware floating-point ABI.
7944 @item
7945 2 for files using the software floating-point ABI.
7946 @item
7947 3 for files using single-precision hardware floating-point ABI.
7948 @end itemize
7950 @item Tag_GNU_Power_ABI_Vector (8)
7951 The vector ABI used by this object file.  The value will be:
7953 @itemize @bullet
7954 @item
7955 0 for files not affected by the vector ABI.
7956 @item
7957 1 for files using general purpose registers to pass vectors.
7958 @item
7959 2 for files using AltiVec registers to pass vectors.
7960 @item
7961 3 for files using SPE registers to pass vectors.
7962 @end itemize
7963 @end table
7965 @subsection IBM z Systems Attributes
7967 @table @r
7968 @item Tag_GNU_S390_ABI_Vector (8)
7969 The vector ABI used by this object file.  The value will be:
7971 @itemize @bullet
7972 @item
7973 0 for files not affected by the vector ABI.
7974 @item
7975 1 for files using software vector ABI.
7976 @item
7977 2 for files using hardware vector ABI.
7978 @end itemize
7979 @end table
7981 @subsection MSP430 Attributes
7983 @table @r
7984 @item Tag_GNU_MSP430_Data_Region (4)
7985 The data region used by this object file.  The value will be:
7987 @itemize @bullet
7988 @item
7989 0 for files not using the large memory model.
7990 @item
7991 1 for files which have been compiled with the condition that all
7992 data is in the lower memory region, i.e. below address 0x10000.
7993 @item
7994 2 for files which allow data to be placed in the full 20-bit memory range.
7995 @end itemize
7996 @end table
7998 @node Defining New Object Attributes
7999 @section Defining New Object Attributes
8001 If you want to define a new @sc{gnu} object attribute, here are the places you
8002 will need to modify.  New attributes should be discussed on the @samp{binutils}
8003 mailing list.
8005 @itemize @bullet
8006 @item
8007 This manual, which is the official register of attributes.
8008 @item
8009 The header for your architecture @file{include/elf}, to define the tag.
8010 @item
8011 The @file{bfd} support file for your architecture, to merge the attribute
8012 and issue any appropriate link warnings.
8013 @item
8014 Test cases in @file{ld/testsuite} for merging and link warnings.
8015 @item
8016 @file{binutils/readelf.c} to display your attribute.
8017 @item
8018 GCC, if you want the compiler to mark the attribute automatically.
8019 @end itemize
8021 @end ifset
8023 @ifset GENERIC
8024 @node Machine Dependencies
8025 @chapter Machine Dependent Features
8027 @cindex machine dependencies
8028 The machine instruction sets are (almost by definition) different on
8029 each machine where @command{@value{AS}} runs.  Floating point representations
8030 vary as well, and @command{@value{AS}} often supports a few additional
8031 directives or command-line options for compatibility with other
8032 assemblers on a particular platform.  Finally, some versions of
8033 @command{@value{AS}} support special pseudo-instructions for branch
8034 optimization.
8036 This chapter discusses most of these differences, though it does not
8037 include details on any machine's instruction set.  For details on that
8038 subject, see the hardware manufacturer's manual.
8040 @menu
8041 @ifset AARCH64
8042 * AArch64-Dependent::           AArch64 Dependent Features
8043 @end ifset
8044 @ifset ALPHA
8045 * Alpha-Dependent::             Alpha Dependent Features
8046 @end ifset
8047 @ifset ARC
8048 * ARC-Dependent::               ARC Dependent Features
8049 @end ifset
8050 @ifset ARM
8051 * ARM-Dependent::               ARM Dependent Features
8052 @end ifset
8053 @ifset AVR
8054 * AVR-Dependent::               AVR Dependent Features
8055 @end ifset
8056 @ifset Blackfin
8057 * Blackfin-Dependent::          Blackfin Dependent Features
8058 @end ifset
8059 @ifset BPF
8060 * BPF-Dependent::               BPF Dependent Features
8061 @end ifset
8062 @ifset CR16
8063 * CR16-Dependent::              CR16 Dependent Features
8064 @end ifset
8065 @ifset CRIS
8066 * CRIS-Dependent::              CRIS Dependent Features
8067 @end ifset
8068 @ifset CSKY
8069 * C-SKY-Dependent::             C-SKY Dependent Features
8070 @end ifset
8071 @ifset D10V
8072 * D10V-Dependent::              D10V Dependent Features
8073 @end ifset
8074 @ifset D30V
8075 * D30V-Dependent::              D30V Dependent Features
8076 @end ifset
8077 @ifset EPIPHANY
8078 * Epiphany-Dependent::          EPIPHANY Dependent Features
8079 @end ifset
8080 @ifset H8/300
8081 * H8/300-Dependent::            Renesas H8/300 Dependent Features
8082 @end ifset
8083 @ifset HPPA
8084 * HPPA-Dependent::              HPPA Dependent Features
8085 @end ifset
8086 @ifset I80386
8087 * i386-Dependent::              Intel 80386 and AMD x86-64 Dependent Features
8088 @end ifset
8089 @ifset IA64
8090 * IA-64-Dependent::             Intel IA-64 Dependent Features
8091 @end ifset
8092 @ifset IP2K
8093 * IP2K-Dependent::              IP2K Dependent Features
8094 @end ifset
8095 @ifset LOONGARCH
8096 * LoongArch-Dependent::         LoongArch Dependent Features
8097 @end ifset
8098 @ifset LM32
8099 * LM32-Dependent::              LM32 Dependent Features
8100 @end ifset
8101 @ifset KVX
8102 * KVX-Dependent::               KVX Dependent Features
8103 @end ifset
8104 @ifset M32C
8105 * M32C-Dependent::              M32C Dependent Features
8106 @end ifset
8107 @ifset M32R
8108 * M32R-Dependent::              M32R Dependent Features
8109 @end ifset
8110 @ifset M680X0
8111 * M68K-Dependent::              M680x0 Dependent Features
8112 @end ifset
8113 @ifset M68HC11
8114 * M68HC11-Dependent::           M68HC11 and 68HC12 Dependent Features
8115 @end ifset
8116 @ifset S12Z
8117 * S12Z-Dependent::              S12Z Dependent Features
8118 @end ifset
8119 @ifset METAG
8120 * Meta-Dependent ::             Meta Dependent Features
8121 @end ifset
8122 @ifset MICROBLAZE
8123 * MicroBlaze-Dependent::        MICROBLAZE Dependent Features
8124 @end ifset
8125 @ifset MIPS
8126 * MIPS-Dependent::              MIPS Dependent Features
8127 @end ifset
8128 @ifset MMIX
8129 * MMIX-Dependent::              MMIX Dependent Features
8130 @end ifset
8131 @ifset MSP430
8132 * MSP430-Dependent::            MSP430 Dependent Features
8133 @end ifset
8134 @ifset NDS32
8135 * NDS32-Dependent::             Andes NDS32 Dependent Features
8136 @end ifset
8137 @ifset NIOSII
8138 * NiosII-Dependent::            Altera Nios II Dependent Features
8139 @end ifset
8140 @ifset NS32K
8141 * NS32K-Dependent::             NS32K Dependent Features
8142 @end ifset
8143 @ifset OPENRISC
8144 * OpenRISC-Dependent::          OpenRISC 1000 Features
8145 @end ifset
8146 @ifset PDP11
8147 * PDP-11-Dependent::            PDP-11 Dependent Features
8148 @end ifset
8149 @ifset PJ
8150 * PJ-Dependent::                picoJava Dependent Features
8151 @end ifset
8152 @ifset PPC
8153 * PPC-Dependent::               PowerPC Dependent Features
8154 @end ifset
8155 @ifset PRU
8156 * PRU-Dependent::               PRU Dependent Features
8157 @end ifset
8158 @ifset RISCV
8159 * RISC-V-Dependent::            RISC-V Dependent Features
8160 @end ifset
8161 @ifset RL78
8162 * RL78-Dependent::              RL78 Dependent Features
8163 @end ifset
8164 @ifset RX
8165 * RX-Dependent::                RX Dependent Features
8166 @end ifset
8167 @ifset S390
8168 * S/390-Dependent::             IBM S/390 Dependent Features
8169 @end ifset
8170 @ifset SCORE
8171 * SCORE-Dependent::             SCORE Dependent Features
8172 @end ifset
8173 @ifset SH
8174 * SH-Dependent::                Renesas / SuperH SH Dependent Features
8175 @end ifset
8176 @ifset SPARC
8177 * Sparc-Dependent::             SPARC Dependent Features
8178 @end ifset
8179 @ifset TIC54X
8180 * TIC54X-Dependent::            TI TMS320C54x Dependent Features
8181 @end ifset
8182 @ifset TIC6X
8183 * TIC6X-Dependent ::            TI TMS320C6x Dependent Features
8184 @end ifset
8185 @ifset TILEGX
8186 * TILE-Gx-Dependent ::          Tilera TILE-Gx Dependent Features
8187 @end ifset
8188 @ifset TILEPRO
8189 * TILEPro-Dependent ::          Tilera TILEPro Dependent Features
8190 @end ifset
8191 @ifset V850
8192 * V850-Dependent::              V850 Dependent Features
8193 @end ifset
8194 @ifset VAX
8195 * Vax-Dependent::               VAX Dependent Features
8196 @end ifset
8197 @ifset VISIUM
8198 * Visium-Dependent::            Visium Dependent Features
8199 @end ifset
8200 @ifset WASM32
8201 * WebAssembly-Dependent::       WebAssembly Dependent Features
8202 @end ifset
8203 @ifset XGATE
8204 * XGATE-Dependent::             XGATE Dependent Features
8205 @end ifset
8206 @ifset XSTORMY16
8207 * XSTORMY16-Dependent::         XStormy16 Dependent Features
8208 @end ifset
8209 @ifset XTENSA
8210 * Xtensa-Dependent::            Xtensa Dependent Features
8211 @end ifset
8212 @ifset Z80
8213 * Z80-Dependent::               Z80 Dependent Features
8214 @end ifset
8215 @ifset Z8000
8216 * Z8000-Dependent::             Z8000 Dependent Features
8217 @end ifset
8218 @end menu
8220 @lowersections
8221 @end ifset
8223 @c The following major nodes are *sections* in the GENERIC version, *chapters*
8224 @c in single-cpu versions.  This is mainly achieved by @lowersections.  There is a
8225 @c peculiarity: to preserve cross-references, there must be a node called
8226 @c "Machine Dependencies".  Hence the conditional nodenames in each
8227 @c major node below.  Node defaulting in makeinfo requires adjacency of
8228 @c node and sectioning commands; hence the repetition of @chapter BLAH
8229 @c in both conditional blocks.
8231 @ifset AARCH64
8232 @include c-aarch64.texi
8233 @end ifset
8235 @ifset ALPHA
8236 @include c-alpha.texi
8237 @end ifset
8239 @ifset ARC
8240 @include c-arc.texi
8241 @end ifset
8243 @ifset ARM
8244 @include c-arm.texi
8245 @end ifset
8247 @ifset AVR
8248 @include c-avr.texi
8249 @end ifset
8251 @ifset Blackfin
8252 @include c-bfin.texi
8253 @end ifset
8255 @ifset BPF
8256 @include c-bpf.texi
8257 @end ifset
8259 @ifset CR16
8260 @include c-cr16.texi
8261 @end ifset
8263 @ifset CRIS
8264 @include c-cris.texi
8265 @end ifset
8267 @ifset CSKY
8268 @include c-csky.texi
8269 @end ifset
8271 @ifset Renesas-all
8272 @ifclear GENERIC
8273 @node Machine Dependencies
8274 @chapter Machine Dependent Features
8276 The machine instruction sets are different on each Renesas chip family,
8277 and there are also some syntax differences among the families.  This
8278 chapter describes the specific @command{@value{AS}} features for each
8279 family.
8281 @menu
8282 * H8/300-Dependent::            Renesas H8/300 Dependent Features
8283 * SH-Dependent::                Renesas SH Dependent Features
8284 @end menu
8285 @lowersections
8286 @end ifclear
8287 @end ifset
8289 @ifset D10V
8290 @include c-d10v.texi
8291 @end ifset
8293 @ifset D30V
8294 @include c-d30v.texi
8295 @end ifset
8297 @ifset EPIPHANY
8298 @include c-epiphany.texi
8299 @end ifset
8301 @ifset H8/300
8302 @include c-h8300.texi
8303 @end ifset
8305 @ifset HPPA
8306 @include c-hppa.texi
8307 @end ifset
8309 @ifset I80386
8310 @include c-i386.texi
8311 @end ifset
8313 @ifset IA64
8314 @include c-ia64.texi
8315 @end ifset
8317 @ifset IP2K
8318 @include c-ip2k.texi
8319 @end ifset
8321 @ifset LM32
8322 @include c-lm32.texi
8323 @end ifset
8325 @ifset LOONGARCH
8326 @include c-loongarch.texi
8327 @end ifset
8329 @ifset KVX
8330 @include c-kvx.texi
8331 @end ifset
8333 @ifset M32C
8334 @include c-m32c.texi
8335 @end ifset
8337 @ifset M32R
8338 @include c-m32r.texi
8339 @end ifset
8341 @ifset M680X0
8342 @include c-m68k.texi
8343 @end ifset
8345 @ifset M68HC11
8346 @include c-m68hc11.texi
8347 @end ifset
8349 @ifset S12Z
8350 @include c-s12z.texi
8351 @end ifset
8353 @ifset METAG
8354 @include c-metag.texi
8355 @end ifset
8357 @ifset MICROBLAZE
8358 @include c-microblaze.texi
8359 @end ifset
8361 @ifset MIPS
8362 @include c-mips.texi
8363 @end ifset
8365 @ifset MMIX
8366 @include c-mmix.texi
8367 @end ifset
8369 @ifset MSP430
8370 @include c-msp430.texi
8371 @end ifset
8373 @ifset NDS32
8374 @include c-nds32.texi
8375 @end ifset
8377 @ifset NIOSII
8378 @include c-nios2.texi
8379 @end ifset
8381 @ifset NS32K
8382 @include c-ns32k.texi
8383 @end ifset
8385 @ifset OPENRISC
8386 @include c-or1k.texi
8387 @end ifset
8389 @ifset PDP11
8390 @include c-pdp11.texi
8391 @end ifset
8393 @ifset PJ
8394 @include c-pj.texi
8395 @end ifset
8397 @ifset PPC
8398 @include c-ppc.texi
8399 @end ifset
8401 @ifset PRU
8402 @include c-pru.texi
8403 @end ifset
8405 @ifset RISCV
8406 @include c-riscv.texi
8407 @end ifset
8409 @ifset RL78
8410 @include c-rl78.texi
8411 @end ifset
8413 @ifset RX
8414 @include c-rx.texi
8415 @end ifset
8417 @ifset S390
8418 @include c-s390.texi
8419 @end ifset
8421 @ifset SCORE
8422 @include c-score.texi
8423 @end ifset
8425 @ifset SH
8426 @include c-sh.texi
8427 @end ifset
8429 @ifset SPARC
8430 @include c-sparc.texi
8431 @end ifset
8433 @ifset TIC54X
8434 @include c-tic54x.texi
8435 @end ifset
8437 @ifset TIC6X
8438 @include c-tic6x.texi
8439 @end ifset
8441 @ifset TILEGX
8442 @include c-tilegx.texi
8443 @end ifset
8445 @ifset TILEPRO
8446 @include c-tilepro.texi
8447 @end ifset
8449 @ifset V850
8450 @include c-v850.texi
8451 @end ifset
8453 @ifset VAX
8454 @include c-vax.texi
8455 @end ifset
8457 @ifset VISIUM
8458 @include c-visium.texi
8459 @end ifset
8461 @ifset WASM32
8462 @include c-wasm32.texi
8463 @end ifset
8465 @ifset XGATE
8466 @include c-xgate.texi
8467 @end ifset
8469 @ifset XSTORMY16
8470 @include c-xstormy16.texi
8471 @end ifset
8473 @ifset XTENSA
8474 @include c-xtensa.texi
8475 @end ifset
8477 @ifset Z80
8478 @include c-z80.texi
8479 @end ifset
8481 @ifset Z8000
8482 @include c-z8k.texi
8483 @end ifset
8485 @ifset GENERIC
8486 @c reverse effect of @down at top of generic Machine-Dep chapter
8487 @raisesections
8488 @end ifset
8490 @node Reporting Bugs
8491 @chapter Reporting Bugs
8492 @cindex bugs in assembler
8493 @cindex reporting bugs in assembler
8495 Your bug reports play an essential role in making @command{@value{AS}} reliable.
8497 Reporting a bug may help you by bringing a solution to your problem, or it may
8498 not.  But in any case the principal function of a bug report is to help the
8499 entire community by making the next version of @command{@value{AS}} work better.
8500 Bug reports are your contribution to the maintenance of @command{@value{AS}}.
8502 In order for a bug report to serve its purpose, you must include the
8503 information that enables us to fix the bug.
8505 @menu
8506 * Bug Criteria::                Have you found a bug?
8507 * Bug Reporting::               How to report bugs
8508 @end menu
8510 @node Bug Criteria
8511 @section Have You Found a Bug?
8512 @cindex bug criteria
8514 If you are not sure whether you have found a bug, here are some guidelines:
8516 @itemize @bullet
8517 @cindex fatal signal
8518 @cindex assembler crash
8519 @cindex crash of assembler
8520 @item
8521 If the assembler gets a fatal signal, for any input whatever, that is a
8522 @command{@value{AS}} bug.  Reliable assemblers never crash.
8524 @cindex error on valid input
8525 @item
8526 If @command{@value{AS}} produces an error message for valid input, that is a bug.
8528 @cindex invalid input
8529 @item
8530 If @command{@value{AS}} does not produce an error message for invalid input, that
8531 is a bug.  However, you should note that your idea of ``invalid input'' might
8532 be our idea of ``an extension'' or ``support for traditional practice''.
8534 @item
8535 If you are an experienced user of assemblers, your suggestions for improvement
8536 of @command{@value{AS}} are welcome in any case.
8537 @end itemize
8539 @node Bug Reporting
8540 @section How to Report Bugs
8541 @cindex bug reports
8542 @cindex assembler bugs, reporting
8544 A number of companies and individuals offer support for @sc{gnu} products.  If
8545 you obtained @command{@value{AS}} from a support organization, we recommend you
8546 contact that organization first.
8548 You can find contact information for many support companies and
8549 individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
8550 distribution.
8552 @ifset BUGURL
8553 In any event, we also recommend that you send bug reports for @command{@value{AS}}
8554 to @value{BUGURL}.
8555 @end ifset
8557 The fundamental principle of reporting bugs usefully is this:
8558 @strong{report all the facts}.  If you are not sure whether to state a
8559 fact or leave it out, state it!
8561 Often people omit facts because they think they know what causes the problem
8562 and assume that some details do not matter.  Thus, you might assume that the
8563 name of a symbol you use in an example does not matter.  Well, probably it does
8564 not, but one cannot be sure.  Perhaps the bug is a stray memory reference which
8565 happens to fetch from the location where that name is stored in memory;
8566 perhaps, if the name were different, the contents of that location would fool
8567 the assembler into doing the right thing despite the bug.  Play it safe and
8568 give a specific, complete example.  That is the easiest thing for you to do,
8569 and the most helpful.
8571 Keep in mind that the purpose of a bug report is to enable us to fix the bug if
8572 it is new to us.  Therefore, always write your bug reports on the assumption
8573 that the bug has not been reported previously.
8575 Sometimes people give a few sketchy facts and ask, ``Does this ring a
8576 bell?''  This cannot help us fix a bug, so it is basically useless.  We
8577 respond by asking for enough details to enable us to investigate.
8578 You might as well expedite matters by sending them to begin with.
8580 To enable us to fix the bug, you should include all these things:
8582 @itemize @bullet
8583 @item
8584 The version of @command{@value{AS}}.  @command{@value{AS}} announces it if you start
8585 it with the @samp{--version} argument.
8587 Without this, we will not know whether there is any point in looking for
8588 the bug in the current version of @command{@value{AS}}.
8590 @item
8591 Any patches you may have applied to the @command{@value{AS}} source.
8593 @item
8594 The type of machine you are using, and the operating system name and
8595 version number.
8597 @item
8598 What compiler (and its version) was used to compile @command{@value{AS}}---e.g.
8599 ``@code{gcc-2.7}''.
8601 @item
8602 The command arguments you gave the assembler to assemble your example and
8603 observe the bug.  To guarantee you will not omit something important, list them
8604 all.  A copy of the Makefile (or the output from make) is sufficient.
8606 If we were to try to guess the arguments, we would probably guess wrong
8607 and then we might not encounter the bug.
8609 @item
8610 A complete input file that will reproduce the bug.  If the bug is observed when
8611 the assembler is invoked via a compiler, send the assembler source, not the
8612 high level language source.  Most compilers will produce the assembler source
8613 when run with the @samp{-S} option.  If you are using @code{@value{GCC}}, use
8614 the options @samp{-v --save-temps}; this will save the assembler source in a
8615 file with an extension of @file{.s}, and also show you exactly how
8616 @command{@value{AS}} is being run.
8618 @item
8619 A description of what behavior you observe that you believe is
8620 incorrect.  For example, ``It gets a fatal signal.''
8622 Of course, if the bug is that @command{@value{AS}} gets a fatal signal, then we
8623 will certainly notice it.  But if the bug is incorrect output, we might not
8624 notice unless it is glaringly wrong.  You might as well not give us a chance to
8625 make a mistake.
8627 Even if the problem you experience is a fatal signal, you should still say so
8628 explicitly.  Suppose something strange is going on, such as, your copy of
8629 @command{@value{AS}} is out of sync, or you have encountered a bug in the C
8630 library on your system.  (This has happened!)  Your copy might crash and ours
8631 would not.  If you told us to expect a crash, then when ours fails to crash, we
8632 would know that the bug was not happening for us.  If you had not told us to
8633 expect a crash, then we would not be able to draw any conclusion from our
8634 observations.
8636 @item
8637 If you wish to suggest changes to the @command{@value{AS}} source, send us context
8638 diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p}
8639 option.  Always send diffs from the old file to the new file.  If you even
8640 discuss something in the @command{@value{AS}} source, refer to it by context, not
8641 by line number.
8643 The line numbers in our development sources will not match those in your
8644 sources.  Your line numbers would convey no useful information to us.
8645 @end itemize
8647 Here are some things that are not necessary:
8649 @itemize @bullet
8650 @item
8651 A description of the envelope of the bug.
8653 Often people who encounter a bug spend a lot of time investigating
8654 which changes to the input file will make the bug go away and which
8655 changes will not affect it.
8657 This is often time consuming and not very useful, because the way we
8658 will find the bug is by running a single example under the debugger
8659 with breakpoints, not by pure deduction from a series of examples.
8660 We recommend that you save your time for something else.
8662 Of course, if you can find a simpler example to report @emph{instead}
8663 of the original one, that is a convenience for us.  Errors in the
8664 output will be easier to spot, running under the debugger will take
8665 less time, and so on.
8667 However, simplification is not vital; if you do not want to do this,
8668 report the bug anyway and send us the entire test case you used.
8670 @item
8671 A patch for the bug.
8673 A patch for the bug does help us if it is a good one.  But do not omit
8674 the necessary information, such as the test case, on the assumption that
8675 a patch is all we need.  We might see problems with your patch and decide
8676 to fix the problem another way, or we might not understand it at all.
8678 Sometimes with a program as complicated as @command{@value{AS}} it is very hard to
8679 construct an example that will make the program follow a certain path through
8680 the code.  If you do not send us the example, we will not be able to construct
8681 one, so we will not be able to verify that the bug is fixed.
8683 And if we cannot understand what bug you are trying to fix, or why your
8684 patch should be an improvement, we will not install it.  A test case will
8685 help us to understand.
8687 @item
8688 A guess about what the bug is or what it depends on.
8690 Such guesses are usually wrong.  Even we cannot guess right about such
8691 things without first using the debugger to find the facts.
8692 @end itemize
8694 @node Acknowledgements
8695 @chapter Acknowledgements
8697 If you have contributed to GAS and your name isn't listed here,
8698 it is not meant as a slight.  We just don't know about it.  Send mail to the
8699 maintainer, and we'll correct the situation.  Currently
8700 @c (October 2012),
8701 the maintainer is Nick Clifton (email address @code{nickc@@redhat.com}).
8703 Dean Elsner wrote the original @sc{gnu} assembler for the VAX.@footnote{Any
8704 more details?}
8706 Jay Fenlason maintained GAS for a while, adding support for GDB-specific debug
8707 information and the 68k series machines, most of the preprocessing pass, and
8708 extensive changes in @file{messages.c}, @file{input-file.c}, @file{write.c}.
8710 K. Richard Pixley maintained GAS for a while, adding various enhancements and
8711 many bug fixes, including merging support for several processors, breaking GAS
8712 up to handle multiple object file format back ends (including heavy rewrite,
8713 testing, an integration of the coff and b.out back ends), adding configuration
8714 including heavy testing and verification of cross assemblers and file splits
8715 and renaming, converted GAS to strictly ANSI C including full prototypes, added
8716 support for m680[34]0 and cpu32, did considerable work on i960 including a COFF
8717 port (including considerable amounts of reverse engineering), a SPARC opcode
8718 file rewrite, DECstation, rs6000, and hp300hpux host ports, updated ``know''
8719 assertions and made them work, much other reorganization, cleanup, and lint.
8721 Ken Raeburn wrote the high-level BFD interface code to replace most of the code
8722 in format-specific I/O modules.
8724 The original VMS support was contributed by David L. Kashtan.  Eric Youngdale
8725 has done much work with it since.
8727 The Intel 80386 machine description was written by Eliot Dresselhaus.
8729 Minh Tran-Le at IntelliCorp contributed some AIX 386 support.
8731 The Motorola 88k machine description was contributed by Devon Bowen of Buffalo
8732 University and Torbjorn Granlund of the Swedish Institute of Computer Science.
8734 Keith Knowles at the Open Software Foundation wrote the original MIPS back end
8735 (@file{tc-mips.c}, @file{tc-mips.h}), and contributed Rose format support
8736 (which hasn't been merged in yet).  Ralph Campbell worked with the MIPS code to
8737 support a.out format.
8739 Support for the Zilog Z8k and Renesas H8/300 processors (tc-z8k,
8740 tc-h8300), and IEEE 695 object file format (obj-ieee), was written by
8741 Steve Chamberlain of Cygnus Support.  Steve also modified the COFF back end to
8742 use BFD for some low-level operations, for use with the H8/300 and AMD 29k
8743 targets.
8745 John Gilmore built the AMD 29000 support, added @code{.include} support, and
8746 simplified the configuration of which versions accept which directives.  He
8747 updated the 68k machine description so that Motorola's opcodes always produced
8748 fixed-size instructions (e.g., @code{jsr}), while synthetic instructions
8749 remained shrinkable (@code{jbsr}).  John fixed many bugs, including true tested
8750 cross-compilation support, and one bug in relaxation that took a week and
8751 required the proverbial one-bit fix.
8753 Ian Lance Taylor of Cygnus Support merged the Motorola and MIT syntax for the
8754 68k, completed support for some COFF targets (68k, i386 SVR3, and SCO Unix),
8755 added support for MIPS ECOFF and ELF targets, wrote the initial RS/6000 and
8756 PowerPC assembler, and made a few other minor patches.
8758 Steve Chamberlain made GAS able to generate listings.
8760 Hewlett-Packard contributed support for the HP9000/300.
8762 Jeff Law wrote GAS and BFD support for the native HPPA object format (SOM)
8763 along with a fairly extensive HPPA testsuite (for both SOM and ELF object
8764 formats).  This work was supported by both the Center for Software Science at
8765 the University of Utah and Cygnus Support.
8767 Support for ELF format files has been worked on by Mark Eichin of Cygnus
8768 Support (original, incomplete implementation for SPARC), Pete Hoogenboom and
8769 Jeff Law at the University of Utah (HPPA mainly), Michael Meissner of the Open
8770 Software Foundation (i386 mainly), and Ken Raeburn of Cygnus Support (sparc,
8771 and some initial 64-bit support).
8773 Linas Vepstas added GAS support for the ESA/390 ``IBM 370'' architecture.
8775 Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote GAS and BFD
8776 support for openVMS/Alpha.
8778 Timothy Wall, Michael Hayes, and Greg Smart contributed to the various tic*
8779 flavors.
8781 David Heine, Sterling Augustine, Bob Wilson and John Ruttenberg from Tensilica,
8782 Inc.@: added support for Xtensa processors.
8784 Several engineers at Cygnus Support have also provided many small bug fixes and
8785 configuration enhancements.
8787 Jon Beniston added support for the Lattice Mico32 architecture.
8789 Many others have contributed large or small bugfixes and enhancements.  If
8790 you have contributed significant work and are not mentioned on this list, and
8791 want to be, let us know.  Some of the history has been lost; we are not
8792 intentionally leaving anyone out.
8794 @node GNU Free Documentation License
8795 @appendix GNU Free Documentation License
8796 @include fdl.texi
8798 @node AS Index
8799 @unnumbered AS Index
8801 @printindex cp
8803 @bye
8804 @c Local Variables:
8805 @c fill-column: 79
8806 @c End: