\input texinfo @c -*-Texinfo-*-
-@c Copyright (c) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+@c Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998
+@c Free Software Foundation, Inc.
@c UPDATE!! On future updates--
@c (1) check for new machine-dep cmdline options in
@c md_parse_option definitions in config/tc-*.c
@set have-stabs
@c ---
@include asconfig.texi
+@include gasver.texi
@c ---
@c common OR combinations of conditions
@ifset AOUT
@set aout-bout
@end ifset
+@ifset ARM/Thumb
+@set ARM
+@end ifset
@ifset BOUT
@set aout-bout
@end ifset
@ifinfo
This file documents the GNU Assembler "@value{AS}".
-Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@subtitle for the @value{TARGET} family
@end ifclear
@sp 1
-@subtitle January 1994
+@subtitle Version @value{VERSION}
@sp 1
@sp 13
The Free Software Foundation Inc. thanks The Nice Computer
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@node Top
@top Using @value{AS}
-This file is a user guide to the @sc{gnu} assembler @code{@value{AS}}.
+This file is a user guide to the @sc{gnu} assembler @code{@value{AS}} version
+@value{VERSION}.
@ifclear GENERIC
This version of the file describes @code{@value{AS}} configured to generate
code for @value{TARGET} architectures.
@c We don't use deffn and friends for the following because they seem
@c to be limited to one line for the header.
@smallexample
-@value{AS} [ -a[dhlns][=file] ] [ -D ] [ --defsym @var{sym}=@var{val} ]
- [ -f ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ]
- [ -o @var{objfile} ] [ -R ] [ --statistics ] [ -v ] [ -version ]
- [ --version ] [ -W ] [ -w ] [ -x ] [ -Z ]
+@value{AS} [ -a[cdhlns][=file] ] [ -D ] [ --defsym @var{sym}=@var{val} ]
+ [ -f ] [ --gstabs ] [ --gdwarf2 ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ]
+ [ --keep-locals ] [ -o @var{objfile} ] [ -R ] [ --statistics ] [ -v ]
+ [ -version ] [ --version ] [ -W ] [ --warn ] [ --fatal-warnings ]
+ [ -w ] [ -x ] [ -Z ]
@ifset A29K
@c am29k has no machine-dependent assembler options
@end ifset
-@c start-sanitize-arc
@ifset ARC
[ -mbig-endian | -mlittle-endian ]
@end ifset
-@c end-sanitize-arc
+@ifset ARM
+ [ -m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]60 |
+ -m[arm]600 | -m[arm]610 | -m[arm]620 | -m[arm]7[t][[d]m[i]][fe] | -m[arm]70 |
+ -m[arm]700 | -m[arm]710[c] | -m[arm]7100 | -m[arm]7500 | -m[arm]8 |
+ -m[arm]810 | -m[arm]9 | -m[arm]920 | -m[arm]920t | -m[arm]9tdmi |
+ -mstrongarm | -mstrongarm110 | -mstrongarm1100 ]
+ [ -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t |
+ -m[arm]v5 | -[arm]v5t ]
+ [ -mthumb | -mall ]
+ [ -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu ]
+ [ -EB | -EL ]
+ [ -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant ]
+ [ -mthumb-interwork ]
+ [ -moabi ]
+ [ -k ]
+@end ifset
@ifset D10V
[ -O ]
@end ifset
-
+@ifset D30V
+ [ -O | -n | -N ]
+@end ifset
@ifset H8
@c Hitachi family chips have no machine-dependent assembler options
@end ifset
@ifset HPPA
@c HPPA has no machine-dependent assembler options (yet).
@end ifset
+@ifset PJ
+ [ -mb | -me ]
+@end ifset
@ifset SPARC
@c The order here is important. See c-sparc.texi.
- [ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | -Av9 | -Av9a ]
- [ -xarch=v8plus | -xarch=v8plusa ] [ -bump ]
+ [ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
+ -Av8plus | -Av8plusa | -Av9 | -Av9a ]
+ [ -xarch=v8plus | -xarch=v8plusa ] [ -bump ] [ -32 | -64 ]
@end ifset
@ifset Z8000
@c Z8000 has no machine-dependent assembler options
@ifset M680X0
[ -l ] [ -m68000 | -m68010 | -m68020 | ... ]
@end ifset
+@ifset MCORE
+ [ -jsri2bsr ] [ -sifilter ] [ -relax ]
+@end ifset
@ifset MIPS
[ -nocpp ] [ -EL ] [ -EB ] [ -G @var{num} ] [ -mcpu=@var{CPU} ]
[ -mips1 ] [ -mips2 ] [ -mips3 ] [ -m4650 ] [ -no-m4650 ]
@end smallexample
@table @code
-@item -a[dhlns]
+@item -a[cdhlmns]
Turn on listings, in any of a variety of ways:
@table @code
+@item -ac
+omit false conditionals
+
@item -ad
omit debugging directives
@item -al
include assembly
+@item -am
+include macro expansions
+
@item -an
omit forms processing
You may combine these options; for example, use @samp{-aln} for assembly
listing without forms processing. The @samp{=file} option, if used, must be
-the last one. By itself, @samp{-a} defaults to @samp{-ahls}---that is, all
-listings turned on.
+the last one. By itself, @samp{-a} defaults to @samp{-ahls}.
@item -D
Ignored. This option is accepted for script compatibility with calls to
``fast''---skip whitespace and comment preprocessing (assume source is
compiler output).
+@item --gstabs
+Generate stabs debugging information for each assembler line. This
+may help debugging assembler code, if the debugger can handle it.
+
+@item --gdwarf2
+Generate DWARF2 debugging information for each assembler line. This
+may help debugging assembler code, if the debugger can handle it.
+
@item --help
Print a summary of the command line options and exit.
@end ifset
@item -L
-Keep (in the symbol table) local symbols, starting with @samp{L}.
+@itemx --keep-locals
+Keep (in the symbol table) local symbols. On traditional a.out systems
+these start with @samp{L}, but different systems have different local
+label prefixes.
@item -o @var{objfile}
Name the object-file output from @code{@value{AS}} @var{objfile}.
Print the maximum space (in bytes) and total time (in seconds) used by
assembly.
+@item --strip-local-absolute
+Remove local absolute symbols from the outgoing symbol table.
+
@item -v
@itemx -version
Print the @code{as} version.
Print the @code{as} version and exit.
@item -W
+@itemx --no-warn
Suppress warning messages.
+@item --fatal-warnings
+Treat warnings as errors.
+
+@item --warn
+Don't suppress warning messages or treat them as errors.
+
@item -w
Ignored.
@end table
@end ifset
+@ifset ARM
+The following options are available when @value{AS} is configured for the ARM
+processor family.
+
+@table @code
+@item -m[arm][1|2|3|6|7|8|9][...]
+Specify which ARM processor variant is the target.
+@item -m[arm]v[2|2a|3|3m|4|4t|5|5t]
+Specify which ARM architecture variant is used by the target.
+@item -mthumb | -mall
+Enable or disable Thumb only instruction decoding.
+@item -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu
+Select which Floating Point architcture is the target.
+@item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi
+Select which procedure calling convention is in use.
+@item -EB | -EL
+Select either big-endian (-EB) or little-endian (-EL) output.
+@item -mthumb-interwork
+Specify that the code has been generated with interworking between Thumb and
+ARM code in mind.
+@item -k
+Specify that PIC code has been generated.
+@end table
+@end ifset
+
@ifset D10V
The following options are available when @value{AS} is configured for
a D10V processor.
@end table
@end ifset
+@ifset D30V
+The following options are available when @value{AS} is configured for a D30V
+processor.
+@table @code
+@cindex D30V optimization
+@cindex optimization, D30V
+@item -O
+Optimize output by parallelizing instructions.
+
+@cindex D30V nops
+@item -n
+Warn when nops are generated.
+
+@cindex D30V nops after 32-bit multiply
+@item -N
+Warn when a nop after a 32-bit multiply instruction is generated.
+@end table
+@end ifset
+
@ifset I960
The following options are available when @value{AS} is configured for the
Intel 80960 processor.
@end table
@end ifset
+
@ifset M680X0
The following options are available when @value{AS} is configured for the
Motorola 68000 series.
@end table
@end ifset
+@ifset PJ
+The following options are available when @value{AS} is configured for
+a picoJava processor.
+
+@table @code
+
+@cindex PJ endianness
+@cindex endianness, PJ
+@cindex big endian output, PJ
+@item -mb
+Generate ``big endian'' format output.
+
+@cindex little endian output, PJ
+@item -ml
+Generate ``little endian'' format output.
+
+@end table
+@end ifset
+
+
@ifset SPARC
The following options are available when @code{@value{AS}} is configured
for the SPARC architecture:
@table @code
-@item -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite | -Av9 | -Av9a
+@item -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
+@itemx -Av8plus | -Av8plusa | -Av9 | -Av9a
Explicitly select a variant of the SPARC architecture.
+@samp{-Av8plus} and @samp{-Av8plusa} select a 32 bit environment.
+@samp{-Av9} and @samp{-Av9a} select a 64 bit environment.
+
+@samp{-Av8plusa} and @samp{-Av9a} enable the SPARC V9 instruction set with
+UltraSPARC extensions.
+
@item -xarch=v8plus | -xarch=v8plusa
For compatibility with the Solaris v9 assembler. These options are
-equivalent to -Av9 and -Av9a, respectively.
+equivalent to -Av8plus and -Av8plusa, respectively.
@item -bump
Warn when the assembler switches to another architecture.
processor.
@item -m4650
-@item -no-m4650
+@itemx -no-m4650
Generate code for the MIPS @sc{r4650} chip. This tells the assembler to accept
the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop}
instructions around accesses to the @samp{HI} and @samp{LO} registers.
@cindex emulation
@item --emulation=@var{name}
-This option causes @code{@value{AS}} to emulated @code{@value{AS}} configured
+This option causes @code{@value{AS}} to emulate @code{@value{AS}} configured
for some other target, in all respects, including output format (choosing
between ELF and ECOFF only), handling of pseudo-opcodes which may generate
debugging information or store symbol table information, and default
@end table
@end ifset
+@ifset MCORE
+The following options are available when @value{AS} is configured for
+an MCore processor.
+
+@table @code
+@item -jsri2bsr
+@itemx -nojsri2bsr
+Enable or disable the JSRI to BSR transformation. By default this is enabled.
+The command line option @samp{-nojsri2bsr} can be used to disable it.
+
+@item -sifilter
+@itemx -nosifilter
+Enable or disable the silicon filter behaviour. By default this is disabled.
+The default can be overidden by the @samp{-sifilter} command line option.
+
+@item -relax
+Alter jump instructions for long displacements.
+
+
+@end table
+@end ifset
+
@menu
* Manual:: Structure of this Manual
-* GNU Assembler:: @value{AS}, the GNU Assembler
+* GNU Assembler:: The GNU Assembler
* Object Formats:: Object File Formats
* Command Line:: Command Line
* Input Files:: Input Files
@c directives).
@node GNU Assembler
-@section @value{AS}, the GNU Assembler
+@section The GNU Assembler
@sc{gnu} @code{as} is really a family of assemblers.
@ifclear GENERIC
including object file formats, most assembler directives (often called
@dfn{pseudo-ops}) and assembler syntax.@refill
-@cindex purpose of @sc{gnu} @code{@value{AS}}
+@cindex purpose of @sc{gnu} assembler
@code{@value{AS}} is primarily intended to assemble the output of the
@sc{gnu} C compiler @code{@value{GCC}} for use by the linker
@code{@value{LD}}. Nevertheless, we've tried to make @code{@value{AS}}
to @code{@value{AS}}.
@dfn{Logical files} are simply names declared explicitly by assembler
-directives; they bear no relation to physical files. Logical file names
-help error messages reflect the original source file, when @code{@value{AS}}
-source is itself synthesized from other files.
-@xref{App-File,,@code{.app-file}}.
+directives; they bear no relation to physical files. Logical file names help
+error messages reflect the original source file, when @code{@value{AS}} source
+is itself synthesized from other files. @code{@value{AS}} understands the
+@samp{#} directives emitted by the @code{@value{GCC}} preprocessor. See also
+@ref{File,,@code{.file}}.
@node Object
@section Output (Object) File
@cindex error messsages
@cindex warning messages
-@cindex messages from @code{@value{AS}}
+@cindex messages from assembler
@code{@value{AS}} may write warnings and error messages to the standard error
file (usually your terminal). This should not happen when a compiler
runs @code{@value{AS}} automatically. Warnings report an assumption made so
@noindent
@cindex line numbers, in warnings/errors
(where @b{NNN} is a line number). If a logical file name has been given
-(@pxref{App-File,,@code{.app-file}}) it is used for the filename,
-otherwise the name of the current input file is used. If a logical line
-number was given
+(@pxref{File,,@code{.file}}) it is used for the filename, otherwise the name of
+the current input file is used. If a logical line number was given
@ifset GENERIC
(@pxref{Line,,@code{.line}})
@end ifset
@node Invoking
@chapter Command-Line Options
-@cindex options, all versions of @code{@value{AS}}
+@cindex options, all versions of assembler
This chapter describes command-line options available in @emph{all}
versions of the @sc{gnu} assembler; @pxref{Machine Dependencies}, for options specific
@ifclear GENERIC
to particular machine architectures.
@end ifset
-If you are invoking @code{@value{AS}} via the @sc{gnu} C compiler (version 2), you
-can use the @samp{-Wa} option to pass arguments through to the
-assembler. The assembler arguments must be separated from each other
-(and the @samp{-Wa}) by commas. For example:
+If you are invoking @code{@value{AS}} via the @sc{gnu} C compiler (version 2),
+you can use the @samp{-Wa} option to pass arguments through to the assembler.
+The assembler arguments must be separated from each other (and the @samp{-Wa})
+by commas. For example:
@smallexample
gcc -c -g -O -Wa,-alh,-L file.c
@end smallexample
@noindent
-emits a listing to standard output with high-level
-and assembly source.
+This passes two options to the assembler: @samp{-alh} (emit a listing to
+standard output with with high-level and assembly source) and @samp{-L} (retain
+local symbols in the symbol table).
Usually you do not need to use this @samp{-Wa} mechanism, since many compiler
command-line options are automatically passed to the assembler by the compiler.
assembler.)
@menu
-* a:: -a[dhlns] enable listings
+* a:: -a[cdhlns] enable listings
* D:: -D for compatibility
* f:: -f to work faster
* I:: -I for .include search path
* L:: -L to retain local labels
* M:: -M or --mri to assemble in MRI compatibility mode
+* MD:: --MD for dependency tracking
* o:: -o to name the object file
* R:: -R to join data and text sections
* statistics:: --statistics to see statistics about assembly
+* traditional-format:: --traditional-format for compatible output
* v:: -v to announce version
-* W:: -W to suppress warnings
+* W:: -W, --no-warn, --warn, --fatal-warnings to control warnings
* Z:: -Z to make object file even after errors
@end menu
@node a
-@section Enable Listings: @code{-a[dhlns]}
+@section Enable Listings: @code{-a[cdhlns]}
@kindex -a
+@kindex -ac
@kindex -ad
@kindex -ah
@kindex -al
@samp{-g} be used, and that assembly listings (@samp{-al}) be requested
also.
+Use the @samp{-ac} option to omit false conditionals from a listing. Any lines
+which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any
+other conditional), or a true @code{.if} followed by an @code{.else}, will be
+omitted from the listing.
+
Use the @samp{-ad} option to omit debugging directives from the
listing.
@ifset HPPA
On the HPPA local labels begin with @samp{L$}.
@end ifset
-@c start-sanitize-arc
-@ifset ARC
-On the ARC local labels begin with @samp{.L}.
+@ifset ARM
+@samp{;} for the ARM family;
@end ifset
-@c end-sanitize-arc
@node M
@section Assemble in MRI Compatibility Mode: @code{-M}
@end itemize
+@node MD
+@section Dependency tracking: @code{--MD}
+
+@kindex --MD
+@cindex dependency tracking
+@cindex make rules
+
+@code{@value{AS}} can generate a dependency file for the file it creates. This
+file consists of a single rule suitable for @code{make} describing the
+dependencies of the main source file.
+
+The rule is written to the file named in its argument.
+
+This feature is used in the automatic updating of makefiles.
+
@node o
@section Name the Object File: @code{-o}
(in bytes), and the total execution time taken for the assembly (in @sc{cpu}
seconds).
+@node traditional-format
+@section Compatible output: @code{--traditional-format}
+
+@kindex --traditional-format
+For some targets, the output of @code{@value{AS}} is different in some ways
+from the output of some existing assembler. This switch requests
+@code{@value{AS}} to use the traditional format instead.
+
+For example, it disables the exception frame optimizations which
+@code{@value{AS}} normally does by default on @code{@value{GCC}} output.
+
@node v
@section Announce Version: @code{-v}
@kindex -v
@kindex -version
-@cindex @code{@value{AS}} version
-@cindex version of @code{@value{AS}}
+@cindex assembler version
+@cindex version of assembler
You can find out what version of as is running by including the
option @samp{-v} (which you can also spell as @samp{-version}) on the
command line.
@node W
-@section Suppress Warnings: @code{-W}
+@section Control Warnings: @code{-W}, @code{--warn}, @code{--no-warn}, @code{--fatal-warnings}
-@kindex -W
-@cindex suppressing warnings
-@cindex warnings, suppressing
@code{@value{AS}} should never give a warning or error message when
assembling compiler output. But programs written by people often
cause @code{@value{AS}} to give a warning that a particular assumption was
made. All such warnings are directed to the standard error file.
-If you use this option, no warnings are issued. This option only
-affects the warning messages: it does not change any particular of how
-@code{@value{AS}} assembles your file. Errors, which stop the assembly, are
-still reported.
+
+@kindex @samp{-W}
+@kindex @samp{--no-warn}
+@cindex suppressing warnings
+@cindex warnings, suppressing
+If you use the @code{-W} and @code{--no-warn} options, no warnings are issued.
+This only affects the warning messages: it does not change any particular of
+how @code{@value{AS}} assembles your file. Errors, which stop the assembly,
+are still reported.
+
+@kindex @samp{--fatal-warnings}
+@cindex errors, caused by warnings
+@cindex warnings, causing error
+If you use the @code{--fatal-warnings} option, @code{@value{AS}} considers
+files that generate warnings to be in error.
+
+@kindex @samp{--warn}
+@cindex warnings, switching on
+You can switch these options off again by specifying @code{--warn}, which
+causes warnings to be output as usual.
@node Z
@section Generate Object File in Spite of Errors: @code{-Z}
@ifset A29K
@samp{;} for the AMD 29K family;
@end ifset
-@c start-sanitize-arc
@ifset ARC
@samp{;} on the ARC;
@end ifset
-@c end-sanitize-arc
+@ifset ARM
+@samp{@@} on the ARM;
+@end ifset
@ifset H8/300
@samp{;} for the H8/300 family;
@end ifset
@ifset I960
@samp{#} on the i960;
@end ifset
+@ifset PJ
+@samp{;} for picoJava;
+@end ifset
@ifset SH
@samp{!} for the Hitachi SH;
@end ifset
@ifset SPARC
@samp{!} on the SPARC;
@end ifset
+@ifset M32R
+@samp{#} on the m32r;
+@end ifset
@ifset M680X0
@samp{|} on the 680x0;
@end ifset
@ifset Z8000
@samp{!} for the Z8000;
@end ifset
+@ifset V850
+@samp{#} on the V850;
+@end ifset
see @ref{Machine Dependencies}. @refill
@c FIXME What about i386, m88k, i860?
a line, while the other always begins a comment.
@end ifset
+@ifset V850
+The V850 assembler also supports a double dash as starting a comment that
+extends to the end of the line.
+
+@samp{--};
+@end ifset
+
@kindex #
@cindex lines starting with @code{#}
@cindex logical line numbers
It is an error to end any statement with end-of-file: the last
character of any input file should be a newline.@refill
-@cindex continuing statements
-@cindex multi-line statements
-@cindex statement on multiple lines
-You may write a statement on more than one line if you put a
-backslash (@kbd{\}) immediately in front of any newlines within the
-statement. When @code{@value{AS}} reads a backslashed newline both
-characters are ignored. You can even put backslashed newlines in
-the middle of symbol names without changing the meaning of your
-source program.
-
An empty statement is allowed, and may include whitespace. It is ignored.
@cindex instructions and directives
and AMD 29K architectures, the letter must be
one of the letters @samp{DFPRSX} (in upper or lower case).
-@c start-sanitize-arc
-On the ARC, the letter one of the letters @samp{DFRS}
+On the ARC, the letter must be one of the letters @samp{DFRS}
(in upper or lower case).
-@c end-sanitize-arc
On the Intel 960 architecture, the letter must be
one of the letters @samp{DFT} (in upper or lower case).
@ifset A29K
One of the letters @samp{DFPRSX} (in upper or lower case).
@end ifset
-@c start-sanitize-arc
@ifset ARC
One of the letters @samp{DFRS} (in upper or lower case).
@end ifset
-@c end-sanitize-arc
@ifset H8
One of the letters @samp{DFPRSX} (in upper or lower case).
@end ifset
@menu
* Secs Background:: Background
-* Ld Sections:: @value{LD} Sections
-* As Sections:: @value{AS} Internal Sections
+* Ld Sections:: Linker Sections
+* As Sections:: Assembler Internal Sections
* Sub-Sections:: Sub-Sections
* bss:: bss Section
@end menu
ensure they end on a word (sixteen bit) boundary.
@end ifset
-@cindex standard @code{@value{AS}} sections
+@cindex standard assembler sections
An object file written by @code{@value{AS}} has at least three sections, any
of which may be empty. These are named @dfn{text}, @dfn{data} and
@dfn{bss} sections.
use of @code{@value{AS}} and have no meaning except during assembly.
@node Ld Sections
-@section @value{LD} Sections
+@section Linker Sections
@code{@value{LD}} deals with just four kinds of sections, summarized below.
@table @strong
@c END TEXI2ROFF-KILL
@node As Sections
-@section @value{AS} Internal Sections
+@section Assembler Internal Sections
-@cindex internal @code{@value{AS}} sections
+@cindex internal assembler sections
@cindex sections in messages, internal
These sections are meant only for the internal use of @code{@value{AS}}. They
have no meaning at run-time. You do not really need to know about these
your program starts running, all the contents of the bss
section are zeroed bytes.
-Addresses in the bss section are allocated with special directives; you
-may not assemble anything directly into the bss section. Hence there
-are no bss subsections. @xref{Comm,,@code{.comm}},
-@pxref{Lcomm,,@code{.lcomm}}.
+The @code{.lcomm} pseudo-op defines a symbol in the bss section; see
+@ref{Lcomm,,@code{.lcomm}}.
+
+The @code{.comm} pseudo-op may be used to declare a common symbol, which is
+another form of uninitialized symbol; see @xref{Comm,,@code{.comm}}.
+
+@ifset GENERIC
+When assembling for a target which supports multiple sections, such as ELF or
+COFF, you may switch into the @code{.bss} section and define symbols as usual;
+see @ref{Section,,@code{.section}}. You may only assemble zero values into the
+section. Typically the section will only contain symbol definitions and
+@code{.skip} directives (@pxref{Skip,,@code{.skip}}).
+@end ifset
@node Symbols
@chapter Symbols
If the label is written @samp{1:} then the digit is @samp{1}.
And so on up through @samp{9:}.
-@item @ctrl{A}
+@item @kbd{C-A}
This unusual character is included so you do not accidentally invent
a symbol of the same name. The character has ASCII value
@samp{\001}.
through @samp{9:}.
@end table
-For instance, the first @code{1:} is named @code{L1@ctrl{A}1}, the 44th
-@code{3:} is named @code{L3@ctrl{A}44}.
+For instance, the first @code{1:} is named @code{L1@kbd{C-A}1}, the 44th
+@code{3:} is named @code{L3@kbd{C-A}44}.
@node Dot
@section The Special Dot Symbol
@end ifset
* Align:: @code{.align @var{abs-expr} , @var{abs-expr}}
-* App-File:: @code{.app-file @var{string}}
* Ascii:: @code{.ascii "@var{string}"}@dots{}
* Asciz:: @code{.asciz "@var{string}"}@dots{}
* Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}}
* Double:: @code{.double @var{flonums}}
* Eject:: @code{.eject}
* Else:: @code{.else}
+* Elseif:: @code{.elseif}
+* End:: @code{.end}
@ifset COFF
* Endef:: @code{.endef}
@end ifset
+* Endfunc:: @code{.endfunc}
* Endif:: @code{.endif}
* Equ:: @code{.equ @var{symbol}, @var{expression}}
+* Equiv:: @code{.equiv @var{symbol}, @var{expression}}
+* Err:: @code{.err}
+* Exitm:: @code{.exitm}
* Extern:: @code{.extern}
+* Fail:: @code{.fail}
@ifclear no-file-dir
* File:: @code{.file @var{string}}
@end ifclear
* Fill:: @code{.fill @var{repeat} , @var{size} , @var{value}}
* Float:: @code{.float @var{flonums}}
+* Func:: @code{.func}
* Global:: @code{.global @var{symbol}}, @code{.globl @var{symbol}}
* hword:: @code{.hword @var{expressions}}
* Ident:: @code{.ident}
* Octa:: @code{.octa @var{bignums}}
* Org:: @code{.org @var{new-lc} , @var{fill}}
* P2align:: @code{.p2align @var{abs-expr} , @var{abs-expr}}
+* Print:: @code{.print @var{string}}
* Psize:: @code{.psize @var{lines}, @var{columns}}
+* Purgem:: @code{.purgem @var{name}}
* Quad:: @code{.quad @var{bignums}}
* Rept:: @code{.rept @var{count}}
* Sbttl:: @code{.sbttl "@var{subheading}"}
@ifset COFF
* Scl:: @code{.scl @var{class}}
-@end ifset
-@ifset COFF
* Section:: @code{.section @var{name}, @var{subsection}}
@end ifset
@end ifset
* Skip:: @code{.skip @var{size} , @var{fill}}
+* Sleb128:: @code{.sleb128 @var{expressions}}
* Space:: @code{.space @var{size} , @var{fill}}
@ifset have-stabs
* Stab:: @code{.stabd, .stabn, .stabs}
@end ifset
* String:: @code{.string "@var{str}"}
+* Struct:: @code{.struct @var{expression}}
+@ifset ELF
+* Symver:: @code{.symver @var{name},@var{name2@@nodename}}
+@end ifset
@ifset COFF
* Tag:: @code{.tag @var{structname}}
@end ifset
* Type:: @code{.type @var{int}}
* Val:: @code{.val @var{addr}}
@end ifset
+@ifset ELF
+* Visibility:: @code{.internal @var{name}, .hidden @var{name}, .protected @var{name}}
+@end ifset
+* Uleb128:: @code{.uleb128 @var{expressions}}
* Word:: @code{.word @var{expressions}}
* Deprecated:: Deprecated Directives
@end menu
described later, which have a consistent behavior across all
architectures (but are specific to GAS).
-@node App-File
-@section @code{.app-file @var{string}}
-
-@cindex logical file name
-@cindex file name, logical
-@cindex @code{app-file} directive
-@code{.app-file}
-@ifclear no-file-dir
-(which may also be spelled @samp{.file})
-@end ifclear
-tells @code{@value{AS}} that we are about to start a new
-logical file. @var{string} is the new file name. In general, the
-filename is recognized whether or not it is surrounded by quotes @samp{"};
-but if you wish to specify an empty file name is permitted,
-you must give the quotes--@code{""}. This statement may go away in
-future: it is only recognized to be compatible with old @code{@value{AS}}
-programs.@refill
-
@node Ascii
@section @code{.ascii "@var{string}"}@dots{}
@cindex @code{comm} directive
@cindex symbol, common
-@code{.comm} declares a named common area in the bss section. Normally
-@code{@value{LD}} reserves memory addresses for it during linking, so no partial
-program defines the location of the symbol. Use @code{.comm} to tell
-@code{@value{LD}} that it must be at least @var{length} bytes long. @code{@value{LD}}
-allocates space for each @code{.comm} symbol that is at least as
-long as the longest @code{.comm} request in any of the partial programs
-linked. @var{length} is an absolute expression.
+@code{.comm} declares a common symbol named @var{symbol}. When linking, a
+common symbol in one object file may be merged with a defined or common symbol
+of the same name in another object file. If @code{@value{LD}} does not see a
+definition for the symbol--just one or more common symbols--then it will
+allocate @var{length} bytes of uninitialized memory. @var{length} must be an
+absolute expression. If @code{@value{LD}} sees multiple common symbols with
+the same name, and they do not all have the same size, it will allocate space
+using the largest size.
+
+@ifset ELF
+When using ELF, the @code{.comm} directive takes an optional third argument.
+This is the desired alignment of the symbol, specified as a byte boundary (for
+example, an alignment of 16 means that the least significant 4 bits of the
+address should be zero). The alignment must be an absolute expression, and it
+must be a power of two. If @code{@value{LD}} allocates uninitialized memory
+for the common symbol, it will use the alignment when placing the symbol. If
+no alignment is specified, @code{@value{AS}} will set the alignment to the
+largest power of two less than or equal to the size of the symbol, up to a
+maximum of 16.
+@end ifset
@ifset HPPA
The syntax for @code{.comm} differs slightly on the HPPA. The syntax is
of code to be assembled if the condition for the preceding @code{.if}
was false.
-@ignore
-@node End, Endef, Else, Pseudo Ops
+@node Elseif
+@section @code{.elseif}
+
+@cindex @code{elseif} directive
+@code{.elseif} is part of the @code{@value{AS}} support for conditional
+assembly; @pxref{If,,@code{.if}}. It is shorthand for beginning a new
+@code{.if} block that would otherwise fill the entire @code{.else} section.
+
+@node End
@section @code{.end}
@cindex @code{end} directive
-This doesn't do anything---but isn't an s_ignore, so I suspect it's
-meant to do something eventually (which is why it isn't documented here
-as "for compatibility with blah").
-@end ignore
+@code{.end} marks the end of the assembly file. @code{@value{AS}} does not
+process anything in the file past the @code{.end} directive.
@ifset COFF
@node Endef
@end ifset
@end ifset
+@node Endfunc
+@section @code{.endfunc}
+@cindex @code{endfunc} directive
+@code{.endfunc} marks the end of a function specified with @code{.func}.
+
@node Endif
@section @code{.endif}
@samp{@var{symbol} .equ @var{expression}}.
@end ifset
+@node Equiv
+@section @code{.equiv @var{symbol}, @var{expression}}
+@cindex @code{equiv} directive
+The @code{.equiv} directive is like @code{.equ} and @code{.set}, except that
+the assembler will signal an error if @var{symbol} is already defined.
+
+Except for the contents of the error message, this is roughly equivalent to
+@smallexample
+.ifdef SYM
+.err
+.endif
+.equ SYM,VAL
+@end smallexample
+
+@node Err
+@section @code{.err}
+@cindex @code{err} directive
+If @code{@value{AS}} assembles a @code{.err} directive, it will print an error
+message and, unless the @code{-Z} option was used, it will not generate an
+object file. This can be used to signal error an conditionally compiled code.
+
+@node Exitm
+@section @code{.exitm}
+Exit early from the current macro definition. @xref{Macro}.
+
@node Extern
@section @code{.extern}
with other assemblers---but it is ignored. @code{@value{AS}} treats
all undefined symbols as external.
+@node Fail
+@section @code{.fail @var{expression}}
+
+@cindex @code{fail} directive
+Generates an error or a warning. If the value of the @var{expression} is 500
+or more, @code{@value{AS}} will print a warning message. If the value is less
+than 500, @code{@value{AS}} will print an error message. The message will
+include the value of @var{expression}. This can occasionally be useful inside
+complex nested macros or conditional assembly.
+
@ifclear no-file-dir
@node File
@section @code{.file @var{string}}
@cindex @code{file} directive
@cindex logical file name
@cindex file name, logical
-@code{.file} (which may also be spelled @samp{.app-file}) tells
-@code{@value{AS}} that we are about to start a new logical file.
-@var{string} is the new file name. In general, the filename is
-recognized whether or not it is surrounded by quotes @samp{"}; but if
-you wish to specify an empty file name, you must give the
-quotes--@code{""}. This statement may go away in future: it is only
-recognized to be compatible with old @code{@value{AS}} programs.
+@code{.file} tells @code{@value{AS}} that we are about to start a new logical
+file. @var{string} is the new file name. In general, the filename is
+recognized whether or not it is surrounded by quotes @samp{"}; but if you wish
+to specify an empty file name, you must give the quotes--@code{""}. This
+statement may go away in future: it is only recognized to be compatible with
+old @code{@value{AS}} programs.
@ifset A29K
In some configurations of @code{@value{AS}}, @code{.file} has already been
removed to avoid conflicts with other assemblers. @xref{Machine Dependencies}.
@end ifset
@end ifclear
+@node Func
+@section @code{.func @var{name}[,@var{label}]}
+@cindex @code{func} directive
+@code{.func} emits debugging information to denote function @var{name}, and
+is ignored unless the file is assembled with debugging enabled.
+Only @samp{--gstabs} is currently supported.
+@var{label} is the entry point of the function and if omitted @var{name}
+prepended with the @samp{leading char} is used.
+@samp{leading char} is usually @code{_} or nothing, depending on the target.
+All functions are currently defined to have @code{void} return type.
+The function must be terminated with @code{.endfunc}.
+
@node Global
@section @code{.global @var{symbol}}, @code{.globl @var{symbol}}
the conditional section of code must be marked by @code{.endif}
(@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}).
+If you have several conditions to check, @code{.elseif} may be used to avoid
+nesting blocks if/else within each subsequent @code{.else} block.
The following variants of @code{.if} are also supported:
@table @code
Assembles the following section of code if the specified @var{symbol}
has been defined.
-@ignore
+@cindex @code{ifc} directive
+@item .ifc @var{string1},@var{string2}
+Assembles the following section of code if the two strings are the same. The
+strings may be optionally quoted with single quotes. If they are not quoted,
+the first string stops at the first comma, and the second string stops at the
+end of the line. Strings which contain whitespace should be quoted. The
+string comparison is case sensitive.
+
+@cindex @code{ifeq} directive
+@item .ifeq @var{absolute expression}
+Assembles the following section of code if the argument is zero.
+
@cindex @code{ifeqs} directive
-@item .ifeqs
-Not yet implemented.
-@end ignore
+@item .ifeqs @var{string1},@var{string2}
+Another form of @code{.ifc}. The strings must be quoted using double quotes.
+
+@cindex @code{ifge} directive
+@item .ifge @var{absolute expression}
+Assembles the following section of code if the argument is greater than or
+equal to zero.
+
+@cindex @code{ifgt} directive
+@item .ifgt @var{absolute expression}
+Assembles the following section of code if the argument is greater than zero.
+
+@cindex @code{ifle} directive
+@item .ifle @var{absolute expression}
+Assembles the following section of code if the argument is less than or equal
+to zero.
+
+@cindex @code{iflt} directive
+@item .iflt @var{absolute expression}
+Assembles the following section of code if the argument is less than zero.
+
+@cindex @code{ifnc} directive
+@item .ifnc @var{string1},@var{string2}.
+Like @code{.ifc}, but the sense of the test is reversed: this assembles the
+following section of code if the two strings are not the same.
@cindex @code{ifndef} directive
@cindex @code{ifnotdef} directive
Assembles the following section of code if the specified @var{symbol}
has not been defined. Both spelling variants are equivalent.
-@ignore
-@item ifnes
-Not yet implemented.
-@end ignore
+@cindex @code{ifne} directive
+@item .ifne @var{absolute expression}
+Assembles the following section of code if the argument is not equal to zero
+(in other words, this is equivalent to @code{.if}).
+
+@cindex @code{ifnes} directive
+@item .ifnes @var{string1},@var{string2}
+Like @code{.ifeqs}, but the sense of the test is reversed: this assembles the
+following section of code if the two strings are not the same.
@end table
@node Include
is not declared global (@pxref{Global,,@code{.global}}), so is normally
not visible to @code{@value{LD}}.
+@ifset GENERIC
+Some targets permit a third argument to be used with @code{.lcomm}. This
+argument specifies the desired alignment of the symbol in the bss section.
+@end ifset
+
@ifset HPPA
The syntax for @code{.lcomm} differs slightly on the HPPA. The syntax is
@samp{@var{symbol} .lcomm, @var{length}}; @var{symbol} is optional.
the endianness of the processor). If it skips 1 or 3 bytes, the fill value is
undefined.
+@node Print
+@section @code{.print @var{string}}
+
+@cindex @code{print} directive
+@code{@value{AS}} will print @var{string} on the standard output during
+assembly. You must put @var{string} in double quotes.
+
@node Psize
@section @code{.psize @var{lines} , @var{columns}}
If you specify @var{lines} as @code{0}, no formfeeds are generated save
those explicitly specified with @code{.eject}.
+@node Purgem
+@section @code{.purgem @var{name}}
+
+@cindex @code{purgem} directive
+Undefine the macro @var{name}, so that later uses of the string will not be
+expanded. @xref{Macro}.
+
@node Quad
@section @code{.quad @var{bignums}}
writable section
@item d
data section
+@item r
+read-only section
@item x
executable section
+@item s
+shared section (meaningful for PE targets)
@end table
If no flags are specified, the default flags depend upon the section name. If
@end ifset
@end ifset
+@node Sleb128
+@section @code{.sleb128 @var{expressions}}
+
+@cindex @code{sleb128} directive
+@var{sleb128} stands for ``signed little endian base 128.'' This is a
+compact, variable length representation of numbers used by the DWARF
+symbolic debugging format. @xref{Uleb128,@code{.uleb128}}.
+
@ifclear no-space-dir
@node Skip
@section @code{.skip @var{size} , @var{fill}}
particular machine, the assembler marks the end of each string with a 0 byte.
You can use any of the escape sequences described in @ref{Strings,,Strings}.
+@node Struct
+@section @code{.struct @var{expression}}
+
+@cindex @code{struct} directive
+Switch to the absolute section, and set the section offset to @var{expression},
+which must be an absolute expression. You might use this as follows:
+@smallexample
+ .struct 0
+field1:
+ .struct field1 + 4
+field2:
+ .struct field2 + 4
+field3:
+@end smallexample
+This would define the symbol @code{field1} to have the value 0, the symbol
+@code{field2} to have the value 4, and the symbol @code{field3} to have the
+value 8. Assembly would be left in the absolute section, and you would need to
+use a @code{.section} directive of some sort to change to some other section
+before further assembly.
+
+@ifset ELF
+@node Symver
+@section @code{.symver}
+@cindex @code{symver} directive
+@cindex symbol versioning
+@cindex versions of symbols
+Use the @code{.symver} directive to bind symbols to specific version nodes
+within a source file. This is only supported on ELF platforms, and is
+typically used when assembling files to be linked into a shared library.
+There are cases where it may make sense to use this in objects to be bound
+into an application itself so as to override a versioned symbol from a
+shared library.
+
+For ELF targets, the @code{.symver} directive is used like this:
+@smallexample
+.symver @var{name}, @var{name2@@nodename}
+@end smallexample
+In this case, the symbol @var{name} must exist and be defined within the file
+being assembled. The @code{.versym} directive effectively creates a symbol
+alias with the name @var{name2@@nodename}, and in fact the main reason that we
+just don't try and create a regular alias is that the @var{@@} character isn't
+permitted in symbol names. The @var{name2} part of the name is the actual name
+of the symbol by which it will be externally referenced. The name @var{name}
+itself is merely a name of convenience that is used so that it is possible to
+have definitions for multiple versions of a function within a single source
+file, and so that the compiler can unambiguously know which version of a
+function is being mentioned. The @var{nodename} portion of the alias should be
+the name of a node specified in the version script supplied to the linker when
+building a shared library. If you are attempting to override a versioned
+symbol from a shared library, then @var{nodename} should correspond to the
+nodename of the symbol you are trying to override.
+@end ifset
+
@ifset COFF
@node Tag
@section @code{.tag @var{structname}}
@end ifset
@end ifset
+@node Uleb128
+@section @code{.uleb128 @var{expressions}}
+
+@cindex @code{uleb128} directive
+@var{uleb128} stands for ``unsigned little endian base 128.'' This is a
+compact, variable length representation of numbers used by the DWARF
+symbolic debugging format. @xref{Sleb128,@code{.sleb128}}.
+
+@ifset ELF
+@node Visibility
+@section @code{.internal}, @code{.hidden}, @code{.protected}
+@cindex @code{internal} directive
+@cindex @code{hidden} directive
+@cindex @code{protected} directive
+@cindex symbol visibility
+
+These directives can be used to set the visibility of a specified symbol. By
+default a symbol's visibility is set by its binding (local, global or weak),
+but these directives can be used to override that.
+
+A visibility of @code{protected} means that any references to the symbol from
+within the component that defines the symbol must be resolved to the definition
+in that component, even if a definition in another component would normally
+preempt this.
+
+A visibility of @code{hidden} means that the symbol is not visible to other
+components. Such a symbol is always considered to be protected as well.
+
+A visibility of @code{internal} is the same as a visibility of @code{hidden},
+except that some extra, processor specific processing must also be performed
+upon the symbol.
+
+For ELF targets, the directives are used like this:
+
+@smallexample
+.internal @var{name}
+.hidden @var{name}
+.protected @var{name}
+@end smallexample
+
+@end ifset
+
@node Word
@section @code{.word @var{expressions}}
They are included for compatibility with older assemblers.
@table @t
@item .abort
-@item .app-file
@item .line
@end table
@ifset A29K
* AMD29K-Dependent:: AMD 29K Dependent Features
@end ifset
-@c start-sanitize-arc
@ifset ARC
* ARC-Dependent:: ARC Dependent Features
@end ifset
-@c end-sanitize-arc
+@ifset ARM
+* ARM-Dependent:: ARM Dependent Features
+@end ifset
@ifset D10V
* D10V-Dependent:: D10V Dependent Features
@end ifset
+@ifset D30V
+* D30V-Dependent:: D30V Dependent Features
+@end ifset
@ifset H8/300
* H8/300-Dependent:: Hitachi H8/300 Dependent Features
@end ifset
@ifset SH
* SH-Dependent:: Hitachi SH Dependent Features
@end ifset
+@ifset PJ
+* PJ-Dependent:: picoJava Dependent Features
+@end ifset
@ifset SPARC
* Sparc-Dependent:: SPARC Dependent Features
@end ifset
+@ifset V850
+* V850-Dependent:: V850 Dependent Features
+@end ifset
@ifset Z8000
* Z8000-Dependent:: Z8000 Dependent Features
@end ifset
@c node and sectioning commands; hence the repetition of @chapter BLAH
@c in both conditional blocks.
-@c start-sanitize-arc
@ifset ARC
@ifset GENERIC
@page
a few additional instructions at each level.
By default, @code{@value{AS}} assumes the core instruction set (ARC
-base). The @code{.cpu} pseudo-op is used to select a different variant.
+base). The @code{.cpu} pseudo-op is intended to be used to select
+the variant.
@table @code
@cindex @code{-mbig-endian} option (ARC)
@table @code
@item .cpu
@cindex @code{cpu} directive, SPARC
-This must be followed by the desired cpu. It must be one of
-@code{base}, @code{host}, @code{graphics}, or @code{audio}.
+This must be followed by the desired cpu.
+The ARC is intended to be customizable, @code{.cpu} is used to
+select the desired variant [though currently there are none].
@end table
@end ifset
-@c end-sanitize-arc
@ifset A29K
@include c-a29k.texi
@end ifset
+@ifset ARM
+@include c-arm.texi
+@end ifset
+
@ifset Hitachi-all
@ifclear GENERIC
@node Machine Dependencies
@include c-d10v.texi
@end ifset
+@ifset D30V
+@include c-d30v.texi
+@end ifset
+
@ifset H8/300
@include c-h8300.texi
@end ifset
@include c-i960.texi
@end ifset
+
@ifset M680X0
@include c-m68k.texi
@end ifset
@include c-ns32k.texi
@end ifset
+@ifset PJ
+@include c-pj.texi
+@end ifset
+
@ifset SH
@include c-sh.texi
@end ifset
@include c-vax.texi
@end ifset
+@ifset V850
+@include c-v850.texi
+@end ifset
+
@ifset GENERIC
@c reverse effect of @down at top of generic Machine-Dep chapter
@raisesections
@node Reporting Bugs
@chapter Reporting Bugs
-@cindex bugs in @code{@value{AS}}
-@cindex reporting bugs in @code{@value{AS}}
+@cindex bugs in assembler
+@cindex reporting bugs in assembler
Your bug reports play an essential role in making @code{@value{AS}} reliable.
@node Bug Reporting
@section How to report bugs
@cindex bug reports
-@cindex @code{@value{AS}} bugs, reporting
+@cindex assembler bugs, reporting
A number of companies and individuals offer support for @sc{gnu} products. If
you obtained @code{@value{AS}} from a support organization, we recommend you
distribution.
In any event, we also recommend that you send bug reports for @code{@value{AS}}
-to @samp{bug-gnu-utils@@prep.ai.mit.edu}.
+to @samp{bug-gnu-utils@@gnu.org}.
The fundamental principle of reporting bugs usefully is this:
@strong{report all the facts}. If you are not sure whether to state a
Software Foundation (i386 mainly), and Ken Raeburn of Cygnus Support (sparc,
and some initial 64-bit support).
-Richard Henderson rewrote the Alpha assembler.
+Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote GAS and BFD
+support for openVMS/Alpha.
Several engineers at Cygnus Support have also provided many small bug fixes and
configuration enhancements.