This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

        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?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


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