This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

As can assemble of mips gp-relative code?


I'm trying to port to gas some mips assembly code
which looks like this

sw a0, %sdaoff(cpu_type)($gp)

I decided the equivalent in gas syntax
was

sw a0, cpu_type(gp)

(cpu_type is an integer that is allocated to the .sbss
section by ld).

However, the relocatable code that is emitted by gas (10/20
snapshot) is

addu at,gp,gp
sw a0,0(at)

with cpu_type R_MIPS_GPREL16.

The linker does correctly calculate the offset
of cpu_type from _gp but the value in at is not _gp!

Also, two instructions are used here when one would
do, and at is stepped on.

Any comments?  How can I get gas to do what I want,
which is to emit

sw a0,0(gp) with cpu_type R_MIPS_GPREL16?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]