PATCH: undefined symbols in shared libraries

Alan Modra amodra@bigpond.net.au
Fri Mar 12 06:42:00 GMT 2004


On Thu, Mar 11, 2004 at 09:34:19PM -0800, H. J. Lu wrote:
> unresolved_syms_in_shared_libs is for unresolved references in input
> shared libraries. unresolved_syms_in_objects is for unresolved
> references in input relocatable objects. When building shared libraries,
> we allow unresolved references in input relocatable objects by default.
> They are disallowed for executables. With "-z defs", we also disallow
> unresolved references in input relocatable objects when building
> shared library.

I agree with all of this.  It's exactly what I think ld should be doing
instead of the current code.

What we currently have is messy code in lexsup.c that sets _both_
unresolved_syms_in_shared_libs and unresolved_syms_in_objects, and then
code in elf-bfd.h and elsewhere that tests one or other of the flags
depending on info->shared or info->executable.  That's what I think is
confusing.  The unresolved_syms_in_* are all about input files, not
the particular output ld is producing, so there should be no need to
test output related flags like info->shared.  Instead, use
unresolved_syms_in_* along with information about what sort of input
was unresolved.  That's where I was heading with the untested patch
I wrote.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list