PATCH: Fix gold problem with weak undefined symbols

Cary Coutant
Wed Apr 2 00:39:00 GMT 2008

>  > Yep, that appears to be what GNU ld does -- the test case passes for
>  > GNU ld, and I see no dynamic relocation for the weak undef symbol. It
>  > was surprising to me, too, which is why gold didn't do this
>  > originally.
>  I think I recall a conversation between Alan and H.J. a month or two
>  ago, in which this was classified as a bug.  Might want to ask them.

I think it needs to be this way. Imagine the can of worms that you'd
open up if you allow weak undefs to be dynamically bound. If the
reference is from non-PIC code, you'd need to generate a COPY
relocation without knowing anything about the definition -- and what
would the dynamic loader do with an unresolved COPY relocation?

Besides all that, I've already seen a couple of cases here that rely
on this behavior. I wouldn't be surprised to find a lot more in the

Anyone know what Sun does? (I know HP doesn't support weak undefs at all.)


More information about the Binutils mailing list