This is the mail archive of the
mailing list for the binutils project.
Re: S_FORCE_RELOC intended behavior?
- From: Alan Modra <amodra at gmail dot com>
- To: Rich Felker <dalias at libc dot org>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sat, 22 Aug 2015 12:16:05 +0930
- Subject: Re: S_FORCE_RELOC intended behavior?
- Authentication-results: sourceware.org; auth=none
- References: <20150821204205 dot GA9149 at brightrain dot aerifal dot cx>
On Fri, Aug 21, 2015 at 04:42:05PM -0400, Rich Felker wrote:
> A while back I reported issue #18561 which I thought was sh-specific,
> but discussion on the bug tracker with Nick Clifton, who found a way
> to make gas behave correctly, has revealed that the issue might be
> deeper and affecting other targets too. The following commit:
> changed S_FORCE_RELOC so that, for some callers, it reports
> expressions based on weak symbol definitions as being able to be
> handled with fixups rather than requiring relocations to be emitted.
> As far as I can tell, this is always incorrect; a weak definition can
> always be replaced at link time.
> Is anyone familiar with the code affected by the above commit able to
> confirm whether my interpretation is correct and make sense of why the
> changes in that commit were made?
I commented in the bugzilla before seeing this email.
Basically, your claim that it is always incorrect to resolve an
expression involving a weak symbol, is wrong. Counter example:
.size foo, . - foo
OK, perhaps not the best example, but the point is that subtraction of
two symbols is often used in expressions involving some *local*
property of the function/object involved.
Long-standing gas behaviour is to resolve expressions involving
unadorned subtraction of defined symbols at assembly time. I don't
think that can be changed without breaking things.
Australia Development Lab, IBM