|
|
Line 1: |
Line 1: |
| == Concrete Example Of DSO Linking Change in ld ==
| |
|
| |
| I checked out a 'devel' version of Systemtap from :
| |
|
| |
| <code>:pserver:anonymous@cvs.fedproject.org:/cvs/pkgs</code>
| |
|
| |
| and ran 'make srpm' to produce a source rpm in order to do a mock build. I ran this build with the new binutils rpm (http://roland.fedorapeople.org/ld-test/) so that it would have the version of ld with the proposed changes. After running the build the following error appeared in the log file :
| |
|
| |
| RPM build errors:
| |
| '''/usr/bin/ld.bfd: stap.13165.test: undefined reference to symbol 'pthread_cancel@@GLIBC_2.0''''
| |
| '''/usr/bin/ld.bfd: note: 'pthread_cancel@@GLIBC_2.0' is defined in DSO /lib/libpthread.so.0 so try adding it to the linker command line'''
| |
| '''/lib/libpthread.so.0: could not read symbols: Invalid operation'''
| |
| *** /usr/bin/ld: ld behavior mismatch! ***
| |
| *** /usr/bin/ld.bfd succeeeded ***
| |
| *** /usr/bin/ld.bfd --no-add-needed exits 1 ***
| |
| *** arguments: --eh-frame-hdr --build-id -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o stap
| |
| /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../Scrt1.o /usr/lib/gcc/i686- redhat-linux/4.4.2/../../../crti.o /usr/lib/gcc/i686-redhat-linux/4.4.2/crtbeginS.o
| |
| -L/usr/lib/gcc/i686-redhat-linux/4.4.2 -L/usr/lib/gcc/i686-redhat-linux/4.4.2 -L/usr/lib/gcc/i686-redhat- linux/4.4.2/../../.. -z relro -z now stap-main.o
| |
| stap-parse.o stap-staptree.o stap-elaborate.o stap-translate.o stap-tapsets.o stap-buildrun.o stap-loc2c.o stap-hash.o stap-mdfour.o stap-cache.o stap-util.o
| |
| stap-coveragedb.o stap-dwarf_wrappers.o stap-tapset-been.o stap-tapset-procfs.o stap-tapset-timers.o stap-tapset-perfmon.o stap-tapset-mark.o stap-tapset-itrace.o
| |
| stap-tapset-utrace.o stap-task_finder.o stap-dwflpp.o stap-rpm_finder.o --start-group -ldw -lebl --end-group -lelf -lsqlite3 -lrpm -ldl -lstdc++ -lm -lgcc_s -lgcc
| |
| -lc -lgcc_s -lgcc /usr/lib /gcc/i686-redhat-linux/4.4.2/crtendS.o /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crtn.o
| |
| collect2: ld returned 1 exit status
| |
| make[2]: *** [stap] Error 1
| |
| make[1]: *** [all-recursive] Error 1
| |
| make: *** [all] Error 2
| |
|
| |
| So this would seem to indicate that the version of Systemtap used was using /lib/libpthread.so.0 without explicitly linking to it. The solution would be to simply ensure that any binaries that use lpthread.so, has a -lpthread added when linking is happening.
| |
|
| |
|
| |
| == Simpler Concrete Example Of DSO Linking Change in ld == | | == Simpler Concrete Example Of DSO Linking Change in ld == |
|
| |
|
Revision as of 02:05, 16 August 2011
Simpler Concrete Example Of DSO Linking Change in ld
I checked out a 'devel' version of deltarpm from :
:pserver:anonymous@cvs.fedproject.org:/cvs/pkgs
and ran 'make srpm' to produce a source rpm in order to do a mock build. I ran this build with the new binutils rpm (http://roland.fedorapeople.org/ld-test/) so that it would have the version of ld with the proposed changes. After running the build the following error appeared in the log file :
RPM build errors:
/usr/bin/ld.bfd: rpmdumpheader.o: undefined reference to symbol 'Fopen'
/usr/bin/ld.bfd: note: 'Fopen' is defined in DSO /usr/lib/librpmio.so.0 so try adding it to the linker command line
/usr/lib/librpmio.so.0: could not read symbols: Invalid operation
*** /usr/bin/ld: ld behavior mismatch! ***
*** /usr/bin/ld.bfd succeeeded ***
*** /usr/bin/ld.bfd --no-add-needed exits 1 ***
*** arguments: --eh-frame-hdr --build-id -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -o rpmdumpheader
/usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crt1.o /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crti.o /usr/lib/gcc/i686-redhat-linux/4.4.2/crtbegin.o
-L/usr/lib/gcc/i686-redhat-linux/4.4.2 -L/usr/lib/gcc/i686-redhat-linux/4.4.2 -L/usr/lib/gcc/i686-redhat-linux/4.4.2/../../.. rpmdumpheader.o -lrpm -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-redhat-linux/4.4.2/crtend.o
/usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crtn.o
collect2: ld returned 1 exit status
make: *** [rpmdumpheader] Error 1
So this would seem to indicate that the version of deltarpm used was using /usr/lib/librpmio.so.0 without explicitly linking to it. The solution would be to simply ensure that any binaries that use librpmio.so, have a -lrpmio added when linking is happening.
Making the following change to the Makefile fixes this problem :
rpmdumpheader: rpmdumpheader.o
- $(CC) $(LDFLAGS) $^ -lrpm -o $@
+ $(CC) $(LDFLAGS) $^ -lrpm -lrpmio -o $@