The linker broke when as-need flag is added.

 /bin/sh ../libtool --tag=CC --mode=link mipsel-linux-gcc -I../include -g
-O2 -Wl,--as-needed -o test-example test.o ../lib/libTestGcc.la
libtool: link: mipsel-linux-gcc -I../include -g -O2 -Wl,--as-needed -o
.libs/test-example test.o ../lib/.libs/libTestGcc.so -Wl,-rpath
-Wl,/usr/local/lib
../lib/.libs/libTestGcc.so:(.got+0x0): multiple definition of
`_GLOBAL_OFFSET_TABLE_'
collect2: ld returned 1 exit status
"

The version of ld which comes with this toolchain is:
GNU ld (GNU Binutils) 2.19.92.2009100

The following patch is based on Hans-Peter Nilsson's original patch.
discussion thread is:
http://sourceware.org/ml/binutils/2004-10/msg00457.html



--- a/bfd/elfxx-mips.c    2013-02-01 03:26:00.000000000 -0800
+++ b/bfd/elfxx-mips.c    2013-02-01 03:26:16.000000000 -0800
@@ -4681,6 +4681,7 @@
   h->non_elf = 0;
   h->def_regular = 1;
   h->type = STT_OBJECT;
+  h->other = STV_HIDDEN;
   elf_hash_table (info)->hgot = h;

   if (info->shared
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to