This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to fix the ELF linker?


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