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


> I'm trying to get gold working on my aging RedHat 7.2 (i686-pc-linux-gnu)
> system using gcc-4.0.3 and I ran into a problem.  Whenever I link against
> libpthread, I get a linking error:
>   gcc -o test test.c -lpthread
>   ld: /usr/lib/libpthread.so: undefined reference to '_dl_cpuclock_offset'

Gnu ld finds the symbol because it follows DT_NEEDED entries and
emulates the dynamic loaders symbol binding process. Because
libpthread.so has a DT_NEEDED pointing to libc.so.6, and libc has a
DT_NEEDED pointing to ld-linux.so.2, gnu ld is able to find the
definition.

Gold deliberately avoids doing this; it searches only the libraries
that are named explicitly on the link line. Normally, gold won't
complain about an unresolved symbol unless it's actually referenced
from a relocatable input object, so if you name all the libraries that
your code directly references, it should link successfully. 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 )

I don't see _dl_cpuclock_offset in either libpthread or ld-linux.so on
my system, so I can't check this out.

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.

-cary


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