Go to the first, previous, next, last section, table of contents.

Assembler options

You should use GNU as to assemble GCC output. To ensure this, GCC should be configured using the `--with-gnu-as' switch (as it is in Cygnus distributions ). Alternatively, you can invoke GCC with the -mgas option.

GNU as for MIPS architectures supports the MIPS R2000 and R3000 processors.

If you invoke as via the GNU C compiler (version 2), you can use the `-Wa' option to pass arguments through to the assembler. One common use of this option is to exploit the assembler's listing features. Assembler arguments you specify with gcc -Wa must be separated from each other (and the `-Wa') by commas. For example, the `-alh' assembler option in the following commandline:

$ mips-idt-ecoff-gcc -c -g -O -Wa,-alh,-L file.c

requests a listing with high-level language and assembly language interspersed.

The example also illustrates two other convenient options to specify for assembler listings:

  1. The compiler debugging option `-g' is essential to see interspersed high-level source statements, since without debugging information the assembler cannot tie most of the generated code to lines of the original source file.
  2. The additional assembler option `-L' preserves local labels, which may make the listing output more intelligible to humans.

These are the options to enable listing output from the assembler. By itself, `-a' requests listings of high-level language source, assembly language, and symbols.

You can use other letters to select specific options for the list: `-ah' requests a high-level language listing, `-al' requests an output-program assembly listing, and `-as' requests a symbol table listing. High-level listings require that a compiler debugging option like `-g' be used, and that assembly listings (`-al') be requested also.

You can use the `-ad' option to omit debugging directives from the listing.

When you specify one of these options, you can further control listing output and its appearance using these listing-control assembler directives:

.nolist
Turn off listings from this point on.
.list
Turn listings back on from here.
.psize linecount , columnwidth
Describe the page size for your output. (Default 60, 200.) The assembler generates form feeds after printing each group of linecount lines. To avoid these automatic form feeds, specify 0 as the linecount.
.eject
Skip to a new page (issue a form feed).
.title
Use heading as the title (second line, immediately after the source file name and pagenumber).
.sbttl
Use subheading as the subtitle (third line, immediately after the title line) when generating assembly listings.

If you do not request listing output with one of the `-a' options, these listing-control directives have no effect. You can also use the `-an' option to turn off all forms processing.

The letters after `-a' may be combined into one option, e.g., `-aln'.

GAS options for MIPS

The MIPS configurations of GNU as support three special options, and accept one other for command-line compatibility. See section `Command-Line Options' in Using the GNU Assembler as, for information on the command-line options available with all configurations of the GNU assembler.

-G num
This option sets the largest size of an object that will be referenced implicitly with the gp register. It is only accepted for targets that use ECOFF format. The default value is 8.
-EB
-EL
Any MIPS configuration of as can select big-endian or little-endian output at run time (unlike the other GNU development tools, which must be configured for one or the other). Use `-EB' to select big-endian output, and `-EL' for little-endian.
-nocpp
This option is ignored. It is accepted for command-line compatibility with other assemblers, which use it to turn off C style preprocessing. With GNU as, there is no need for `-nocpp', because the GNU assembler itself never runs the C preprocessor.

GAS directives for debugging information

MIPS ECOFF as supports several directives used for generating debugging information which are not supported by traditional MIPS assemblers. These are .def, .endef, .dim, .file, .scl, .size, .tag, .type, .val, .stabd, .stabn, and .stabs. The debugging information generated by the three .stab directives can only be read by GDB, not by traditional MIPS debuggers (this enhancement is required to fully support C++ debugging). These directives are primarily used by compilers, not assembly language programmers! See section `Assembler Directives' in Using as, for full information on all GNU as directives.


Go to the first, previous, next, last section, table of contents.