748 lines
22 KiB
HTML
748 lines
22 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<!-- This HTML file has been created by texi2html 1.52
|
|
from ../texi/as.texinfo on 24 April 1999 -->
|
|
|
|
<TITLE>Using as - Overview</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
Go to the first, previous, <A HREF="as_2.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
|
|
<P><HR><P>
|
|
|
|
<P>
|
|
The Free Software Foundation Inc. thanks The Nice Computer
|
|
Company of Australia for loaning Dean Elsner to write the
|
|
first (Vax) version of <CODE>as</CODE> for Project GNU.
|
|
The proprietors, management and staff of TNCCA thank FSF for
|
|
distracting the boss while they got some work
|
|
done.
|
|
<P>
|
|
|
|
</P>
|
|
<P>
|
|
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
|
|
|
</P>
|
|
<P>
|
|
Permission is granted to make and distribute verbatim copies of
|
|
this manual provided the copyright notice and this permission notice
|
|
are preserved on all copies.
|
|
|
|
</P>
|
|
<P>
|
|
Permission is granted to copy and distribute modified versions of this manual
|
|
under the conditions for verbatim copying, provided that the entire resulting
|
|
derived work is distributed under the terms of a permission notice identical to
|
|
this one.
|
|
|
|
</P>
|
|
<P>
|
|
Permission is granted to copy and distribute translations of this manual
|
|
into another language, under the above conditions for modified versions.
|
|
|
|
</P>
|
|
|
|
|
|
|
|
<H1><A NAME="SEC1" HREF="as_toc.html#TOC1">Overview</A></H1>
|
|
<P>
|
|
This manual is a user guide to the GNU assembler <CODE>as</CODE>.
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX1"></A>
|
|
<A NAME="IDX2"></A>
|
|
<A NAME="IDX3"></A>
|
|
Here is a brief summary of how to invoke <CODE>as</CODE>. For details,
|
|
see section <A HREF="as_2.html#SEC9">Command-Line Options</A>.
|
|
|
|
</P>
|
|
|
|
<PRE>
|
|
as [ -a[cdhlns][=file] ] [ -D ] [ --defsym <VAR>sym</VAR>=<VAR>val</VAR> ]
|
|
[ -f ] [ --gstabs ] [ --help ] [ -I <VAR>dir</VAR> ] [ -J ] [ -K ] [ -L ]
|
|
[ --keep-locals ] [ -o <VAR>objfile</VAR> ] [ -R ] [ --statistics ] [ -v ]
|
|
[ -version ] [ --version ] [ -W ] [ -w ] [ -x ] [ -Z ]
|
|
[ -mbig-endian | -mlittle-endian ]
|
|
[ -m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]7[t][[d]m[i]] ]
|
|
[ -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t ]
|
|
[ -mthumb | -mall ]
|
|
[ -mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu ]
|
|
[ -EB | -EL ]
|
|
[ -mapcs-32 | -mapcs-26 ]
|
|
[ -O ]
|
|
[ -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
|
|
-Av8plus | -Av8plusa | -Av9 | -Av9a ]
|
|
[ -xarch=v8plus | -xarch=v8plusa ] [ -bump ] [ -32 | -64 ]
|
|
[ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ]
|
|
[ -b ] [ -no-relax ]
|
|
[ -l ] [ -m68000 | -m68010 | -m68020 | ... ]
|
|
[ -nocpp ] [ -EL ] [ -EB ] [ -G <VAR>num</VAR> ] [ -mcpu=<VAR>CPU</VAR> ]
|
|
[ -mips1 ] [ -mips2 ] [ -mips3 ] [ -m4650 ] [ -no-m4650 ]
|
|
[ --trap ] [ --break ]
|
|
[ --emulation=<VAR>name</VAR> ]
|
|
[ -- | <VAR>files</VAR> ... ]
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-a[cdhlmns]</CODE>
|
|
<DD>
|
|
Turn on listings, in any of a variety of ways:
|
|
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-ac</CODE>
|
|
<DD>
|
|
omit false conditionals
|
|
|
|
<DT><CODE>-ad</CODE>
|
|
<DD>
|
|
omit debugging directives
|
|
|
|
<DT><CODE>-ah</CODE>
|
|
<DD>
|
|
include high-level source
|
|
|
|
<DT><CODE>-al</CODE>
|
|
<DD>
|
|
include assembly
|
|
|
|
<DT><CODE>-am</CODE>
|
|
<DD>
|
|
include macro expansions
|
|
|
|
<DT><CODE>-an</CODE>
|
|
<DD>
|
|
omit forms processing
|
|
|
|
<DT><CODE>-as</CODE>
|
|
<DD>
|
|
include symbols
|
|
|
|
<DT><CODE>=file</CODE>
|
|
<DD>
|
|
set the name of the listing file
|
|
</DL>
|
|
|
|
You may combine these options; for example, use <SAMP>`-aln'</SAMP> for assembly
|
|
listing without forms processing. The <SAMP>`=file'</SAMP> option, if used, must be
|
|
the last one. By itself, <SAMP>`-a'</SAMP> defaults to <SAMP>`-ahls'</SAMP>.
|
|
|
|
<DT><CODE>-D</CODE>
|
|
<DD>
|
|
Ignored. This option is accepted for script compatibility with calls to
|
|
other assemblers.
|
|
|
|
<DT><CODE>--defsym <VAR>sym</VAR>=<VAR>value</VAR></CODE>
|
|
<DD>
|
|
Define the symbol <VAR>sym</VAR> to be <VAR>value</VAR> before assembling the input file.
|
|
<VAR>value</VAR> must be an integer constant. As in C, a leading <SAMP>`0x'</SAMP>
|
|
indicates a hexadecimal value, and a leading <SAMP>`0'</SAMP> indicates an octal value.
|
|
|
|
<DT><CODE>-f</CODE>
|
|
<DD>
|
|
"fast"---skip whitespace and comment preprocessing (assume source is
|
|
compiler output).
|
|
|
|
<DT><CODE>--gstabs</CODE>
|
|
<DD>
|
|
Generate stabs debugging information for each assembler line. This
|
|
may help debugging assembler code, if the debugger can handle it.
|
|
|
|
<DT><CODE>--help</CODE>
|
|
<DD>
|
|
Print a summary of the command line options and exit.
|
|
|
|
<DT><CODE>-I <VAR>dir</VAR></CODE>
|
|
<DD>
|
|
Add directory <VAR>dir</VAR> to the search list for <CODE>.include</CODE> directives.
|
|
|
|
<DT><CODE>-J</CODE>
|
|
<DD>
|
|
Don't warn about signed overflow.
|
|
|
|
<DT><CODE>-K</CODE>
|
|
<DD>
|
|
Issue warnings when difference tables altered for long displacements.
|
|
|
|
<DT><CODE>-L</CODE>
|
|
<DD>
|
|
<DT><CODE>--keep-locals</CODE>
|
|
<DD>
|
|
Keep (in the symbol table) local symbols. On traditional a.out systems
|
|
these start with <SAMP>`L'</SAMP>, but different systems have different local
|
|
label prefixes.
|
|
|
|
<DT><CODE>-o <VAR>objfile</VAR></CODE>
|
|
<DD>
|
|
Name the object-file output from <CODE>as</CODE> <VAR>objfile</VAR>.
|
|
|
|
<DT><CODE>-R</CODE>
|
|
<DD>
|
|
Fold the data section into the text section.
|
|
|
|
<DT><CODE>--statistics</CODE>
|
|
<DD>
|
|
Print the maximum space (in bytes) and total time (in seconds) used by
|
|
assembly.
|
|
|
|
<DT><CODE>--strip-local-absolute</CODE>
|
|
<DD>
|
|
Remove local absolute symbols from the outgoing symbol table.
|
|
|
|
<DT><CODE>-v</CODE>
|
|
<DD>
|
|
<DT><CODE>-version</CODE>
|
|
<DD>
|
|
Print the <CODE>as</CODE> version.
|
|
|
|
<DT><CODE>--version</CODE>
|
|
<DD>
|
|
Print the <CODE>as</CODE> version and exit.
|
|
|
|
<DT><CODE>-W</CODE>
|
|
<DD>
|
|
Suppress warning messages.
|
|
|
|
<DT><CODE>-w</CODE>
|
|
<DD>
|
|
Ignored.
|
|
|
|
<DT><CODE>-x</CODE>
|
|
<DD>
|
|
Ignored.
|
|
|
|
<DT><CODE>-Z</CODE>
|
|
<DD>
|
|
Generate an object file even after errors.
|
|
|
|
<DT><CODE>-- | <VAR>files</VAR> ...</CODE>
|
|
<DD>
|
|
Standard input, or source files to assemble.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when as is configured for
|
|
an ARC processor.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-mbig-endian</CODE>
|
|
<DD>
|
|
<A NAME="IDX4"></A>
|
|
<A NAME="IDX5"></A>
|
|
<A NAME="IDX6"></A>
|
|
|
|
Generate "big endian" format output.
|
|
|
|
<A NAME="IDX7"></A>
|
|
<DT><CODE>-mlittle-endian</CODE>
|
|
<DD>
|
|
Generate "little endian" format output.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when as is configured for the ARM
|
|
processor family.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-m[arm]1 | -m[arm]2 | -m[arm]250 | -m[arm]3 | -m[arm]6 | -m[arm]7[t][[d]m] | -m[arm]v2 | -m[arm]v2a | -m[arm]v3 | -m[arm]v3m | -m[arm]v4 | -m[arm]v4t</CODE>
|
|
<DD>
|
|
Specify which variant of the ARM architecture is the target.
|
|
<DT><CODE>-mthumb | -mall</CODE>
|
|
<DD>
|
|
Enable or disable Thumb only instruction decoding.
|
|
<DT><CODE>-mfpa10 | -mfpa11 | -mfpe-old | -mno-fpu</CODE>
|
|
<DD>
|
|
Select which Floating Point architcture is the target.
|
|
<DT><CODE>-mapcs-32 | -mapcs-26</CODE>
|
|
<DD>
|
|
Select which procedure calling convention is in use.
|
|
<DT><CODE>-EB | -EL</CODE>
|
|
<DD>
|
|
Select either big-endian (-EB) or little-endian (-EL) output.
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when as is configured for
|
|
a D10V processor.
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-O</CODE>
|
|
<DD>
|
|
<A NAME="IDX8"></A>
|
|
<A NAME="IDX9"></A>
|
|
|
|
Optimize output by parallelizing instructions.
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when as is configured for the
|
|
Intel 80960 processor.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC</CODE>
|
|
<DD>
|
|
Specify which variant of the 960 architecture is the target.
|
|
|
|
<DT><CODE>-b</CODE>
|
|
<DD>
|
|
Add code to collect statistics about branches taken.
|
|
|
|
<DT><CODE>-no-relax</CODE>
|
|
<DD>
|
|
Do not alter compare-and-branch instructions for long displacements;
|
|
error if necessary.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when as is configured for the
|
|
Motorola 68000 series.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-l</CODE>
|
|
<DD>
|
|
Shorten references to undefined symbols, to one word instead of two.
|
|
|
|
<DT><CODE>-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060</CODE>
|
|
<DD>
|
|
<DT><CODE>| -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32 | -m5200</CODE>
|
|
<DD>
|
|
Specify what processor in the 68000 family is the target. The default
|
|
is normally the 68020, but this can be changed at configuration time.
|
|
|
|
<DT><CODE>-m68881 | -m68882 | -mno-68881 | -mno-68882</CODE>
|
|
<DD>
|
|
The target machine does (or does not) have a floating-point coprocessor.
|
|
The default is to assume a coprocessor for 68020, 68030, and cpu32. Although
|
|
the basic 68000 is not compatible with the 68881, a combination of the
|
|
two can be specified, since it's possible to do emulation of the
|
|
coprocessor instructions with the main processor.
|
|
|
|
<DT><CODE>-m68851 | -mno-68851</CODE>
|
|
<DD>
|
|
The target machine does (or does not) have a memory-management
|
|
unit coprocessor. The default is to assume an MMU for 68020 and up.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when <CODE>as</CODE> is configured
|
|
for the SPARC architecture:
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite</CODE>
|
|
<DD>
|
|
<DT><CODE>-Av8plus | -Av8plusa | -Av9 | -Av9a</CODE>
|
|
<DD>
|
|
Explicitly select a variant of the SPARC architecture.
|
|
|
|
<SAMP>`-Av8plus'</SAMP> and <SAMP>`-Av8plusa'</SAMP> select a 32 bit environment.
|
|
<SAMP>`-Av9'</SAMP> and <SAMP>`-Av9a'</SAMP> select a 64 bit environment.
|
|
|
|
<SAMP>`-Av8plusa'</SAMP> and <SAMP>`-Av9a'</SAMP> enable the SPARC V9 instruction set with
|
|
UltraSPARC extensions.
|
|
|
|
<DT><CODE>-xarch=v8plus | -xarch=v8plusa</CODE>
|
|
<DD>
|
|
For compatibility with the Solaris v9 assembler. These options are
|
|
equivalent to -Av8plus and -Av8plusa, respectively.
|
|
|
|
<DT><CODE>-bump</CODE>
|
|
<DD>
|
|
Warn when the assembler switches to another architecture.
|
|
</DL>
|
|
|
|
<P>
|
|
The following options are available when as is configured for
|
|
a MIPS processor.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>-G <VAR>num</VAR></CODE>
|
|
<DD>
|
|
This option sets the largest size of an object that can be referenced
|
|
implicitly with the <CODE>gp</CODE> register. It is only accepted for targets that
|
|
use ECOFF format, such as a DECstation running Ultrix. The default value is 8.
|
|
|
|
<A NAME="IDX10"></A>
|
|
<A NAME="IDX11"></A>
|
|
<A NAME="IDX12"></A>
|
|
<DT><CODE>-EB</CODE>
|
|
<DD>
|
|
Generate "big endian" format output.
|
|
|
|
<A NAME="IDX13"></A>
|
|
<DT><CODE>-EL</CODE>
|
|
<DD>
|
|
Generate "little endian" format output.
|
|
|
|
<A NAME="IDX14"></A>
|
|
<DT><CODE>-mips1</CODE>
|
|
<DD>
|
|
<DT><CODE>-mips2</CODE>
|
|
<DD>
|
|
<DT><CODE>-mips3</CODE>
|
|
<DD>
|
|
Generate code for a particular MIPS Instruction Set Architecture level.
|
|
<SAMP>`-mips1'</SAMP> corresponds to the R2000 and R3000 processors,
|
|
<SAMP>`-mips2'</SAMP> to the R6000 processor, and <SAMP>`-mips3'</SAMP> to the R4000
|
|
processor.
|
|
|
|
<DT><CODE>-m4650</CODE>
|
|
<DD>
|
|
<DT><CODE>-no-m4650</CODE>
|
|
<DD>
|
|
Generate code for the MIPS R4650 chip. This tells the assembler to accept
|
|
the <SAMP>`mad'</SAMP> and <SAMP>`madu'</SAMP> instruction, and to not schedule <SAMP>`nop'</SAMP>
|
|
instructions around accesses to the <SAMP>`HI'</SAMP> and <SAMP>`LO'</SAMP> registers.
|
|
<SAMP>`-no-m4650'</SAMP> turns off this option.
|
|
|
|
<DT><CODE>-mcpu=<VAR>CPU</VAR></CODE>
|
|
<DD>
|
|
Generate code for a particular MIPS cpu. This has little effect on the
|
|
assembler, but it is passed by <CODE>gcc</CODE>.
|
|
|
|
<A NAME="IDX15"></A>
|
|
<DT><CODE>--emulation=<VAR>name</VAR></CODE>
|
|
<DD>
|
|
This option causes <CODE>as</CODE> to emulate <CODE>as</CODE> 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
|
|
endianness. The available configuration names are: <SAMP>`mipsecoff'</SAMP>,
|
|
<SAMP>`mipself'</SAMP>, <SAMP>`mipslecoff'</SAMP>, <SAMP>`mipsbecoff'</SAMP>, <SAMP>`mipslelf'</SAMP>,
|
|
<SAMP>`mipsbelf'</SAMP>. The first two do not alter the default endianness from that
|
|
of the primary target for which the assembler was configured; the others change
|
|
the default to little- or big-endian as indicated by the <SAMP>`b'</SAMP> or <SAMP>`l'</SAMP>
|
|
in the name. Using <SAMP>`-EB'</SAMP> or <SAMP>`-EL'</SAMP> will override the endianness
|
|
selection in any case.
|
|
|
|
This option is currently supported only when the primary target
|
|
<CODE>as</CODE> is configured for is a MIPS ELF or ECOFF target.
|
|
Furthermore, the primary target or others specified with
|
|
<SAMP>`--enable-targets=...'</SAMP> at configuration time must include support for
|
|
the other format, if both are to be available. For example, the Irix 5
|
|
configuration includes support for both.
|
|
|
|
Eventually, this option will support more configurations, with more
|
|
fine-grained control over the assembler's behavior, and will be supported for
|
|
more processors.
|
|
|
|
<DT><CODE>-nocpp</CODE>
|
|
<DD>
|
|
<CODE>as</CODE> ignores this option. It is accepted for compatibility with
|
|
the native tools.
|
|
|
|
<DT><CODE>--trap</CODE>
|
|
<DD>
|
|
<DT><CODE>--no-trap</CODE>
|
|
<DD>
|
|
<DT><CODE>--break</CODE>
|
|
<DD>
|
|
<DT><CODE>--no-break</CODE>
|
|
<DD>
|
|
Control how to deal with multiplication overflow and division by zero.
|
|
<SAMP>`--trap'</SAMP> or <SAMP>`--no-break'</SAMP> (which are synonyms) take a trap exception
|
|
(and only work for Instruction Set Architecture level 2 and higher);
|
|
<SAMP>`--break'</SAMP> or <SAMP>`--no-trap'</SAMP> (also synonyms, and the default) take a
|
|
break exception.
|
|
</DL>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC2" HREF="as_toc.html#TOC2">Structure of this Manual</A></H2>
|
|
|
|
<P>
|
|
<A NAME="IDX16"></A>
|
|
This manual is intended to describe what you need to know to use
|
|
GNU <CODE>as</CODE>. We cover the syntax expected in source files, including
|
|
notation for symbols, constants, and expressions; the directives that
|
|
<CODE>as</CODE> understands; and of course how to invoke <CODE>as</CODE>.
|
|
|
|
</P>
|
|
<P>
|
|
This manual also describes some of the machine-dependent features of
|
|
various flavors of the assembler.
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX17"></A>
|
|
On the other hand, this manual is <EM>not</EM> intended as an introduction
|
|
to programming in assembly language--let alone programming in general!
|
|
In a similar vein, we make no attempt to introduce the machine
|
|
architecture; we do <EM>not</EM> describe the instruction set, standard
|
|
mnemonics, registers or addressing modes that are standard to a
|
|
particular architecture.
|
|
You may want to consult the manufacturer's
|
|
machine architecture manual for this information.
|
|
|
|
</P>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC3" HREF="as_toc.html#TOC3">The GNU Assembler</A></H2>
|
|
|
|
<P>
|
|
GNU <CODE>as</CODE> is really a family of assemblers.
|
|
If you use (or have used) the GNU assembler on one architecture, you
|
|
should find a fairly similar environment when you use it on another
|
|
architecture. Each version has much in common with the others,
|
|
including object file formats, most assembler directives (often called
|
|
<EM>pseudo-ops</EM>) and assembler syntax.
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX18"></A>
|
|
<CODE>as</CODE> is primarily intended to assemble the output of the
|
|
GNU C compiler <CODE>gcc</CODE> for use by the linker
|
|
<CODE>ld</CODE>. Nevertheless, we've tried to make <CODE>as</CODE>
|
|
assemble correctly everything that other assemblers for the same
|
|
machine would assemble.
|
|
Any exceptions are documented explicitly (see section <A HREF="as_8.html#SEC138">Machine Dependent Features</A>).
|
|
This doesn't mean <CODE>as</CODE> always uses the same syntax as another
|
|
assembler for the same architecture; for example, we know of several
|
|
incompatible versions of 680x0 assembly language syntax.
|
|
|
|
</P>
|
|
<P>
|
|
Unlike older assemblers, <CODE>as</CODE> is designed to assemble a source
|
|
program in one pass of the source file. This has a subtle impact on the
|
|
<KBD>.org</KBD> directive (see section <A HREF="as_7.html#SEC112"><CODE>.org <VAR>new-lc</CODE> , <VAR>fill</VAR></VAR></A>).
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC4" HREF="as_toc.html#TOC4">Object File Formats</A></H2>
|
|
|
|
<P>
|
|
<A NAME="IDX19"></A>
|
|
The GNU assembler can be configured to produce several alternative
|
|
object file formats. For the most part, this does not affect how you
|
|
write assembly language programs; but directives for debugging symbols
|
|
are typically different in different file formats. See section <A HREF="as_5.html#SEC50">Symbol Attributes</A>.
|
|
On the machine specific, <CODE>as</CODE> can be configured to produce either
|
|
<CODE>a.out</CODE> or COFF format object files.
|
|
On the machine specific, <CODE>as</CODE> can be configured to produce either
|
|
<CODE>b.out</CODE> or COFF format object files.
|
|
On the machine specific, <CODE>as</CODE> can be configured to produce either
|
|
SOM or ELF format object files.
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC5" HREF="as_toc.html#TOC5">Command Line</A></H2>
|
|
|
|
<P>
|
|
<A NAME="IDX20"></A>
|
|
After the program name <CODE>as</CODE>, the command line may contain
|
|
options and file names. Options may appear in any order, and may be
|
|
before, after, or between file names. The order of file names is
|
|
significant.
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX21"></A>
|
|
<A NAME="IDX22"></A>
|
|
<TT>`--'</TT> (two hyphens) by itself names the standard input file
|
|
explicitly, as one of the files for <CODE>as</CODE> to assemble.
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX23"></A>
|
|
Except for <SAMP>`--'</SAMP> any command line argument that begins with a
|
|
hyphen (<SAMP>`-'</SAMP>) is an option. Each option changes the behavior of
|
|
<CODE>as</CODE>. No option changes the way another option works. An
|
|
option is a <SAMP>`-'</SAMP> followed by one or more letters; the case of
|
|
the letter is important. All options are optional.
|
|
|
|
</P>
|
|
<P>
|
|
Some options expect exactly one file name to follow them. The file
|
|
name may either immediately follow the option's letter (compatible
|
|
with older assemblers) or it may be the next command argument (GNU
|
|
standard). These two command lines are equivalent:
|
|
|
|
</P>
|
|
|
|
<PRE>
|
|
as -o my-object-file.o mumble.s
|
|
as -omy-object-file.o mumble.s
|
|
</PRE>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC6" HREF="as_toc.html#TOC6">Input Files</A></H2>
|
|
|
|
<P>
|
|
<A NAME="IDX24"></A>
|
|
<A NAME="IDX25"></A>
|
|
<A NAME="IDX26"></A>
|
|
We use the phrase <EM>source program</EM>, abbreviated <EM>source</EM>, to
|
|
describe the program input to one run of <CODE>as</CODE>. The program may
|
|
be in one or more files; how the source is partitioned into files
|
|
doesn't change the meaning of the source.
|
|
|
|
</P>
|
|
<P>
|
|
The source program is a concatenation of the text in all the files, in the
|
|
order specified.
|
|
|
|
</P>
|
|
<P>
|
|
Each time you run <CODE>as</CODE> it assembles exactly one source
|
|
program. The source program is made up of one or more files.
|
|
(The standard input is also a file.)
|
|
|
|
</P>
|
|
<P>
|
|
You give <CODE>as</CODE> a command line that has zero or more input file
|
|
names. The input files are read (from left file name to right). A
|
|
command line argument (in any position) that has no special meaning
|
|
is taken to be an input file name.
|
|
|
|
</P>
|
|
<P>
|
|
If you give <CODE>as</CODE> no file names it attempts to read one input file
|
|
from the <CODE>as</CODE> standard input, which is normally your terminal. You
|
|
may have to type <KBD>ctl-D</KBD> to tell <CODE>as</CODE> there is no more program
|
|
to assemble.
|
|
|
|
</P>
|
|
<P>
|
|
Use <SAMP>`--'</SAMP> if you need to explicitly name the standard input file
|
|
in your command line.
|
|
|
|
</P>
|
|
<P>
|
|
If the source is empty, <CODE>as</CODE> produces a small, empty object
|
|
file.
|
|
|
|
</P>
|
|
|
|
<H3>Filenames and Line-numbers</H3>
|
|
|
|
<P>
|
|
<A NAME="IDX27"></A>
|
|
<A NAME="IDX28"></A>
|
|
There are two ways of locating a line in the input file (or files) and
|
|
either may be used in reporting error messages. One way refers to a line
|
|
number in a physical file; the other refers to a line number in a
|
|
"logical" file. See section <A HREF="as_1.html#SEC8">Error and Warning Messages</A>.
|
|
|
|
</P>
|
|
<P>
|
|
<EM>Physical files</EM> are those files named in the command line given
|
|
to <CODE>as</CODE>.
|
|
|
|
</P>
|
|
<P>
|
|
<EM>Logical files</EM> 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>as</CODE>
|
|
source is itself synthesized from other files.
|
|
See section <A HREF="as_7.html#SEC71"><CODE>.app-file <VAR>string</CODE></VAR></A>.
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC7" HREF="as_toc.html#TOC7">Output (Object) File</A></H2>
|
|
|
|
<P>
|
|
<A NAME="IDX29"></A>
|
|
<A NAME="IDX30"></A>
|
|
<A NAME="IDX31"></A>
|
|
<A NAME="IDX32"></A>
|
|
Every time you run <CODE>as</CODE> it produces an output file, which is
|
|
your assembly language program translated into numbers. This file
|
|
is the object file. Its default name is
|
|
<CODE>a.out</CODE>, or
|
|
<CODE>b.out</CODE> when <CODE>as</CODE> is configured for the Intel 80960.
|
|
You can give it another name by using the <CODE>-o</CODE> option. Conventionally,
|
|
object file names end with <TT>`.o'</TT>. The default name is used for historical
|
|
reasons: older assemblers were capable of assembling self-contained programs
|
|
directly into a runnable program. (For some formats, this isn't currently
|
|
possible, but it can be done for the <CODE>a.out</CODE> format.)
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX33"></A>
|
|
<A NAME="IDX34"></A>
|
|
The object file is meant for input to the linker <CODE>ld</CODE>. It contains
|
|
assembled program code, information to help <CODE>ld</CODE> integrate
|
|
the assembled program into a runnable file, and (optionally) symbolic
|
|
information for the debugger.
|
|
|
|
</P>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC8" HREF="as_toc.html#TOC8">Error and Warning Messages</A></H2>
|
|
|
|
<P>
|
|
<A NAME="IDX35"></A>
|
|
<A NAME="IDX36"></A>
|
|
<A NAME="IDX37"></A>
|
|
<CODE>as</CODE> may write warnings and error messages to the standard error
|
|
file (usually your terminal). This should not happen when a compiler
|
|
runs <CODE>as</CODE> automatically. Warnings report an assumption made so
|
|
that <CODE>as</CODE> could keep assembling a flawed program; errors report a
|
|
grave problem that stops the assembly.
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX38"></A>
|
|
Warning messages have the format
|
|
|
|
</P>
|
|
|
|
<PRE>
|
|
file_name:<B>NNN</B>:Warning Message Text
|
|
</PRE>
|
|
|
|
<P>
|
|
<A NAME="IDX39"></A>
|
|
(where <B>NNN</B> is a line number). If a logical file name has been given
|
|
(see section <A HREF="as_7.html#SEC71"><CODE>.app-file <VAR>string</CODE></VAR></A>) it is used for the filename,
|
|
otherwise the name of the current input file is used. If a logical line
|
|
number was given
|
|
(see section <A HREF="as_7.html#SEC103"><CODE>.line <VAR>line-number</CODE></VAR></A>)
|
|
(see section <A HREF="as_7.html#SEC105"><CODE>.ln <VAR>line-number</CODE></VAR></A>)
|
|
then it is used to calculate the number printed,
|
|
otherwise the actual line in the current source file is printed. The
|
|
message text is intended to be self explanatory (in the grand Unix
|
|
tradition).
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX40"></A>
|
|
Error messages have the format
|
|
|
|
<PRE>
|
|
file_name:<B>NNN</B>:FATAL:Error Message Text
|
|
</PRE>
|
|
|
|
<P>
|
|
The file name and line number are derived as for warning
|
|
messages. The actual message text may be rather less explanatory
|
|
because many of them aren't supposed to happen.
|
|
|
|
</P>
|
|
<P><HR><P>
|
|
Go to the first, previous, <A HREF="as_2.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
|
|
</BODY>
|
|
</HTML>
|