Go to the previous, next section.
GNU as
for MIPS architectures supports the MIPS
R2000, R3000, R4000 and R6000 processors. For information
about the MIPS instruction set, see MIPS RISC Architecture, by Kane
and Heindrich (Prentice-Hall). For an overview of MIPS assembly
conventions, see "Appendix D: Assembly Language Programming" in the same
work.
The MIPS configurations of GNU as
support these
special options:
-G num
gp
register. It is only accepted for targets
that use ECOFF format. The default value is 8.
-EB
-EL
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.
-mips1
-mips2
-mips3
-m4650
-no-m4650
-m4010
-no-m4010
-mcpu=CPU
gcc
.
-nocpp
as
, there is no need for `-nocpp', because the
GNU assembler itself never runs the C preprocessor.
--trap
--no-break
as
automatically macro expands certain division and
multiplication instructions to check for overflow and division by zero. This
option causes as
to generate code to take a trap exception
rather than a break exception when an error is detected. The trap instructions
are only supported at Instruction Set Architecture level 2 and higher.
--break
--no-trap
Assembling for a MIPS ECOFF target supports some additional sections
besides the usual .text
, .data
and .bss
. The
additional sections are .rdata
, used for read-only data,
.sdata
, used for small data, and .sbss
, used for small
common objects.
When assembling for ECOFF, the assembler uses the $gp
($28
)
register to form the address of a "small object". Any object in the
.sdata
or .sbss
sections is considered "small" in this sense.
For external objects, or for objects in the .bss
section, you can use
the gcc
`-G' option to control the size of objects addressed via
$gp
; the default value is 8, meaning that a reference to any object
eight bytes or smaller uses $gp
. Passing `-G 0' to
as
prevents it from using the $gp
register on the basis
of object size (but the assembler uses $gp
for objects in .sdata
or sbss
in any case). The size of an object in the .bss
section
is set by the .comm
or .lcomm
directive that defines it. The
size of an external object may be set with the .extern
directive. For
example, `.extern sym,4' declares that the object at sym
is 4 bytes
in length, whie leaving sym
otherwise undefined.
Using small ECOFF objects requires linker support, and assumes that the
$gp
register is correctly initialized (normally done automatically by
the startup code). MIPS ECOFF assembly code must not modify the
$gp
register.
MIPS ECOFF as
supports several directives used for
generating debugging information which are not support 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!
GNU as
supports an additional directive to change the
MIPS Instruction Set Architecture level on the fly: .set
mipsn
. n should be a number from 0 to 3. A value from 1 to 3
makes the assembler accept instructions for the corresponding ISA level,
from that point on in the assembly. .set mipsn
affects not only
which instructions are permitted, but also how certain macros are expanded.
.set mips0
restores the ISA level to its original level: either the
level you selected with command line options, or the default for your
configuration. You can use this feature to permit specific R4000
instructions while assembling in 32 bit mode. Use this directive with care!
Traditional MIPS assemblers do not support this directive.
@raisesections
Go to the previous, next section.