This is the mail archive of the gcc@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: s390: got symbol+offset


DJ Delorie <dj@redhat.com> writes:

> If I comment out the "&& offset == 0" line, gcc produces assembly like this:
>
>         l       %r2,var@GOT+4(%r12)
>
> The assembler and linker don't seem to have a problem with that
> construct.  Are we deliberately avoiding it for some obscure reason,
> or is this just a bug that's never been tripped over before?

The GOT is an array of addresses, and var@GOT addresses one of these
addresses.  Thus var@GOT+4 points to the address of a different and
unrelated variable, assuming it is still within the range of the GOT.

> If it's a bug, is there some test for a "reasonable" offset that we
> can add, that makes sense?

Since a GOT address is a pointer to an address it does not make sense to
add any offset to it.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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