On Tue, Mar 29, 2011 at 6:03 AM, Lassi Tuura <[email protected]> wrote: > I have some reports of crashes on RHEL6 + GCC 4.6 + gold linker. LTO > may be involved, I am not sure.
make in libunwind fails when using gold: /bin/sh ../libtool --tag=CC --mode=link gcc -U_FORTIFY_SOURCE -g -O2 -fexceptions -Wall -Wsign-compare -o Gperf-simple Gperf-simple.o ../src/libunwind-x86_64.la libtool: link: gcc -U_FORTIFY_SOURCE -g -O2 -fexceptions -Wall -Wsign-compare -o .libs/Gperf-simple Gperf-simple.o ../src/.libs/libunwind-x86_64.so /home/ppluzhnikov/binutils/build/gold/ld: Gperf-simple.o: in function measure_init:../../tests/Gperf-simple.c:179: error: undefined reference to '_Ux86_64_getcontext' /home/ppluzhnikov/binutils/build/gold/ld: Gperf-simple.o: in function measure_init:../../tests/Gperf-simple.c:206: error: undefined reference to '_Ux86_64_getcontext' /home/ppluzhnikov/binutils/build/gold/ld: Gperf-simple.o: in function measure_unwind:../../tests/Gperf-simple.c:64: error: undefined reference to '_Ux86_64_getcontext' collect2: ld returned 1 exit status make: *** [Gperf-simple] Error 1 AFAICT, this is happening because gold does not search DT_NEEDED of libunwind-x86_64.so, and thus libunwind.so doesn't enter into the link. >From what I understand, searching for DT_NEEDED at static link time is emulating ld-linux inside gold -- system dependent, error prone and shouldn't really be necessary. The same error also happens with GNU-ld when I add -Wl,--no-copy-dt-needed-entries (which, I've been told, some distributions turn on in the gcc driver by default). Attached patch fixes both of these problems. Thanks, -- Paul Pluzhnikov diff --git a/tests/Makefile.am b/tests/Makefile.am index 5d3ecc5..73cae4e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -105,7 +105,8 @@ Ltest_nomalloc_SOURCES = Ltest-nomalloc.c Gtest_trace_SOURCES = Gtest-trace.c ident.c Ltest_trace_SOURCES = Ltest-trace.c ident.c -LIBUNWIND = $(top_builddir)/src/libunwind-$(arch).la +LIBUNWIND = $(top_builddir)/src/libunwind-$(arch).la \ + $(top_builddir)/src/libunwind.la LIBUNWIND_ptrace = $(top_builddir)/src/libunwind-ptrace.a if USE_ELF32 _______________________________________________ Libunwind-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/libunwind-devel
