as: MIPS Symbol Sizes
9.26.3 Directives to override the size of symbols
-------------------------------------------------
The n64 ABI allows symbols to have any 64-bit value. Although this
provides a great deal of flexibility, it means that some macros have
much longer expansions than their 32-bit counterparts. For example, the
non-PIC expansion of 'dla $4,sym' is usually:
lui $4,%highest(sym)
lui $1,%hi(sym)
daddiu $4,$4,%higher(sym)
daddiu $1,$1,%lo(sym)
dsll32 $4,$4,0
daddu $4,$4,$1
whereas the 32-bit expansion is simply:
lui $4,%hi(sym)
daddiu $4,$4,%lo(sym)
n64 code is sometimes constructed in such a way that all symbolic
constants are known to have 32-bit values, and in such cases, it's
preferable to use the 32-bit expansion instead of the 64-bit expansion.
You can use the '.set sym32' directive to tell the assembler that,
from this point on, all expressions of the form 'SYMBOL' or 'SYMBOL +
OFFSET' have 32-bit values. For example:
.set sym32
dla $4,sym
lw $4,sym+16
sw $4,sym+0x8000($4)
will cause the assembler to treat 'sym', 'sym+16' and 'sym+0x8000' as
32-bit values. The handling of non-symbolic addresses is not affected.
The directive '.set nosym32' ends a '.set sym32' block and reverts to
the normal behavior. It is also possible to change the symbol size
using the command-line options '-msym32' and '-mno-sym32'.
These options and directives are always accepted, but at present,
they have no effect for anything other than n64.