This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Relative expressions and ASSERT
- From: Alan Modra <amodra at gmail dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Daniel Jacobowitz <dan at codesourcery dot com>, binutils at sourceware dot org, Kazu Hirata <kazu at codesourcery dot com>
- Date: Wed, 19 Jan 2011 18:55:06 +1030
- Subject: Re: Relative expressions and ASSERT
- References: <20101216110243.GD15607@bubble.grove.modra.org> <20101216154855.GT7961@caradoc.them.org> <AANLkTin_6FXTQwGjbbgk9CSc_ceahsYQyS5zVcX11ySJ@mail.gmail.com> <20101216225820.GE15607@bubble.grove.modra.org> <AANLkTikYeeUOs41zH2K7Ef8VzXwXan11OLhn+m7iBk=G@mail.gmail.com> <20101217000136.GF15607@bubble.grove.modra.org> <AANLkTi=5BPNSOw+SFR0baqYq-peS47whyc0P9dhyprMh@mail.gmail.com> <AANLkTi=XGnHQ7Gn_oi+1PwBn34gvFEgr_W11b3Cg=hWh@mail.gmail.com> <20101220125909.GL15607@bubble.grove.modra.org> <alpine.DEB.1.10.1101190615310.5891@tp.orcam.me.uk>
On Wed, Jan 19, 2011 at 06:48:51AM +0000, Maciej W. Rozycki wrote:
> Is that intended behaviour? From your update to the manual I infer
> otherwise and it looks to me like a mishandled case that slipped through,
> but perhaps I'm missing something. Either way I find it plain wrong that
> a difference of two symbols (both coming from/relative to the same
> section) yields a plain number in GAS, but not in an LD script. Hmm...
ld actually does follow the current ld.texinfo description. The two
symbols are in the same section, so the operation (subtraction in this
case) is performed on their offsets, yielding a result in the same
section.
Admittedly, this does lead to an odd result. Should we special case
subtraction? Exclusive or too?
--
Alan Modra
Australia Development Lab, IBM