GNU Assembler Command-Line Options

Previous GNU Assembler Command Line

Here is a brief summary of how to invoke as.

-a[cdhlmns]
Turn on listings, in any of a variety of ways:

-ac
omit false conditionals

-ad
omit debugging directives

-ah
include high-level source

-al
include assembly

-am
include macro expansions

-an
omit forms processing

-as
include symbols

=file
set the name of the listing file

You may combine these options; for example, use '-aln' for assembly listing without forms processing. The '=file' option, if used, must be the last one. By itself, '-a' defaults to '-ahls'.

For more information, see Enabling Listings.

--all-relocs
Output all references to non-absolute symbols in the assembled file as relocation items in the object file, even if the form of a reference would permit the assembler to resolve it. This especially affects pc-relative references to symbols defined in the same section, and certain calculations with symbols. For some calculations, this requires special TIGCC-specific support for negative relocation items, which makes object files unusable with older versions of TIGCC. If a calculation cannot be output without being resolved, an error message is generated. This option implies '--keep-locals'. The assembler also outputs a special symbol __ld_all_relocs to tell the linker that there are no implicit dependencies between different locations inside the sections.

-D
Ignored. This option is accepted for script compatibility with calls to other assemblers.

--defsym sym=value
Define the symbol sym to be value before assembling the input file. value must be an integer constant. As in C, a leading 0x indicates a hexadecimal value, and a leading 0 indicates an octal value.

-f
"fast" - skip whitespace and comment preprocessing (assume source is compiler output).

This option should only be used when assembling programs written by a (trusted) compiler. It stops the assembler from doing whitespace and comment preprocessing on the input file(s) before assembling them. See Preprocessing.

Warning: if you use '-f' when the files actually need to be preprocessed (if they contain comments, for example), as does not work correctly.

--gdwarf2
Generate DWARF 2 debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it.

--gstabs
Generate stabs debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it.

--help
Print a summary of the command line options and exit.

--target-help
Print a summary of all target specific options and exit.

-I dir
Add directory dir to the search list for .include directives.

-J
Don't warn about signed overflow.

-K
This option is accepted but has no effect on the 680x0 family.

-L
--keep-locals
Keep (in the symbol table) local symbols. On traditional a.out systems these start with L, but different systems have different local label prefixes. See Including Local Labels.

--listing-lhs-width=number
Set the maximum width, in words, of the output data column for an assembler listing to number.

For more information, see Configuring Listing Output.

--listing-lhs-width2=number
Set the maximum width, in words, of the output data column for continuation lines in an assembler listing to number.

--listing-rhs-width=number
Set the maximum width of an input source line, as displayed in a listing, to number bytes.

--listing-cont-lines=number
Set the maximum number of lines printed in a listing for a single line of input to number+1.

-M
--mri
Use MRI compatibility mode. See Assembling in MRI Compatibility Mode.

--MD depfile
Generate a dependency file. This file consists of a single rule suitable for 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. It is not particulary useful for TIGCC.

-o objfile
Name the object-file output from as objfile. See Naming the Output File.

-R
Fold the data section into the text section. See Joining the Data and Text Sections.

--statistics
Print the maximum space (in bytes) and total time (in seconds) used by assembly.

--strip-local-absolute
Remove local absolute symbols from the outgoing symbol table.

--traditional-format
Use a more traditional output format. See Traditional Assembler Output Format.

-v
-version
Print the as version.

--version
Print the as version and exit.

-W
--no-warn
Suppress warning messages.

See Controlling Warnings for more information about warning switches.

--fatal-warnings
Treat warnings as errors.

--warn
Don't suppress warning messages or treat them as errors.

-w
Ignored.

-x
Ignored.

-Z
Generate an object file even after errors.

-- | files
Standard input, or source files to assemble.