How to fix the ELF linker?

H.J. Lu
Thu Mar 16 19:36:00 GMT 1995


When you do

# gcc foo.c -lc

the ELF linker will load twice. But the dynamic linker will
only map into the address space once. The prolem comes
up if the ELF linker uses both instances of to resolve
the references. Some symbols may be referenced from the second
That causes some trouble for Linux/ELF with the latest shared ELF
C library. The old libraries work fine. I don't know how the
ELF linker determines which to use for symbols. I have
checked that you seem to be able to just use one -lfoo if libfoo
is a shared library. I am not sure what the right fix is. I can
image the followings:

1. Before loading a shared library always check if it has been
   loaded before. Or
2. Always use the same shared library for symbols.

Any ideas?


H.J. Lu
NYNEX Science and Technology, Inc.

More information about the Gas2 mailing list