AS(1)AS(1)


NAME
     as - SGI MIPSpro assembler

SYNOPSIS
     as [-64] [-cpp] [-Dname=[def]] [-E] [-Gnum] [-g[setting]] [-help] [-I]
     [-keep] [-n32] [-nocpp] [-non_shared] [-o32] [-Olevel] [-o output]
     [-P] [-show] [-Uname] [-woff all] file ...

DESCRIPTION
     The MIPSpro assembler, as, compiles a symbolic assembly language
     source program and produces an object file in elf format.  The
     assembler supports three different Application Binary Interfaces
     controlled by the following options:  -o32, -n32, and -64 (see the
     abi(5) man page).  The assembler never runs the loader.

     as defines the following preprocessor symbols:

          _LANGUAGE_ASSEMBLY       __sgi, __mips,

          __host_mips              __unix, _MIPSEB,

          _SYSTYPE_SVR4            _SVR4_SOURCE

          _SGI_SOURCE,             _MIPS_ISA

          _MIPS_SIM                _MIPS_FPSET,

          _MIPS_SZINT              _MIPS_SZLONG

          _MIPS_SZPTR

     These are displayed by specifying the -show option on the compiler
     command line.

     See the ld(1) man page for load-time options.

ISA/ABI COMMAND LINE OPTIONS
     The following options control the choice of ABI and Instruction Set
     Architecture (ISA).

     -o32 or -32    Generate a 32-bit object.  This defaults to -mips2 if
                    -mips1 is not specified.  This is the default when
                    compiling on any non-R8000 based system, if no default
                    specification file is present.  See the o32(5) man page
                    for details.

     -64            Generate a 64-bit object.  This defaults to -mips4 if
                    -mips3 is not specified.  This is the default when
                    compiling on any R8000 based system, if no default
                    specification file is present.  See the Defaults
                    Specification Files subsection at the end of this man
                    page for details.

     -n32           Generate an n32 object.  This defaults to -mips3 if
                    -mips4 is not specified.

     -mipsn         Determine architecture type. n can be one of the
                    following values:

                    1    Generate code using the instruction set of the
                         R2000/R3000 RISC architecture, and search for
                         mips1 libraries/objects at link time.  This
                         defaults to -o32.

                    2    Generate code using the MIPS II instruction set
                         (MIPS I + R4000 specific extensions), and search
                         for mips2 libraries/objects at link time.  This
                         defaults to -o32.

                    3    Generate code using the full MIPS III (e.g. R4000)
                         instruction set, and search for mips3
                         libraries/objects at link time.  This defaults to
                         -n32 if -64 has not been specified.  On R8000-
                         based systems this defaults to -64.

                    4    Generate code using the full MIPS IV instruction
                         set which is supported on R10000, R5000 and R8000
                         systems.  Also search for mips4 libraries/objects
                         at link time.  This is the default on R8000
                         systems.  This defaults to -n32 if -64 is not
                         specified.  On R8000-based systems it defaults to
                         -64.

OPTION DESCRIPTIONS
     The following options are valid with this command:

     -cpp           Run the C macro preprocessor on assembly source files
                    before compiling.  This is the default.

     -Dname=[def] or -Dname
                    Define the name to the C macro preprocessor, as if by
                    #define.  If no definition is given, the name is
                    defined as 1.

     -E             Run only the C macro preprocessor on the specified
                    assembly source files, and send the result to standard
                    output.

     -Gnum          Specify the maximum size, in bytes, of a data item that
                    is to be accessed from the global pointer.  num must be
                    a decimal number.

                    If num is zero, no data is accessed from the global
                    pointer.  For -64 and -n32, the default value for num
                    is 8 bytes.  For -o32 the default value for num is 0.

     -g[setting]    Produce symbol table information.  If setting is 0, the
                    assembler does not produce symbol table information for
                    symbolic debugging.  If no value is given for setting,
                    the assembler produces additional symbol table
                    information for full symbolic debugging.  This is the
                    default.

     -help          List all the available options.  This does not run the
                    assembler.  n32 or 64 only.

     -I[dir]        Determine searching options for include files.  Using
                    -I without an argument disables searching for #include
                    files in the standard directory ( /usr/include ).

                    Using -I dir allows you to specify a directory for
                    searching.

                    #include files whose names do not begin with / are
                    always sought first in the directory of the file
                    argument, then in directories specified in -I options,
                    and finally in the standard directory (/usr/include).

     -keep          Build intermediate compilation files named after the
                    corresponding source files, with the suffix replaced by
                    one that is appropriate for the type of intermediate
                    file (for example, .i indicates preprocessed source).
                    These intermediate files are never removed.

     -nocpp         Do not run the C macro preprocessor on assembly source
                    before compiling.

     -non_shared    Do not generate position-independent code (PIC).

     -Olevel        Sets the optimization level.  level can be one of the
                    following values:

                    0    Turn off all optimizations.  This is the default
                         for -64 and -n32.

                    1    Turn on all optimizations that can be done easily.
                         This is the default for -o32.

                    2    Turn on all optimizations.  For -64 or -n32, this
                         means scheduling the code; for -o32, this means
                         more aggressive optimizations.

                    Specifying -O with no options is equivalent to
                    specifying -O2.

     -o output      Name the final output file output.  If this option is
                    not specified, the output file is the input file name
                    with a .o suffix rather than the .s suffix.

     -P             Run only the C macro preprocessor and put the result
                    for each .s file in a corresponding .i file.  The .i
                    file has no # lines in it.

     -show          Print the passes as they execute with their arguments
                    and their input and output files.

     -Uname         Remove any initial definition of name.

     -woff all      Suppress all warning messages.  n32 or 64 only.

COMPILER DEVELOPMENT OPTIONS
     The following options aid compiler development and are not generally
     used:

     -fullasopt     o32 only.  Enable all the global optimizations done by
                    the assembler. The assembler can perform several global
                    optimizations that are enabled automatically for high
                    level languages like C, Pascal and Fortran. These
                    optimizations are turned off by default while compiling
                    an assembly language source file. This is done because
                    the optimizations rely on the procedure calling
                    convention to be strictly followed. Several assembly
                    language programs violate these restrictions. The
                    -fullasopt option allows enabling of these
                    optimizations for .s files.

     -Hc            o32 only. Halt compiling after the pass specified by
                    the character c, producing an intermediate file for the
                    next pass. c can have the value [ a ]. It selects the
                    assembler pass in the same way as the -t option.  If
                    this option is used, the symbol table file produced and
                    used by the passes is the last component of the source
                    file with the suffix changed to .T and is not removed.
                    This switch is non-standard and may not be supported
                    across product lines.

     -KPIC          Activates the assembler directives for generating
                    position-independent code (PIC).  For programs
                    assembled with the -n32 and -64 options, see The
                    MIPSpro 64-Bit Porting and Transition Guide for more
                    information.  For codes compiled with the -o32 option,
                    see the MIPSpro Assembly Language Programmer's Guide.

     -Wc,arg1[,arg2...]
                    n32 or 64 only. Pass the arg1 value(s) to the assembler
                    pass designated by c. c can have a value of p, a, or b
                    (see the information in the -t option in "Naming
                    Options", below).

                    Several options affect the various optimizations done
                    by the assembler. Some of these assembler optimizations
                    are new and may have problems during compilation:

                    -Wb,-noxbb
                         Turn off cross basic block instruction scheduling.

                    -Wb,-nopeep
                         Turn off peephole optimizations.

                    -Wb,-noswpipe
                         Turn off software pipelining.

                    -Wb,-nosymregs
                         Turn off symbolic register renaming.

                    These global optimizations are enabled only when
                    optimization level -O2 or higher is selected for high
                    level languages or the -fullasopt option is used for
                    assembly language files.

                    If the TMPDIR environment variable is set, the value is
                    used as the directory to place any temporary files
                    rather than the default directory, /tmp.

     -Ya,directory  n32 or 64 only. Use the asm pass from the given
                    directory.

   Naming Options
     The -t[char], -hpath, and -Bstring options select a name to use for a
     particular pass.  These arguments are processed from left to right so
     their order is significant.

     When the -B option is encountered, the selection of names takes place
     using the last -h and -t options.

     These three options must be used together.

     -t[char]       Select the names.  The names selected are those
                    designated by a combination of chars.  char can be any
                    of the following:

                    Name           char values

                    include        h

                    cpp            p

                    as0            a

                    as1            b

                    If h is in the -t argument, a directory is added to the
                    list of directories to be used in searching for
                    #include files.  This directory name has the form
                    /usr/include/string.  This directory contains the
                    include files for the string release of the compiler.
                    The standard directory is still searched.

     -hpath         Use path rather than the directory where the name is
                    normally found.  This switch is non-standard and may
                    not be supported across product lines.

     -Bstring       Append string to all names specified by the -t option.
                    If no -t option has been processed before the -B, the
                    -t option is assumed to be hpab.  This list designates
                    all names.

NOTES
     The SGI_ABI environment variable can change the default ABI behavior
     to be -o32, -n32, or -64; see getabi(3c) for details.  Also, the
     /etc/compiler.defaults file can be used to change default behavior.
     See the cc(1) man page for more information.

     The COMP_TARGET_ROOT, TOOLROOT, RLS_ID_OBJECT environment variables
     are used by as while compiling the compiler itself.  Their meaning is
     left undefined intentionally.  They should not be set in your
     environment.

FILES
     * All ABIs:

       file.o                        object file output

       /usr/include                  standard #include file directory

     * The following files are for -o32 only:

       /tmp/ctm*                     temporary files

       /usr/lib/cpp                  C macro preprocessor

       /usr/lib/as0                  symbolic assembly language translator

       /usr/lib/as1                  binary assembler and reorganizer

     * The following files are for -n32 and -64 only:

       /tmp/cmplr*                   temporary files

       /usr/lib32/cmplrs/cpp         C macro preprocessor

       /usr/lib32/cmplrs/asm         symbolic assembler

BUGS
     The assembler attempts to continue after finding semantic errors.
     This may result in internal errors.

SEE ALSO
     cc(1), what(1)

     getabi(3c)

     MIPSpro Assembly Language Programmer's Guide

     MIPSpro N32 ABI Handbook

     MIPSpro 64-bit Porting and Transition Guide