public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* powerpc assembler: STW and .sdata variables
@ 2006-09-14  2:23 Jeff Lasslett
  2006-09-14  2:41 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Lasslett @ 2006-09-14  2:23 UTC (permalink / raw)
  To: binutils

Hello,

The Diab assembler that I am replacing with GNU as supports the following:-

     stw     r3,Trace@sdarx(r13)

All it's doing is storing the contents of r3 into the variable 'Trace' which
happens to be in the .sdata section.

Is there a GNU equivalent to the diab syntax above?

'Trace' is a variable declared in section .sdata.

'@sdarx' is described as follows in the Diab assembler manual:-


	expr@sdarx	The 16 bit offset of expr from the SDA base register
			is calculated. The produced relocation will cause the
			linker to modify the destination register field in the
			instruction.

If I understand the EABI correctly then r13 should hold the base address of
the .sdata section.

Do I have to do something like:

	lis	r10,Trace@ha
	stw	r3,Trace@l(r10)

Or is there some syntax that makes use of the fact that a register (r13) has
the .sdata address in it already?

Thanks,

Jeff



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

* Re: powerpc assembler: STW and .sdata variables
  2006-09-14  2:23 powerpc assembler: STW and .sdata variables Jeff Lasslett
@ 2006-09-14  2:41 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2006-09-14  2:41 UTC (permalink / raw)
  To: Jeff Lasslett; +Cc: binutils

On Thu, Sep 14, 2006 at 12:23:23PM +1000, Jeff Lasslett wrote:
> The Diab assembler that I am replacing with GNU as supports the following:-
> 
>     stw     r3,Trace@sdarx(r13)
> 
> All it's doing is storing the contents of r3 into the variable 'Trace' which
> happens to be in the .sdata section.
> 
> Is there a GNU equivalent to the diab syntax above?

     stw     %r3,Trace@sdarel(%r13)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

end of thread, other threads:[~2006-09-14  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-14  2:23 powerpc assembler: STW and .sdata variables Jeff Lasslett
2006-09-14  2:41 ` Alan Modra

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