This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch s390] Allow ofsetted GOT references
- From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: DJ Delorie <dj at redhat dot com>, gcc-patches at gcc dot gnu dot org, jtison at us dot ibm dot com
- Date: Mon, 16 Oct 2006 19:53:52 +0200
- Subject: Re: [patch s390] Allow ofsetted GOT references
- References: <200610091312.k99DCHvM029340@d12av02.megacenter.de.ibm.com>
- Reply-to: schwidefsky at de dot ibm dot com
On Mon, 2006-10-09 at 15:12 +0200, Ulrich Weigand wrote:
> In principle, the change should be OK, however I seem to recall that
> there was a reason for not allowing offset for GOT relocations; maybe
> some old version of binutils or modutils didn't handle those correctly ...
>
>
> Martin, what DJ wants to do here is to get GCC to generate code like
>
> l %r2,test@GOT+4(%r12)
>
> to address the low half of a GOT slot on 64-bit, which would get
> translated into a relocation like
>
> 10: 58 20 c0 00 l %r2,0(%r12)
> 12: R_390_GOT12 test+0x4
>
> I seem to recall some versions of the toolchain treating this as
> reference to a GOT slot holding the address of test+4, instead of
> a reference to 4 bytes into the GOT slot holding the address of
> test. Do you remember any details about this?
The "+4" part of the relocation is added to the offset that is part of
the instruction. test@GOT+4 evaluates to the offset of "test" in the
global offset table plus 4. The got offset is changed, not the value
stored in the got.
--
blue skies,
Martin.
Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH
"Reality continues to ruin my life." - Calvin.