PATCH: ld/2218: Weak undefined symbol doesn't work properly with PIE

H. J. Lu hjl@lucon.org
Mon Feb 20 11:28:00 GMT 2006


On Tue, Feb 21, 2006 at 10:35:47AM +1030, Alan Modra wrote:
> On Sun, Feb 19, 2006 at 06:10:01PM -0800, H. J. Lu wrote:
> > Do you have a patch for ia64?
> 
> Nope.  I was leaving that to you.

I don't understand why we should do the same thing over and over in
so many backends. A target hook should reduce the code duplication if
a few targets want to do it differently.

> 
> > Also how do you address
> > 
> > http://sourceware.org/bugzilla/show_bug.cgi?id=2251
> 
> Since that is a ld.so problem, I don't understand why you are asking.

ld.so has no way to if it should resolve a weak undefined symbol.
Linker has to help it out.

> 
> > My patch changes to if we don't export all symbols into the dynamic
> > symbol table, a symbol in PIE, which isn't defined in nor referenced
> > by any dynamic object, has the hidden visibility.
> 
> Why is this a good idea, and why should this change only apply to pie?
> ie. Why not do the same for non-pie executables.  Wasn't this part of
> your patch just a hack to fix up the fact that you made too many symbols
> dynamic in the first place?

There is no need for it in normal executable or shared library. Only
PIE needs a symbol dynamic even if it isn't referenced outside of the
executable.


H.J.



More information about the Binutils mailing list