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.

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:

$ m68k-coff-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'.


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