How to fix the ELF linker?

H.J. Lu hjl@nynexst.com
Thu Mar 16 19:36:00 GMT 1995


Hi,

When you do

# gcc foo.c -lc

the ELF linker will load libc.so twice. But the dynamic linker will
only map libc.so into the address space once. The prolem comes
up if the ELF linker uses both instances of libc.so to resolve
the references. Some symbols may be referenced from the second libc.so.
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 libc.so 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?

Thanks.


-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com




More information about the Gas2 mailing list