This is the mail archive of the
mailing list for the GCC project.
Re: [patch s390] Allow ofsetted GOT references
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: dj at redhat dot com (DJ Delorie), schwidefsky at de dot ibm dot com
- Cc: gcc-patches at gcc dot gnu dot org, jtison at us dot ibm dot com
- Date: Mon, 9 Oct 2006 15:12:17 +0200 (CEST)
- Subject: Re: [patch s390] Allow ofsetted GOT references
DJ Delorie wrote:
> This change allows you to, for example, reference the lower subreg of
> an address in the GOT (i.e. the lower 32 bits when in 64 bit mode).
> This fixes an ICE in the compiler when assigning __builtin_strlen() to
> a 32 bit int, and comparing it to zero. The optimizer just compares
> the lower 32 bits of the start/end addresses. Ok to apply?
Sorry for the late reply, I must have missed that email ...
In any case, I'm wondering why you would get an ICE just because
those SUBREGs aren't supported -- shouldn't the compiler fix this
up by itself? I cannot reproduce the problem with a trivial test
case based on your description above, do you have an example?
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
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?
Dr. Ulrich Weigand
Linux on zSeries Development