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