This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: GOLD handling of weak symbols (including x86 vs. ARM)


> However, over in needs_dynamic_reloc, I see this:
>
> ? ?// A reference to an undefined symbol from an executable should be
> ? ?// statically resolved to 0, and does not need a dynamic relocation.
> ? ?// This matches gnu ld behavior.
> ? ?if (this->is_undefined() && !parameters->options().shared())
> ? ? ?return false;
>
> So I think we've already decided that we are screwed in this case.
>
> And that means that we should remove these lines from use_plt_offset:
> ? ?if (this->is_weak_undefined())
> ? ? ?return true;
> since we've decided that such symbols should be statically resolved to
> 0.
>
> That seems weird to me but perhaps it makes sense in some universe.

I think those lines from use_plt_offset predate the change in
needs_dynamic_reloc. Here are the two patches that changed
needs_dynamic_reloc:

http://sourceware.org/ml/binutils/2008-04/msg00019.html
http://sourceware.org/ml/binutils/2008-04/msg00269.html

The first thread has a good discussion of what the behavior should be.

It looks to me like I should have also changed use_plt_offset at the
time. A test case of the form "if (&foo != 0) foo()" probably would
have caught that.

-cary


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