This is the mail archive of the
mailing list for the GCC project.
Re: s390: got symbol+offset
- From: Andreas Schwab <schwab at suse dot de>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 12 Aug 2006 09:37:03 +0200
- Subject: Re: s390: got symbol+offset
- References: <200608120032.k7C0WURG004714@greed.delorie.com>
DJ Delorie <firstname.lastname@example.org> 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 Schwab, SuSE Labs, email@example.com
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."