NAME
as - the GNU assembler
SYNOPSIS
as [-DLRWfgkv] [-o output] [input ...]
DESCRIPTION
The assembler converts human-readable `assembly language' into machine
language instructions. The GNU C compiler (cc(1)) and other GNU compil-
ers generate assembly language and use the GNU assembler to produce relo-
catable object files (a.out(5)), which may be linked together to form
executable binary files (ld(1)).
The assembler has several options:
-D Turn on assembler debugging (if available).
-L Force the assembler to generate entries for symbols that start
with L. By default, the assembler omits local symbols that start
with the letter L from the symbol table on output. By conven-
tion, compilers use symbols starting with L for generic local la-
bels.
-R Merge the data segment into the text segment, making it read-on-
ly.
-W Suppress warnings.
-f Suppress the `preprocessor' pass. The assembler will make an ex-
tra pass to remove comments and redundant white space from the
input unless directed otherwise with -f or #NO_APP (see below).
-g Generate debugging symbols for source language debugging of as-
sembly programs.
-k Warn about problems with calculating symbol differences.
-o output
Send the object file to the file output instead of the default
a.out.
-v Print the current version of as.
The optional input file arguments should be names of assembly language
source files. If no file arguments are provided, the assembler reads its
standard input.
The assembler writes its output as a relocatable OMAGIC object file. The
link editor ld(1) will merge relocatable object files into an absolute
binary file which can be directly executed; for more details on object
files, see a.out(5). If an output file has no relocations, it may be ex-
ecuted without linking.
The GNU assembler supports the UNIX dialect of 386/486 assembly language,
rather than the Intel dialect. Assembly directives in the UNIX dialect
have the form ``opcode source,destination'' with register names prefixed
by % signs and constants by $ signs. The hash mark # is the comment
character -- the assembler ignores all characters from a hash mark to the
end of a line.
To improve its speed when processing machine-generated code, the assem-
bler has a mode in which it does not process extra white space or com-
ments. The GNU compilers emit an initial #NO_APP comment/directive to
select the faster mode. A #APP directive at the start of a line will re-
turn the assembler to its pre-processing mode.
FILES
a.out default output file
*.o conventional suffix for object files
EXAMPLES
# copy %ecx bytes of data from (%esi) to (%edi), working forwards
cld
movl %ecx,%eax
andl $3,%eax
shrl $2,%ecx
rep; movsl
movl %eax,%ecx
rep; movsb
DIAGNOSTICS
There are any number of bogus error messages. Here are a few favorites:
%s: 2nd pass not implemented - get your code from random(3)
Expression too complex, 2 symbols forgotten: \"%s\" \"%s\"
.abort detected. Abandoning ship.
I want a comma after the n_other expression
you can't 'pop cs' on the 386.
SEE ALSO
a.out(5), cc(1), cpp(1), gdb(1), ld(1)
AUTHORS
The GNU assembler is a product of the Free Software Foundation.
BUGS
The -o and -v flags can't be bundled.
As cheerfully overwrites an input file that was accidentally given as the
output file.
As often mishandles absolute addresses. When this bug crops up, it is
possible to work around it by forcing the absolute address to be symbol-
ic, and link-editing the proper value.
As often screws up symbol differences, even when the current input file
defines both symbols. An internal hack makes it possible to work around
the problem by assembling the difference into a .long directive.
As with the -g flag often gets source line number stabs off by one when
an assembly source file has been processed by cpp(1).
The internals of as are quite wretched. Be prepared to spend more time
than you would like if you attempt to fix any of its multitudinous mis-
features.
Check out the Unix Man pages Manuals