public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* As can assemble of mips gp-relative code?
@ 1999-10-20 13:56 David Foulds
  1999-10-20 14:01 ` Geoff Keating
  0 siblings, 1 reply; 2+ messages in thread
From: David Foulds @ 1999-10-20 13:56 UTC (permalink / raw)
  To: binutils

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: As can assemble of mips gp-relative code?
  1999-10-20 13:56 As can assemble of mips gp-relative code? David Foulds
@ 1999-10-20 14:01 ` Geoff Keating
  0 siblings, 0 replies; 2+ messages in thread
From: Geoff Keating @ 1999-10-20 14:01 UTC (permalink / raw)
  To: dfoulds; +Cc: binutils

> Date: Wed, 20 Oct 1999 13:55:39 -0700
> From: David Foulds <dfoulds@cosinecom.com>

> 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)
...

You want

    sw  a0,cpu_type

instead.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-10-20 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-20 13:56 As can assemble of mips gp-relative code? David Foulds
1999-10-20 14:01 ` Geoff Keating

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).