This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gold not finding symbols in ld-linux.so.2


Cary Coutant wrote:
Gold deliberately avoids doing this; it searches only the libraries
that are named explicitly on the link line.
Thanks for the explanation.
My guess
is that this reference is coming from a static archive portion of
libpthread (/usr/lib/libpthread_nonshared.a) -- is your
/usr/lib/libpthread.so just a text file that contains something like
the following?

GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )
As far as I can tell, libpthread is just a plain shared library. "ld -verbose" reports finding /usr/lib/libpthread.so, which is a symlink to /lib/libpthread.so.0 which itself is a symlink to /lib/libpthread-0.9.so, which is a ELF 32-bit LSB shared object. If I trace the DT_NEEDED attributes, they are exactly as you said:

$ readelf -d /lib/libpthread-0.9.so | grep NEEDED
0x00000001 (NEEDED)                     Shared library: [libc.so.6]
$ readelf -d /lib/libc.so.6 | grep NEEDED
0x00000001 (NEEDED)                     Shared library: [ld-linux.so.2]

I don't see _dl_cpuclock_offset in either libpthread or ld-linux.so on
my system, so I can't check this out.
$ readelf -sW /lib/libpthread-0.9.so | grep _dl_cpuclock_offset
131: 00000000 0 NOTYPE GLOBAL DEFAULT UND _dl_cpuclock_offset
$ readelf -sW /lib/ld-linux.so.2 | grep _dl_cpuclock_offset
57: 000162f0 8 OBJECT GLOBAL DEFAULT 11 _dl_cpuclock_offset@@GLIBC_2.2.3
335: 000162f0 8 OBJECT GLOBAL DEFAULT 11 _dl_cpuclock_offset


This symbol is also undefined in librt.so.1.
We've seen a similar problem with a reference from libpthread.so to
ld-linux.so before, but haven't figured out what the best approach is
yet.
Good to hear I'm not the only one. Is there a recommended workaround? I haven't worked with linker scripts before... Is this as simple as creating a text file containing "GROUP ( /lib/libpthread-0.9.so /lib/ld-linux.so.2 )" and placing it somewhere before all of the real pthread libraries in my link path?

Eric


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