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]

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'


I grabbed the binutils source from CVS yesterday (20080630). test.c is just an empty main() function. This same command links without error with my original configuration using binutils 2.17, and it also works when using the same binutils-20080630 source configured without --enable-gold.

gcc is using identical link lines in both cases. The symbol _dl_cpuclock_offset is defined in /lib/ld-linux.so.2 and referenced in libpthread. The link lines look like:
ld --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test [lots of objects & libraries]
For some reason, the original ld finds the symbol in /lib/ld-linux.so.2 while gold does not. As a workaround, it seems that I can supply /lib/ld-linux.so.2 on the command line:
gcc -o test test.c -lpthread /lib/ld-linux.so.2
and both gold and the original ld link correctly. I also tried the original linker but removed the "-dynamic-linker /lib/ld-linux.so.2" from the command line so ld-linux.so.2 wasn't mentioned anywhere and it still worked, so I guess it's finding it some other way.


I haven't tried the latest gcc to see if it inserts this library automatically, but I'll give that a try tomorrow. If there's any other information I can provide let me know.

Thanks,

Eric


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