public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests
@ 2013-05-29 23:50 Gregory Fong
  2013-05-30 17:08 ` Richard Sandiford
  2013-09-24 22:16 ` Richard Sandiford
  0 siblings, 2 replies; 5+ messages in thread
From: Gregory Fong @ 2013-05-29 23:50 UTC (permalink / raw)
  To: binutils; +Cc: Richard Sandiford

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

Hello,

Attached are two patches regarding a bug with --as-needed on mips that
causes the following error when using --as-needed (example for a small
test program):

/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 first patch fixes the bug by hiding _GLOBAL_OFFSET_TABLE_ in
elfxx-mips.c .  I know there was some concern that
_GLOBAL_OFFSET_TABLE_ possibly needs to be dynamic on some mips setups
(Eric mentioned SGI).  It doesn't seem to be an issue on my setup but
I thought I'd mention it here in case that comes up for someone.

The second patch updates the ld mips elf tests to account for
the change to _GLOBAL_OFFSET_TABLE_.  I ran them using `make
check' from an x86_64-linux host with target mipsel-linux-uclibc.

Follows up on the thread started by Vincent Wen (Re: binutils 2.19.92
linker broke with --as-needed flag).  For reference, see:

original email:
https://lists.gnu.org/archive/html/bug-binutils/2013-02/msg00016.html
discussion: http://sourceware.org/ml/binutils/2013-03/msg00289.html
discussion: http://sourceware.org/ml/binutils/2013-04/msg00004.html

Based off of Hans-Peter Nilsson's Nov 2004 change to hide
_GLOBAL_OFFSET_TABLE_ (see
http://sourceware.org/ml/binutils-cvs/2004-11/msg00003.html).


This is my first patch submission here, so I'm sure I got a few things
wrong.  Any feedback is greatly appreciated! =)

Best regards,

--
 Gregory Fong

[-- Attachment #2: binutils-2.23.2-bfd-elfxx-mips.patch --]
[-- Type: application/octet-stream, Size: 476 bytes --]

diff -uNr binutils-2.23.2/bfd/elfxx-mips.c binutils-2.23.2-fixed-mips-as-needed/bfd/elfxx-mips.c
--- binutils-2.23.2/bfd/elfxx-mips.c	2013-03-25 01:06:20.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/bfd/elfxx-mips.c	2013-05-29 15:35:23.759450100 -0700
@@ -4906,6 +4906,7 @@
   h->non_elf = 0;
   h->def_regular = 1;
   h->type = STT_OBJECT;
+  h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
   elf_hash_table (info)->hgot = h;
 
   if (info->shared

[-- Attachment #3: binutils-2.23.2-ld-mips-elf_testsuite_updates.patch --]
[-- Type: application/octet-stream, Size: 32221 bytes --]

diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/eh-frame5.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/eh-frame5.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/eh-frame5.d	2012-09-04 07:18:39.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/eh-frame5.d	2013-05-29 15:35:40.311363070 -0700
@@ -1,5 +1,5 @@
 
-Relocation section '.rel.dyn' at offset 0x101dc contains 8 entries:
+Relocation section '.rel.dyn' at offset 0x101b4 contains 8 entries:
  Offset     Info    Type            Sym.Value  Sym. Name
 00000000  .* R_MIPS_NONE *
 #
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/jalx-2.dd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/jalx-2.dd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/jalx-2.dd	2011-07-24 07:20:13.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/jalx-2.dd	2013-05-29 15:35:40.311363070 -0700
@@ -28,7 +28,7 @@
  4400034:	f89e 0020 	sw	a0,32\(s8\)
  4400038:	f8be 0024 	sw	a1,36\(s8\)
  440003c:	41a2 0440 	lui	v0,0x440
- 4400040:	3082 02a0 	addiu	a0,v0,672
+ 4400040:	3082 0270 	addiu	a0,v0,624
  4400044:	f110 0028 	jalx	44000a0 <_PROCEDURE_LINKAGE_TABLE_\+0x20>
  4400048:	0000 0000 	nop
  440004c:	f620 0010 	jal	4400020 <internal_function>
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/mips16-pic-2.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/mips16-pic-2.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/mips16-pic-2.ad	2012-09-04 07:18:44.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/mips16-pic-2.ad	2013-05-29 15:35:40.311363070 -0700
@@ -1,6 +1,6 @@
 # [MIPS_GOTSYM, MIPS_SYMTABNO) covers used4...used7.
 #...
- .* \(MIPS_SYMTABNO\) * 9
+ .* \(MIPS_SYMTABNO\) * 8
 #...
- .* \(MIPS_GOTSYM\) * 0x5
+ .* \(MIPS_GOTSYM\) * 0x4
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/mips16-pic-2.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/mips16-pic-2.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/mips16-pic-2.nd	2012-09-04 07:18:44.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/mips16-pic-2.nd	2013-05-29 15:35:40.311363070 -0700
@@ -1,10 +1,9 @@
 # used8 should come before MIPS_GOTSYM.
 #...
  +3: 000405bc +36 +FUNC +GLOBAL +DEFAULT .* used8
- +4: .* _GLOBAL_OFFSET_TABLE_
- +5: 00040574 +36 +FUNC +GLOBAL +DEFAULT .* used6
- +6: 00040598 +36 +FUNC +GLOBAL +DEFAULT .* used7
- +7: 00040550 +36 +FUNC +GLOBAL +DEFAULT .* used5
- +8: 0004052c +36 +FUNC +GLOBAL +DEFAULT .* used4
+ +4: 00040574 +36 +FUNC +GLOBAL +DEFAULT .* used6
+ +5: 00040598 +36 +FUNC +GLOBAL +DEFAULT .* used7
+ +6: 00040550 +36 +FUNC +GLOBAL +DEFAULT .* used5
+ +7: 0004052c +36 +FUNC +GLOBAL +DEFAULT .* used4
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/mips-elf.exp binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/mips-elf.exp
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/mips-elf.exp	2012-09-04 07:22:52.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/mips-elf.exp	2013-05-29 15:35:40.311363070 -0700
@@ -474,8 +474,7 @@
      #
      #     the null symbol entry
      #     the .MIPS.stubs section symbol
-     #     _GLOBAL_OFFSET_TABLE_
-     set base_syms 3
+     set base_syms 2
      foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
 	 run_ld_link_tests \
 	     [list [list \
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd	2012-09-04 07:18:47.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd	2013-05-29 15:35:40.311363070 -0700
@@ -35,5 +35,5 @@
  c00:	8f998010 	lw	t9,-32752\(gp\)
  c04:	03e07821 	move	t7,ra
  c08:	0320f809 	jalr	t9
- c0c:	24180006 	li	t8,6
+ c0c:	24180005 	li	t8,5
 	\.\.\.
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad	2012-09-04 07:18:50.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad	2013-05-29 15:35:40.311363070 -0700
@@ -16,10 +16,10 @@
 # This must be the number of GOT entries - 1, the last entry being for "bar".
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 3
 # This must be MIPS_GOTSYM + 1.
- 0x70000011 \(MIPS_SYMTABNO\) * 7
+ 0x70000011 \(MIPS_SYMTABNO\) * 6
  0x70000012 \(MIPS_UNREFEXTNO\) .*
 # This must be the index of "bar".
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43000
  0x00000002 \(PLTRELSZ\) * 8 \(bytes\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd	2012-09-04 07:18:51.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd	2013-05-29 15:35:40.311363070 -0700
@@ -48,5 +48,5 @@
 .*:	8f998010 	lw	t9,-32752\(gp\)
 .*:	03e07821 	move	t7,ra
 .*:	0320f809 	jalr	t9
-.*:	24180006 	li	t8,6
+.*:	24180005 	li	t8,5
 	\.\.\.
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd	2012-09-04 07:18:52.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd	2013-05-29 15:35:40.311363070 -0700
@@ -4,6 +4,6 @@
 .*: 00000000 +0 +FUNC +GLOBAL +DEFAULT +UND +foo
 # The index on the next line should correspond to MIPS_GOTSYM.
 #...
- *6: 00044030 +0 +FUNC +GLOBAL +DEFAULT +UND +bar
+ *5: 00044030 +0 +FUNC +GLOBAL +DEFAULT +UND +bar
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad	2012-09-04 07:18:54.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad	2013-05-29 15:35:40.311363070 -0700
@@ -19,8 +19,8 @@
 # This must be the number of GOT entries - 1, the last entry being for "obj3".
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
 # This must be MIPS_GOTSYM + 1.
- 0x70000011 \(MIPS_SYMTABNO\) * 7
+ 0x70000011 \(MIPS_SYMTABNO\) * 6
  0x70000012 \(MIPS_UNREFEXTNO\) .*
 # This must be the index of "obj3".
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000000 \(NULL\) * 0x0
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd	2012-09-04 07:18:55.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd	2013-05-29 15:35:40.311363070 -0700
@@ -7,6 +7,6 @@
 .*: 000a2008 +4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +obj2
 # The index on the next line should correspond to MIPS_GOTSYM.
 #...
- *6: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj3
+ *5: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj3
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd	2012-09-04 07:18:55.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd	2013-05-29 15:35:40.311363070 -0700
@@ -4,4 +4,4 @@
 00000000 * 00000000 * R_MIPS_NONE *
 000a2000 * 0000017e * R_MIPS_COPY * 000a2000 * obj1
 000a2008 * 0000037e * R_MIPS_COPY * 000a2008 * obj2
-000a1004 * 00000603 * R_MIPS_REL32 * 00000000 * obj3
+000a1004 * 00000503 * R_MIPS_REL32 * 00000000 * obj3
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad	2012-09-04 07:18:56.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad	2013-05-29 15:35:40.315363048 -0700
@@ -22,9 +22,9 @@
 # for "bar" and "obj2".
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
 # This must be MIPS_GOTSYM + 2.
- 0x70000011 \(MIPS_SYMTABNO\) * 9
+ 0x70000011 \(MIPS_SYMTABNO\) * 8
  0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x7
+ 0x70000013 \(MIPS_GOTSYM\) * 0x6
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43030
  0x00000002 \(PLTRELSZ\) * 8 \(bytes\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd	2012-09-04 07:18:57.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd	2013-05-29 15:35:40.315363048 -0700
@@ -4,7 +4,7 @@
 .*: 00043060 +0 +FUNC +GLOBAL +DEFAULT +\[MIPS PLT\] +UND +foo
 # The index on the next line should correspond to MIPS_GOTSYM.
 #...
- *7: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj2
- *8: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +bar
+ *6: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj2
+ *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +bar
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad	2012-09-04 07:18:58.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad	2013-05-29 15:35:40.315363048 -0700
@@ -17,9 +17,9 @@
  0x70000005 \(MIPS_FLAGS\) * NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
- 0x70000011 \(MIPS_SYMTABNO\) * 13
+ 0x70000011 \(MIPS_SYMTABNO\) * 12
  0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43028
  0x00000002 \(PLTRELSZ\) * 24 \(bytes\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd	2012-09-04 07:18:58.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd	2013-05-29 15:35:40.315363048 -0700
@@ -97,5 +97,5 @@
    440a0:	8f998010 	lw	t9,-32752\(gp\)
    440a4:	03e07821 	move	t3,ra
    440a8:	0320f809 	jalr	t9
-   440ac:	24180009 	li	t8,9
+   440ac:	24180008 	li	t8,8
 	\.\.\.
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd	2012-09-04 07:18:59.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd	2013-05-29 15:35:40.315363048 -0700
@@ -6,12 +6,12 @@
 # and the remaining symbols should have the same order as the
 # GOT layout given in the *.dd dump.
 #...
- *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
- *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
- *8: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
- *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
- *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
- *11: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
- *12: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
+ *5: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+ *7: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+ *8: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *9: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
+ *10: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
+ *11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad	2012-09-04 07:18:59.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad	2013-05-29 15:35:40.315363048 -0700
@@ -17,9 +17,9 @@
  0x0+70000005 \(MIPS_FLAGS\) * NOTPOT
  0x0+70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
  0x0+7000000a \(MIPS_LOCAL_GOTNO\) * 2
- 0x0+70000011 \(MIPS_SYMTABNO\) * 13
+ 0x0+70000011 \(MIPS_SYMTABNO\) * 12
  0x0+70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x0+70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x0+70000013 \(MIPS_GOTSYM\) * 0x5
  0x0+00000014 \(PLTREL\) * REL
  0x0+00000017 \(JMPREL\) * 0x43050
  0x0+00000002 \(PLTRELSZ\) * 48 \(bytes\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd	2012-09-04 07:19:00.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd	2013-05-29 15:35:40.315363048 -0700
@@ -97,5 +97,5 @@
    440a0:	df998010 	ld	t9,-32752\(gp\)
    440a4:	03e0782d 	move	t3,ra
    440a8:	0320f809 	jalr	t9
-   440ac:	64180009 	daddiu	t8,zero,9
+   440ac:	64180008 	daddiu	t8,zero,8
 	\.\.\.
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd	2012-09-04 07:19:00.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd	2013-05-29 15:35:40.315363048 -0700
@@ -6,12 +6,12 @@
 # and the remaining symbols should have the same order as the
 # GOT layout given in the *.dd dump.
 #...
- *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
- *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
- *8: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
- *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
- *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
- *11: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
- *12: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
+ *5: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+ *7: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+ *8: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *9: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
+ *10: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
+ *11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad	2012-09-04 07:19:01.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad	2013-05-29 15:35:40.315363048 -0700
@@ -17,9 +17,9 @@
  0x70000005 \(MIPS_FLAGS\) * NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
- 0x70000011 \(MIPS_SYMTABNO\) * 13
+ 0x70000011 \(MIPS_SYMTABNO\) * 12
  0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43028
  0x00000002 \(PLTRELSZ\) * 24 \(bytes\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd	2012-09-04 07:19:01.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd	2013-05-29 15:35:40.315363048 -0700
@@ -97,5 +97,5 @@
    440a0:	8f998010 	lw	t9,-32752\(gp\)
    440a4:	03e07821 	move	t7,ra
    440a8:	0320f809 	jalr	t9
-   440ac:	24180009 	li	t8,9
+   440ac:	24180008 	li	t8,8
 	\.\.\.
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd	2012-09-04 07:19:02.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd	2013-05-29 15:35:40.315363048 -0700
@@ -6,12 +6,12 @@
 # and the remaining symbols should have the same order as the
 # GOT layout given in the *.dd dump.
 #...
- *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
- *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
- *8: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
- *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
- *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
- *11: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
- *12: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
+ *5: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+ *7: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+ *8: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *9: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
+ *10: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
+ *11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
 
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/rel32-n32.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/rel32-n32.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/rel32-n32.d	2012-09-04 07:17:28.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/rel32-n32.d	2013-05-29 15:35:40.315363048 -0700
@@ -10,6 +10,6 @@
 [0-9a-f ]+R_MIPS_REL32     
 
 Hex dump of section '.text':
-  0x000002d0 00000000 00000000 00000000 00000000 ................
-  0x000002e0 000002e0 00000000 00000000 00000000 ................
-  0x000002f0 00000000 00000000 00000000 00000000 ................
+  0x000002a0 00000000 00000000 00000000 00000000 ................
+  0x000002b0 000002b0 00000000 00000000 00000000 ................
+  0x000002c0 00000000 00000000 00000000 00000000 ................
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/rel32-o32.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/rel32-o32.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/rel32-o32.d	2012-09-04 07:14:31.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/rel32-o32.d	2013-05-29 15:35:40.315363048 -0700
@@ -10,6 +10,6 @@
 [0-9a-f ]+R_MIPS_REL32     
 
 Hex dump of section '.text':
+  0x000002a0 00000000 00000000 00000000 00000000 ................
+  0x000002b0 000002b0 00000000 00000000 00000000 ................
   0x000002c0 00000000 00000000 00000000 00000000 ................
-  0x000002d0 000002d0 00000000 00000000 00000000 ................
-  0x000002e0 00000000 00000000 00000000 00000000 ................
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/rel64.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/rel64.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/rel64.d	2012-09-04 07:17:29.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/rel64.d	2013-05-29 15:35:40.315363048 -0700
@@ -14,6 +14,6 @@
  +Type3: R_MIPS_NONE      
 
 Hex dump of section '.text':
-  0x00000430 00000000 00000000 00000000 00000000 ................
-  0x00000440 00000000 00000440 00000000 00000000 ................
-  0x00000450 00000000 00000000 00000000 00000000 ................
+  0x00000400 00000000 00000000 00000000 00000000 ................
+  0x00000410 00000000 00000410 00000000 00000000 ................
+  0x00000420 00000000 00000000 00000000 00000000 ................
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d	2012-09-04 07:19:08.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d	2013-05-29 15:35:40.315363048 -0700
@@ -5,7 +5,7 @@
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c10 	addiu	gp,gp,31760
+  .*:	279c7c40 	addiu	gp,gp,31808
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -55,7 +55,7 @@
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b50 	addiu	gp,gp,31568
+  .*:	279c7b80 	addiu	gp,gp,31616
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got	2012-09-04 07:19:09.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got	2013-05-29 15:35:40.315363048 -0700
@@ -13,6 +13,6 @@
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004ac 00000001  .........@......
+ 10000020 00000000 80000000 0040047c 00000001  .........@......
  10000030 00000000 00000000 00000000 00000000  ................
  10000040 00000000 00000000 00000000           ............    
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d	2012-09-04 07:19:11.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d	2013-05-29 15:35:40.315363048 -0700
@@ -5,7 +5,7 @@
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c10 	addiu	gp,gp,31760
+  .*:	279c7c40 	addiu	gp,gp,31808
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -55,7 +55,7 @@
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b50 	addiu	gp,gp,31568
+  .*:	279c7b80 	addiu	gp,gp,31616
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got	2012-09-04 07:19:12.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got	2013-05-29 15:35:40.315363048 -0700
@@ -13,7 +13,7 @@
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004ac 00000000  .*
+ 10000020 00000000 80000000 0040047c 00000000  .*
  10000030 00000000 00000000 00000000 00000000  .*
  10000040 00000001 00000000 00000000 00000000  .*
  10000050 00000000 00000000                    .*
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d	2012-09-04 07:19:13.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d	2013-05-29 15:35:40.315363048 -0700
@@ -5,7 +5,7 @@
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c10 	addiu	gp,gp,31760
+  .*:	279c7c40 	addiu	gp,gp,31808
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -51,7 +51,7 @@
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b60 	addiu	gp,gp,31584
+  .*:	279c7b90 	addiu	gp,gp,31632
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got	2012-09-04 07:19:13.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got	2013-05-29 15:35:40.315363048 -0700
@@ -13,7 +13,7 @@
 
 
 Contents of section .got:
- 10000020 00000000 80000000 0040055c 00000000  .*
+ 10000020 00000000 80000000 0040052c 00000000  .*
  10000030 00000000 00000000 00000000 00000000  .*
  10000040 00000001 00000000 00000000 00000000  .*
  10000050 00000000 00000000                    .*
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32.d binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32.d
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32.d	2012-09-04 07:19:14.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32.d	2013-05-29 15:35:40.315363048 -0700
@@ -5,7 +5,7 @@
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7bc0 	addiu	gp,gp,31680
+  .*:	279c7bf0 	addiu	gp,gp,31728
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlsdyn-o32.got	2012-09-04 07:19:15.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlsdyn-o32.got	2013-05-29 15:35:40.315363048 -0700
@@ -13,6 +13,6 @@
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004fc 00000001  ................
+ 10000020 00000000 80000000 004004cc 00000001  .........@......
  10000030 00000000 00000000 00000000 00000000  ................
  10000040 00000000 00000000 00000000           ............    
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlslib-o32.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlslib-o32.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlslib-o32.got	2012-09-04 07:19:16.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlslib-o32.got	2013-05-29 15:35:40.315363048 -0700
@@ -4,12 +4,12 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE 
 00000000 R_MIPS_NONE       \*ABS\*
-00040460 R_MIPS_TLS_DTPMOD32  \*ABS\*
-00040468 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0004046c R_MIPS_TLS_DTPREL32  tlsvar_gd
-0004045c R_MIPS_TLS_TPREL32  tlsvar_ie
+00040440 R_MIPS_TLS_DTPMOD32  \*ABS\*
+00040448 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0004044c R_MIPS_TLS_DTPREL32  tlsvar_gd
+0004043c R_MIPS_TLS_TPREL32  tlsvar_ie
 
 
 Contents of section .got:
- 40450 00000000 80000000 00000420 00000000  ................
- 40460 00000000 00000000 00000000 00000000  ................
+ 40430 00000000 80000000 00000400 00000000  ................
+ 40440 00000000 00000000 00000000 00000000  ................
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got	2012-09-04 07:19:15.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got	2013-05-29 15:35:40.315363048 -0700
@@ -4,12 +4,12 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE 
 00000000 R_MIPS_NONE       \*ABS\*
-00040500 R_MIPS_TLS_DTPMOD32  \*ABS\*
-00040508 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0004050c R_MIPS_TLS_DTPREL32  tlsvar_gd
-000404fc R_MIPS_TLS_TPREL32  tlsvar_ie
+000404d0 R_MIPS_TLS_DTPMOD32  \*ABS\*
+000404d8 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+000404dc R_MIPS_TLS_DTPREL32  tlsvar_gd
+000404cc R_MIPS_TLS_TPREL32  tlsvar_ie
 
 
 Contents of section .got:
- 404f0 00000000 80000000 000004c0 00000000  ................
- 40500 00000000 00000000 00000000 00000000  ................
+ 404c0 00000000 80000000 00000490 00000000  ................
+ 404d0 00000000 00000000 00000000 00000000  ................
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tls-multi-got-1.got binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tls-multi-got-1.got
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tls-multi-got-1.got	2012-09-04 07:19:07.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tls-multi-got-1.got	2013-05-29 15:35:40.315363048 -0700
@@ -4,33 +4,33 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE 
 00000000 R_MIPS_NONE       \*ABS\*
-0013f820 R_MIPS_TLS_DTPMOD32  \*ABS\*
-0014947c R_MIPS_TLS_DTPMOD32  \*ABS\*
-0013f82c R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0013f830 R_MIPS_TLS_DTPREL32  tlsvar_gd
-00149488 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0014948c R_MIPS_TLS_DTPREL32  tlsvar_gd
-0013f828 R_MIPS_TLS_TPREL32  tlsvar_ie
-00149484 R_MIPS_TLS_TPREL32  tlsvar_ie
-00143e28 R_MIPS_REL32      sym_1_9526
+0013f7f0 R_MIPS_TLS_DTPMOD32  \*ABS\*
+0014944c R_MIPS_TLS_DTPMOD32  \*ABS\*
+0013f7fc R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0013f800 R_MIPS_TLS_DTPREL32  tlsvar_gd
+00149458 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0014945c R_MIPS_TLS_DTPREL32  tlsvar_gd
+0013f7f8 R_MIPS_TLS_TPREL32  tlsvar_ie
+00149454 R_MIPS_TLS_TPREL32  tlsvar_ie
+00143df8 R_MIPS_REL32      sym_1_9526
 #...
-00139aa8 R_MIPS_REL32      sym_2_8654
+00139a78 R_MIPS_REL32      sym_2_8654
 
 
 Contents of section .got:
- 122350 00000000 80000000 000d7f88 000d65e4  .*
- 122360 000d1f94 000d6000 000d5a38 000d19b0  .*
+ 122320 00000000 80000000 000d7f58 000d65b4  .*
+ 122330 000d1f64 000d5fd0 000d5a08 000d1980  .*
 #...
- 135bd0 000cf1f4 000e0e38 00000000 80000000  .*
- 135be0 00000000 00000000 00000000 00000000  .*
+ 135ba0 000cf1c4 000e0e08 00000000 80000000  .*
+ 135bb0 00000000 00000000 00000000 00000000  .*
 #...
- 13f810 00000000 00000000 00000000 00000000  .*
- 13f820 00000000 00000000 00000000 00000000  .*
- 13f830 00000000 00000000 80000000 00000000  .*
+ 13f7e0 00000000 00000000 00000000 00000000  .*
+ 13f7f0 00000000 00000000 00000000 00000000  .*
+ 13f800 00000000 00000000 80000000 00000000  .*
 #...
+ 149410 00000000 00000000 00000000 00000000  .*
+ 149420 00000000 00000000 00000000 00000000  .*
+ 149430 00000000 00000000 00000000 00000000  .*
  149440 00000000 00000000 00000000 00000000  .*
  149450 00000000 00000000 00000000 00000000  .*
- 149460 00000000 00000000 00000000 00000000  .*
- 149470 00000000 00000000 00000000 00000000  .*
- 149480 00000000 00000000 00000000 00000000  .*
 #pass
diff -uNr binutils-2.23.2/ld/testsuite/ld-mips-elf/tls-multi-got-1.r binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tls-multi-got-1.r
--- binutils-2.23.2/ld/testsuite/ld-mips-elf/tls-multi-got-1.r	2012-09-04 07:19:08.000000000 -0700
+++ binutils-2.23.2-fixed-mips-as-needed/ld/testsuite/ld-mips-elf/tls-multi-got-1.r	2013-05-29 15:35:40.315363048 -0700
@@ -4,19 +4,19 @@
  0x00000004 \(HASH\)                       0x1c4
  0x00000005 \(STRTAB\).*
  0x00000006 \(SYMTAB\).*
- 0x0000000a \(STRSZ\)                      220087 \(bytes\)
+ 0x0000000a \(STRSZ\)                      220065 \(bytes\)
  0x0000000b \(SYMENT\)                     16 \(bytes\)
- 0x00000003 \(PLTGOT\)                     0x122350
- 0x00000011 \(REL\)                        0xa7960
+ 0x00000003 \(PLTGOT\)                     0x122320
+ 0x00000011 \(REL\)                        0xa7938
  0x00000012 \(RELSZ\)                      160072 \(bytes\)
  0x00000013 \(RELENT\)                     8 \(bytes\)
  0x70000001 \(MIPS_RLD_VERSION\)           1
  0x70000005 \(MIPS_FLAGS\)                 NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\)          0x0
  0x7000000a \(MIPS_LOCAL_GOTNO\)           2
- 0x70000011 \(MIPS_SYMTABNO\)              20012
+ 0x70000011 \(MIPS_SYMTABNO\)              20011
  0x70000012 \(MIPS_UNREFEXTNO\)            10
- 0x70000013 \(MIPS_GOTSYM\)                0xc
+ 0x70000013 \(MIPS_GOTSYM\)                0xb
  0x0000001e \(FLAGS\)                      STATIC_TLS
  0x00000000 \(NULL\)                       0x0
 
@@ -31,8 +31,8 @@
 [0-9a-f ]+R_MIPS_TLS_DTPREL 00000000   tlsvar_gd
 [0-9a-f ]+R_MIPS_TLS_TPREL3 00000004   tlsvar_ie
 [0-9a-f ]+R_MIPS_TLS_TPREL3 00000004   tlsvar_ie
-[0-9a-f ]+R_MIPS_REL32      000d7f88   sym_1_9526
-[0-9a-f ]+R_MIPS_REL32      000d65e4   sym_1_7885
+[0-9a-f ]+R_MIPS_REL32      000d7f58   sym_1_9526
+[0-9a-f ]+R_MIPS_REL32      000d65b4   sym_1_7885
 #...
-[0-9a-f ]+R_MIPS_REL32      000cf1f4   sym_1_0465
-[0-9a-f ]+R_MIPS_REL32      000e0e38   sym_2_8654
+[0-9a-f ]+R_MIPS_REL32      000cf1c4   sym_1_0465
+[0-9a-f ]+R_MIPS_REL32      000e0e08   sym_2_8654

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests
  2013-05-29 23:50 [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests Gregory Fong
@ 2013-05-30 17:08 ` Richard Sandiford
  2013-09-24 22:16 ` Richard Sandiford
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Sandiford @ 2013-05-30 17:08 UTC (permalink / raw)
  To: Gregory Fong; +Cc: binutils, nickc

Hi Gregory

Thanks for the patch.  It looks good.  Because the testsuite changes
are rather big, I'm afraid the copyright of the patch probably needs
to be assigned to the FSF first.  Would you be happy to sign a copyright
assignment for this and future changes?  If so, Nick (cc:ed) can send
you the right form.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests
  2013-05-29 23:50 [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests Gregory Fong
  2013-05-30 17:08 ` Richard Sandiford
@ 2013-09-24 22:16 ` Richard Sandiford
  2013-10-04 10:45   ` Richard Sandiford
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Sandiford @ 2013-09-24 22:16 UTC (permalink / raw)
  To: Gregory Fong; +Cc: binutils, Tristan Gingold

Gregory Fong <gregory.0xf0@gmail.com> writes:
> Attached are two patches regarding a bug with --as-needed on mips that
> causes the following error when using --as-needed (example for a small
> test program):
>
> /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 first patch fixes the bug by hiding _GLOBAL_OFFSET_TABLE_ in
> elfxx-mips.c .  I know there was some concern that
> _GLOBAL_OFFSET_TABLE_ possibly needs to be dynamic on some mips setups
> (Eric mentioned SGI).  It doesn't seem to be an issue on my setup but
> I thought I'd mention it here in case that comes up for someone.
>
> The second patch updates the ld mips elf tests to account for
> the change to _GLOBAL_OFFSET_TABLE_.  I ran them using `make
> check' from an x86_64-linux host with target mipsel-linux-uclibc.
>
> Follows up on the thread started by Vincent Wen (Re: binutils 2.19.92
> linker broke with --as-needed flag).  For reference, see:
>
> original email:
> https://lists.gnu.org/archive/html/bug-binutils/2013-02/msg00016.html
> discussion: http://sourceware.org/ml/binutils/2013-03/msg00289.html
> discussion: http://sourceware.org/ml/binutils/2013-04/msg00004.html
>
> Based off of Hans-Peter Nilsson's Nov 2004 change to hide
> _GLOBAL_OFFSET_TABLE_ (see
> http://sourceware.org/ml/binutils-cvs/2004-11/msg00003.html).

Thanks for going through with the copyright assignment.  I updated the
patch to current mainline (just a few minor testsuite changes) and applied
it as below.

Tristan, I'd like this to go in 2.24 too if that's OK.

Thanks,
Richard


bfd/
2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>

	* elfxx-mips.c (mips_elf_create_got_section): Hide
	_GLOBAL_OFFSET_TABLE_.

ld/testsuite/
2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>

	* ld-mips-elf/eh-frame5.d, ld-mips-elf/jalx-2.dd,
	ld-mips-elf/mips-elf.exp, ld-mips-elf/mips16-pic-2.ad,
	ld-mips-elf/mips16-pic-2.nd, ld-mips-elf/pic-and-nonpic-3a.dd,
	ld-mips-elf/pic-and-nonpic-3b.ad, ld-mips-elf/pic-and-nonpic-3b.dd,
	ld-mips-elf/pic-and-nonpic-3b.nd, ld-mips-elf/pic-and-nonpic-4b.ad,
	ld-mips-elf/pic-and-nonpic-4b.nd, ld-mips-elf/pic-and-nonpic-4b.rd,
	ld-mips-elf/pic-and-nonpic-5b.ad, ld-mips-elf/pic-and-nonpic-5b.nd,
	ld-mips-elf/pic-and-nonpic-6-n32.ad,
	ld-mips-elf/pic-and-nonpic-6-n32.dd,
	ld-mips-elf/pic-and-nonpic-6-n32.nd,
	ld-mips-elf/pic-and-nonpic-6-n64.ad,
	ld-mips-elf/pic-and-nonpic-6-n64.dd,
	ld-mips-elf/pic-and-nonpic-6-n64.nd,
	ld-mips-elf/pic-and-nonpic-6-o32.ad,
	ld-mips-elf/pic-and-nonpic-6-o32.dd,
	ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/rel32-n32.d,
	ld-mips-elf/rel32-o32.d, ld-mips-elf/rel64.d,
	ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1.r,
	ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-1.got,
	ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.got,
	ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-3.got,
	ld-mips-elf/tlsdyn-o32.d, ld-mips-elf/tlsdyn-o32.got,
	ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib-o32.got: Update
	for removal of _GLOBAL_OFFSET_TABLE_ from .dynsym.

Index: bfd/elfxx-mips.c
===================================================================
--- bfd/elfxx-mips.c	2013-09-24 21:49:27.682432333 +0100
+++ bfd/elfxx-mips.c	2013-09-24 21:50:54.826233086 +0100
@@ -5017,6 +5017,7 @@ mips_elf_create_got_section (bfd *abfd,
   h->non_elf = 0;
   h->def_regular = 1;
   h->type = STT_OBJECT;
+  h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
   elf_hash_table (info)->hgot = h;
 
   if (info->shared
Index: ld/testsuite/ld-mips-elf/eh-frame5.d
===================================================================
--- ld/testsuite/ld-mips-elf/eh-frame5.d	2013-06-26 08:04:22.361104876 +0100
+++ ld/testsuite/ld-mips-elf/eh-frame5.d	2013-09-24 21:50:58.953271012 +0100
@@ -1,5 +1,5 @@
 
-Relocation section '.rel.dyn' at offset 0x101dc contains 8 entries:
+Relocation section '.rel.dyn' at offset 0x101b4 contains 8 entries:
  Offset     Info    Type            Sym.Value  Sym. Name
 00000000  .* R_MIPS_NONE *
 #
Index: ld/testsuite/ld-mips-elf/jalx-2.dd
===================================================================
--- ld/testsuite/ld-mips-elf/jalx-2.dd	2013-06-26 08:04:22.000000000 +0100
+++ ld/testsuite/ld-mips-elf/jalx-2.dd	2013-09-24 21:54:37.342278269 +0100
@@ -28,7 +28,7 @@ Disassembly of section \.text:
  4400034:	f89e 0020 	sw	a0,32\(s8\)
  4400038:	f8be 0024 	sw	a1,36\(s8\)
  440003c:	41a2 0440 	lui	v0,0x440
- 4400040:	3082 0290 	addiu	a0,v0,656
+ 4400040:	3082 0260 	addiu	a0,v0,608
  4400044:	f620 004c 	jal	4400098 <printf@micromipsplt>
  4400048:	0000 0000 	nop
  440004c:	f620 0010 	jal	4400020 <internal_function>
Index: ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
--- ld/testsuite/ld-mips-elf/mips-elf.exp	2013-07-14 09:44:35.054674397 +0100
+++ ld/testsuite/ld-mips-elf/mips-elf.exp	2013-09-24 21:50:58.954271021 +0100
@@ -514,8 +514,7 @@ if {[istarget mips*-*-linux*]} {
      #
      #     the null symbol entry
      #     the .MIPS.stubs section symbol
-     #     _GLOBAL_OFFSET_TABLE_
-     set base_syms 3
+     set base_syms 2
      foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
 	 run_ld_link_tests \
 	     [list [list \
Index: ld/testsuite/ld-mips-elf/mips16-pic-2.ad
===================================================================
--- ld/testsuite/ld-mips-elf/mips16-pic-2.ad	2013-06-26 08:04:22.605106846 +0100
+++ ld/testsuite/ld-mips-elf/mips16-pic-2.ad	2013-09-24 21:50:58.954271021 +0100
@@ -1,6 +1,6 @@
 # [MIPS_GOTSYM, MIPS_SYMTABNO) covers used4...used7.
 #...
- .* \(MIPS_SYMTABNO\) * 9
+ .* \(MIPS_SYMTABNO\) * 8
 #...
- .* \(MIPS_GOTSYM\) * 0x5
+ .* \(MIPS_GOTSYM\) * 0x4
 #pass
Index: ld/testsuite/ld-mips-elf/mips16-pic-2.nd
===================================================================
--- ld/testsuite/ld-mips-elf/mips16-pic-2.nd	2013-06-26 08:04:22.608106870 +0100
+++ ld/testsuite/ld-mips-elf/mips16-pic-2.nd	2013-09-24 21:50:58.954271021 +0100
@@ -1,10 +1,9 @@
 # used8 should come before MIPS_GOTSYM.
 #...
  +3: 000405bc +36 +FUNC +GLOBAL +DEFAULT .* used8
- +4: .* _GLOBAL_OFFSET_TABLE_
- +5: 00040574 +36 +FUNC +GLOBAL +DEFAULT .* used6
- +6: 00040598 +36 +FUNC +GLOBAL +DEFAULT .* used7
- +7: 00040550 +36 +FUNC +GLOBAL +DEFAULT .* used5
- +8: 0004052c +36 +FUNC +GLOBAL +DEFAULT .* used4
+ +4: 00040574 +36 +FUNC +GLOBAL +DEFAULT .* used6
+ +5: 00040598 +36 +FUNC +GLOBAL +DEFAULT .* used7
+ +6: 00040550 +36 +FUNC +GLOBAL +DEFAULT .* used5
+ +7: 0004052c +36 +FUNC +GLOBAL +DEFAULT .* used4
 
 #pass
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd	2013-06-26 08:04:22.000000000 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.dd	2013-09-24 21:50:58.955271030 +0100
@@ -35,5 +35,5 @@ Disassembly of section \.MIPS\.stubs:
  c00:	8f998010 	lw	t9,-32752\(gp\)
  c04:	03e07821 	move	t7,ra
  c08:	0320f809 	jalr	t9
- c0c:	24180006 	li	t8,6
+ c0c:	24180005 	li	t8,5
 	\.\.\.
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad	2013-06-26 08:04:22.725107815 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad	2013-09-24 21:50:58.977271232 +0100
@@ -16,10 +16,10 @@ Dynamic section at offset .* contains .*
 # This must be the number of GOT entries - 1, the last entry being for "bar".
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 3
 # This must be MIPS_GOTSYM + 1.
- 0x70000011 \(MIPS_SYMTABNO\) * 7
+ 0x70000011 \(MIPS_SYMTABNO\) * 6
  0x70000012 \(MIPS_UNREFEXTNO\) .*
 # This must be the index of "bar".
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43000
  0x00000002 \(PLTRELSZ\) * 8 \(bytes\)
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd	2013-06-26 08:04:22.000000000 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.dd	2013-09-24 21:50:58.977271232 +0100
@@ -49,5 +49,5 @@ Disassembly of section \.MIPS\.stubs:
 .*:	8f998010 	lw	t9,-32752\(gp\)
 .*:	03e07821 	move	t7,ra
 .*:	0320f809 	jalr	t9
-.*:	24180006 	li	t8,6
+.*:	24180005 	li	t8,5
 	\.\.\.
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd	2013-06-26 08:04:22.731107864 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.nd	2013-09-24 21:50:58.978271241 +0100
@@ -4,6 +4,6 @@ Symbol table '\.dynsym' contains .*:
 .*: 00000000 +0 +FUNC +GLOBAL +DEFAULT +UND +foo
 # The index on the next line should correspond to MIPS_GOTSYM.
 #...
- *6: 00044030 +0 +FUNC +GLOBAL +DEFAULT +UND +bar
+ *5: 00044030 +0 +FUNC +GLOBAL +DEFAULT +UND +bar
 
 #pass
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad	2013-06-26 08:04:22.736107904 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad	2013-09-24 21:50:58.978271241 +0100
@@ -19,8 +19,8 @@ Dynamic section at offset .* contains .*
 # This must be the number of GOT entries - 1, the last entry being for "obj3".
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
 # This must be MIPS_GOTSYM + 1.
- 0x70000011 \(MIPS_SYMTABNO\) * 7
+ 0x70000011 \(MIPS_SYMTABNO\) * 6
  0x70000012 \(MIPS_UNREFEXTNO\) .*
 # This must be the index of "obj3".
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000000 \(NULL\) * 0x0
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd	2013-06-26 08:04:22.739107928 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.nd	2013-09-24 21:50:58.978271241 +0100
@@ -7,6 +7,6 @@ Symbol table '\.dynsym' contains .*:
 .*: 000a2008 +4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +obj2
 # The index on the next line should correspond to MIPS_GOTSYM.
 #...
- *6: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj3
+ *5: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj3
 
 #pass
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd	2013-06-26 08:04:22.740107936 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.rd	2013-09-24 21:50:58.979271250 +0100
@@ -4,4 +4,4 @@ Relocation section '\.rel\.dyn' at offse
 00000000 * 00000000 * R_MIPS_NONE *
 000a2000 * 0000017e * R_MIPS_COPY * 000a2000 * obj1
 000a2008 * 0000037e * R_MIPS_COPY * 000a2008 * obj2
-000a1004 * 00000603 * R_MIPS_REL32 * 00000000 * obj3
+000a1004 * 00000503 * R_MIPS_REL32 * 00000000 * obj3
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad	2013-06-26 08:04:22.743107961 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad	2013-09-24 21:50:58.979271250 +0100
@@ -22,9 +22,9 @@ Dynamic section at offset .* contains .*
 # for "bar" and "obj2".
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
 # This must be MIPS_GOTSYM + 2.
- 0x70000011 \(MIPS_SYMTABNO\) * 9
+ 0x70000011 \(MIPS_SYMTABNO\) * 8
  0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x7
+ 0x70000013 \(MIPS_GOTSYM\) * 0x6
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43030
  0x00000002 \(PLTRELSZ\) * 8 \(bytes\)
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd	2013-06-26 08:04:22.811108511 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.nd	2013-09-24 21:50:58.979271250 +0100
@@ -4,7 +4,7 @@ Symbol table '\.dynsym' contains .*:
 .*: 00043060 +0 +FUNC +GLOBAL +DEFAULT +\[MIPS PLT\] +UND +foo
 # The index on the next line should correspond to MIPS_GOTSYM.
 #...
- *7: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj2
- *8: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +bar
+ *6: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +obj2
+ *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +bar
 
 #pass
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad	2013-06-26 08:04:22.818108567 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad	2013-09-24 21:50:58.979271250 +0100
@@ -17,9 +17,9 @@ Dynamic section at offset .* contains .*
  0x70000005 \(MIPS_FLAGS\) * NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
- 0x70000011 \(MIPS_SYMTABNO\) * 13
+ 0x70000011 \(MIPS_SYMTABNO\) * 12
  0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43028
  0x00000002 \(PLTRELSZ\) * 24 \(bytes\)
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd	2013-06-26 08:04:22.000000000 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd	2013-09-24 21:50:58.980271260 +0100
@@ -98,5 +98,5 @@ Disassembly of section \.MIPS\.stubs:
    440a0:	8f998010 	lw	t9,-32752\(gp\)
    440a4:	03e07821 	move	t3,ra
    440a8:	0320f809 	jalr	t9
-   440ac:	24180009 	li	t8,9
+   440ac:	24180008 	li	t8,8
 	\.\.\.
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd	2013-06-26 08:04:22.824108614 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd	2013-09-24 21:50:58.981271269 +0100
@@ -6,12 +6,12 @@ Symbol table '\.dynsym' contains .*:
 # and the remaining symbols should have the same order as the
 # GOT layout given in the *.dd dump.
 #...
- *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
- *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
- *8: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
- *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
- *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
- *11: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
- *12: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
+ *5: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+ *7: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+ *8: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *9: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
+ *10: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
+ *11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
 
 #pass
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad	2013-06-26 08:04:22.832108679 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad	2013-09-24 21:50:58.981271269 +0100
@@ -17,9 +17,9 @@ Dynamic section at offset .* contains .*
  0x0+70000005 \(MIPS_FLAGS\) * NOTPOT
  0x0+70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
  0x0+7000000a \(MIPS_LOCAL_GOTNO\) * 2
- 0x0+70000011 \(MIPS_SYMTABNO\) * 13
+ 0x0+70000011 \(MIPS_SYMTABNO\) * 12
  0x0+70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x0+70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x0+70000013 \(MIPS_GOTSYM\) * 0x5
  0x0+00000014 \(PLTREL\) * REL
  0x0+00000017 \(JMPREL\) * 0x43050
  0x0+00000002 \(PLTRELSZ\) * 48 \(bytes\)
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd	2013-06-26 08:04:22.000000000 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd	2013-09-24 21:50:58.981271269 +0100
@@ -98,5 +98,5 @@ Disassembly of section \.MIPS\.stubs:
    440a0:	df998010 	ld	t9,-32752\(gp\)
    440a4:	03e0782d 	move	t3,ra
    440a8:	0320f809 	jalr	t9
-   440ac:	64180009 	daddiu	t8,zero,9
+   440ac:	64180008 	daddiu	t8,zero,8
 	\.\.\.
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd	2013-06-26 08:04:22.835108704 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd	2013-09-24 21:50:58.982271278 +0100
@@ -6,12 +6,12 @@ Symbol table '\.dynsym' contains .*:
 # and the remaining symbols should have the same order as the
 # GOT layout given in the *.dd dump.
 #...
- *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
- *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
- *8: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
- *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
- *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
- *11: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
- *12: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
+ *5: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+ *7: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+ *8: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *9: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
+ *10: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
+ *11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
 
 #pass
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad	2013-06-26 08:04:22.843108768 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad	2013-09-24 21:50:58.983271287 +0100
@@ -17,9 +17,9 @@ Dynamic section at offset .* contains .*
  0x70000005 \(MIPS_FLAGS\) * NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
  0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
- 0x70000011 \(MIPS_SYMTABNO\) * 13
+ 0x70000011 \(MIPS_SYMTABNO\) * 12
  0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x6
+ 0x70000013 \(MIPS_GOTSYM\) * 0x5
  0x00000014 \(PLTREL\) * REL
  0x00000017 \(JMPREL\) * 0x43028
  0x00000002 \(PLTRELSZ\) * 24 \(bytes\)
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd	2013-06-26 08:04:22.000000000 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd	2013-09-24 21:50:58.983271287 +0100
@@ -98,5 +98,5 @@ Disassembly of section \.MIPS\.stubs:
    440a0:	8f998010 	lw	t9,-32752\(gp\)
    440a4:	03e07821 	move	t7,ra
    440a8:	0320f809 	jalr	t9
-   440ac:	24180009 	li	t8,9
+   440ac:	24180008 	li	t8,8
 	\.\.\.
Index: ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd
===================================================================
--- ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd	2013-06-26 08:04:22.861108913 +0100
+++ ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd	2013-09-24 21:50:58.984271296 +0100
@@ -6,12 +6,12 @@ Symbol table '\.dynsym' contains .*:
 # and the remaining symbols should have the same order as the
 # GOT layout given in the *.dd dump.
 #...
- *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
- *7: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
- *8: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
- *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
- *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
- *11: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
- *12: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
+ *5: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *6: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+ *7: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+ *8: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *9: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
+ *10: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf4
+ *11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
 
 #pass
Index: ld/testsuite/ld-mips-elf/rel32-n32.d
===================================================================
--- ld/testsuite/ld-mips-elf/rel32-n32.d	2013-06-26 08:04:22.884109099 +0100
+++ ld/testsuite/ld-mips-elf/rel32-n32.d	2013-09-24 21:50:58.984271296 +0100
@@ -10,6 +10,6 @@ Relocation section '.rel.dyn' at offset
 [0-9a-f ]+R_MIPS_REL32     
 
 Hex dump of section '.text':
-  0x000002d0 00000000 00000000 00000000 00000000 ................
-  0x000002e0 000002e0 00000000 00000000 00000000 ................
-  0x000002f0 00000000 00000000 00000000 00000000 ................
+  0x000002a0 00000000 00000000 00000000 00000000 ................
+  0x000002b0 000002b0 00000000 00000000 00000000 ................
+  0x000002c0 00000000 00000000 00000000 00000000 ................
Index: ld/testsuite/ld-mips-elf/rel32-o32.d
===================================================================
--- ld/testsuite/ld-mips-elf/rel32-o32.d	2013-06-26 08:04:22.884109099 +0100
+++ ld/testsuite/ld-mips-elf/rel32-o32.d	2013-09-24 21:50:58.985271306 +0100
@@ -10,6 +10,6 @@ Relocation section '.rel.dyn' at offset
 [0-9a-f ]+R_MIPS_REL32     
 
 Hex dump of section '.text':
+  0x000002a0 00000000 00000000 00000000 00000000 ................
+  0x000002b0 000002b0 00000000 00000000 00000000 ................
   0x000002c0 00000000 00000000 00000000 00000000 ................
-  0x000002d0 000002d0 00000000 00000000 00000000 ................
-  0x000002e0 00000000 00000000 00000000 00000000 ................
Index: ld/testsuite/ld-mips-elf/rel64.d
===================================================================
--- ld/testsuite/ld-mips-elf/rel64.d	2013-06-26 08:04:22.886109115 +0100
+++ ld/testsuite/ld-mips-elf/rel64.d	2013-09-24 21:50:58.985271306 +0100
@@ -14,6 +14,6 @@ Relocation section '.rel.dyn' at offset
  +Type3: R_MIPS_NONE      
 
 Hex dump of section '.text':
-  0x00000430 00000000 00000000 00000000 00000000 ................
-  0x00000440 00000000 00000440 00000000 00000000 ................
-  0x00000450 00000000 00000000 00000000 00000000 ................
+  0x00000400 00000000 00000000 00000000 00000000 ................
+  0x00000410 00000000 00000410 00000000 00000000 ................
+  0x00000420 00000000 00000000 00000000 00000000 ................
Index: ld/testsuite/ld-mips-elf/tls-multi-got-1.got
===================================================================
--- ld/testsuite/ld-mips-elf/tls-multi-got-1.got	2013-06-26 08:04:22.970109793 +0100
+++ ld/testsuite/ld-mips-elf/tls-multi-got-1.got	2013-09-24 22:04:22.235657177 +0100
@@ -4,33 +4,33 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE 
 00000000 R_MIPS_NONE       \*ABS\*
-0013f820 R_MIPS_TLS_DTPMOD32  \*ABS\*
-0014947c R_MIPS_TLS_DTPMOD32  \*ABS\*
-0013f828 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0013f82c R_MIPS_TLS_DTPREL32  tlsvar_gd
-00149488 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0014948c R_MIPS_TLS_DTPREL32  tlsvar_gd
-0013f830 R_MIPS_TLS_TPREL32  tlsvar_ie
-00149484 R_MIPS_TLS_TPREL32  tlsvar_ie
-00143ea8 R_MIPS_REL32      sym_1_9526
+0013f7f0 R_MIPS_TLS_DTPMOD32  \*ABS\*
+0014944c R_MIPS_TLS_DTPMOD32  \*ABS\*
+0013f7f8 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0013f7fc R_MIPS_TLS_DTPREL32  tlsvar_gd
+00149458 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0014945c R_MIPS_TLS_DTPREL32  tlsvar_gd
+0013f800 R_MIPS_TLS_TPREL32  tlsvar_ie
+00149454 R_MIPS_TLS_TPREL32  tlsvar_ie
+00143e78 R_MIPS_REL32      sym_1_9526
 #...
-00139a84 R_MIPS_REL32      sym_2_8654
+00139a54 R_MIPS_REL32      sym_2_8654
 
 
 Contents of section .got:
- 122350 00000000 80000000 000d7f88 000d65e4  .*
- 122360 000d1f94 000d6000 000d5a38 000d19b0  .*
+ 122320 00000000 80000000 000d7f58 000d65b4  .*
+ 122330 000d1f64 000d5fd0 000d5a08 000d1980  .*
 #...
- 135bd0 000cf1f4 000e0e38 00000000 80000000  .*
- 135be0 00000000 00000000 00000000 00000000  .*
+ 135ba0 000cf1c4 000e0e08 00000000 80000000  .*
+ 135bb0 00000000 00000000 00000000 00000000  .*
 #...
- 13f810 00000000 00000000 00000000 00000000  .*
- 13f820 00000000 00000000 00000000 00000000  .*
- 13f830 00000000 00000000 80000000 00000000  .*
+ 13f7e0 00000000 00000000 00000000 00000000  .*
+ 13f7f0 00000000 00000000 00000000 00000000  .*
+ 13f800 00000000 00000000 80000000 00000000  .*
 #...
+ 149410 00000000 00000000 00000000 00000000  .*
+ 149420 00000000 00000000 00000000 00000000  .*
+ 149430 00000000 00000000 00000000 00000000  .*
  149440 00000000 00000000 00000000 00000000  .*
  149450 00000000 00000000 00000000 00000000  .*
- 149460 00000000 00000000 00000000 00000000  .*
- 149470 00000000 00000000 00000000 00000000  .*
- 149480 00000000 00000000 00000000 00000000  .*
 #pass
Index: ld/testsuite/ld-mips-elf/tls-multi-got-1.r
===================================================================
--- ld/testsuite/ld-mips-elf/tls-multi-got-1.r	2013-06-26 08:04:22.971109801 +0100
+++ ld/testsuite/ld-mips-elf/tls-multi-got-1.r	2013-09-24 21:50:58.991271361 +0100
@@ -4,19 +4,19 @@ Dynamic section at offset .* contains 18
  0x00000004 \(HASH\)                       0x1c4
  0x00000005 \(STRTAB\).*
  0x00000006 \(SYMTAB\).*
- 0x0000000a \(STRSZ\)                      220087 \(bytes\)
+ 0x0000000a \(STRSZ\)                      220065 \(bytes\)
  0x0000000b \(SYMENT\)                     16 \(bytes\)
- 0x00000003 \(PLTGOT\)                     0x122350
- 0x00000011 \(REL\)                        0xa7960
+ 0x00000003 \(PLTGOT\)                     0x122320
+ 0x00000011 \(REL\)                        0xa7938
  0x00000012 \(RELSZ\)                      160072 \(bytes\)
  0x00000013 \(RELENT\)                     8 \(bytes\)
  0x70000001 \(MIPS_RLD_VERSION\)           1
  0x70000005 \(MIPS_FLAGS\)                 NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\)          0x0
  0x7000000a \(MIPS_LOCAL_GOTNO\)           2
- 0x70000011 \(MIPS_SYMTABNO\)              20012
+ 0x70000011 \(MIPS_SYMTABNO\)              20011
  0x70000012 \(MIPS_UNREFEXTNO\)            10
- 0x70000013 \(MIPS_GOTSYM\)                0xc
+ 0x70000013 \(MIPS_GOTSYM\)                0xb
  0x0000001e \(FLAGS\)                      STATIC_TLS
  0x00000000 \(NULL\)                       0x0
 
@@ -31,8 +31,8 @@ Relocation section '\.rel\.dyn' at offse
 [0-9a-f ]+R_MIPS_TLS_DTPREL 00000000   tlsvar_gd
 [0-9a-f ]+R_MIPS_TLS_TPREL3 00000004   tlsvar_ie
 [0-9a-f ]+R_MIPS_TLS_TPREL3 00000004   tlsvar_ie
-[0-9a-f ]+R_MIPS_REL32      000d7f88   sym_1_9526
-[0-9a-f ]+R_MIPS_REL32      000d65e4   sym_1_7885
+[0-9a-f ]+R_MIPS_REL32      000d7f58   sym_1_9526
+[0-9a-f ]+R_MIPS_REL32      000d65b4   sym_1_7885
 #...
-[0-9a-f ]+R_MIPS_REL32      000cf1f4   sym_1_0465
-[0-9a-f ]+R_MIPS_REL32      000e0e38   sym_2_8654
+[0-9a-f ]+R_MIPS_REL32      000cf1c4   sym_1_0465
+[0-9a-f ]+R_MIPS_REL32      000e0e08   sym_2_8654
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d	2013-06-26 08:04:22.974109826 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d	2013-09-24 21:50:58.985271306 +0100
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c10 	addiu	gp,gp,31760
+  .*:	279c7c40 	addiu	gp,gp,31808
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -55,7 +55,7 @@ Disassembly of section .text:
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b50 	addiu	gp,gp,31568
+  .*:	279c7b80 	addiu	gp,gp,31616
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got	2013-06-26 08:04:22.975109834 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got	2013-09-24 21:55:35.153809739 +0100
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004ac 00000000  .........@......
+ 10000020 00000000 80000000 0040047c 00000000  ................
  10000030 00000000 00000000 00000000 00000000  ................
  10000040 00000000 00000001 00000000           ............    
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d	2013-06-26 08:04:22.976109842 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d	2013-09-24 21:50:58.986271315 +0100
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c10 	addiu	gp,gp,31760
+  .*:	279c7c40 	addiu	gp,gp,31808
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -55,7 +55,7 @@ Disassembly of section .text:
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b50 	addiu	gp,gp,31568
+  .*:	279c7b80 	addiu	gp,gp,31616
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got	2013-06-26 08:04:22.976109842 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got	2013-09-24 21:50:58.987271324 +0100
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004ac 00000000  .*
+ 10000020 00000000 80000000 0040047c 00000000  .*
  10000030 00000000 00000000 00000000 00000000  .*
  10000040 00000000 00000001 00000000           .*
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d	2013-06-26 08:04:22.978109858 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d	2013-09-24 21:50:58.987271324 +0100
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c10 	addiu	gp,gp,31760
+  .*:	279c7c40 	addiu	gp,gp,31808
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -51,7 +51,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b60 	addiu	gp,gp,31584
+  .*:	279c7b90 	addiu	gp,gp,31632
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got	2013-06-26 08:04:22.978109858 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got	2013-09-24 21:50:58.988271333 +0100
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 0040055c 00000000  .*
+ 10000020 00000000 80000000 0040052c 00000000  .*
  10000030 00000000 00000000 00000000 00000000  .*
  10000040 00000000 00000001 00000000           .*
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32.d
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32.d	2013-06-26 08:04:22.979109866 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32.d	2013-09-24 21:50:58.988271333 +0100
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7bc0 	addiu	gp,gp,31680
+  .*:	279c7bf0 	addiu	gp,gp,31728
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32.got
===================================================================
--- ld/testsuite/ld-mips-elf/tlsdyn-o32.got	2013-06-26 08:04:22.980109874 +0100
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32.got	2013-09-24 21:56:13.184159381 +0100
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004fc 00000000  ................
+ 10000020 00000000 80000000 004004cc 00000000  ................
  10000030 00000000 00000000 00000001 00000000  ................
  10000040 00000000 00000000 00000000           ............    
Index: ld/testsuite/ld-mips-elf/tlslib-o32-ver.got
===================================================================
--- ld/testsuite/ld-mips-elf/tlslib-o32-ver.got	2013-06-26 08:04:22.983109898 +0100
+++ ld/testsuite/ld-mips-elf/tlslib-o32-ver.got	2013-09-24 21:58:28.295401714 +0100
@@ -4,12 +4,12 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE 
 00000000 R_MIPS_NONE       \*ABS\*
-00040508 R_MIPS_TLS_DTPMOD32  \*ABS\*
-00040500 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-00040504 R_MIPS_TLS_DTPREL32  tlsvar_gd
-000404fc R_MIPS_TLS_TPREL32  tlsvar_ie
+000404d8 R_MIPS_TLS_DTPMOD32  \*ABS\*
+000404d0 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+000404d4 R_MIPS_TLS_DTPREL32  tlsvar_gd
+000404cc R_MIPS_TLS_TPREL32  tlsvar_ie
 
 
 Contents of section .got:
- 404f0 00000000 80000000 000004c0 00000000  ................
- 40500 00000000 00000000 00000000 00000000  ................
+ 404c0 00000000 80000000 00000490 00000000  ................
+ 404d0 00000000 00000000 00000000 00000000  ................
Index: ld/testsuite/ld-mips-elf/tlslib-o32.got
===================================================================
--- ld/testsuite/ld-mips-elf/tlslib-o32.got	2013-06-26 08:04:22.984109906 +0100
+++ ld/testsuite/ld-mips-elf/tlslib-o32.got	2013-09-24 21:57:35.383915172 +0100
@@ -4,12 +4,12 @@ tmpdir/tlslib-o32.so:     file format el
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE 
 00000000 R_MIPS_NONE       \*ABS\*
-00040468 R_MIPS_TLS_DTPMOD32  \*ABS\*
-00040460 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-00040464 R_MIPS_TLS_DTPREL32  tlsvar_gd
-0004045c R_MIPS_TLS_TPREL32  tlsvar_ie
+00040448 R_MIPS_TLS_DTPMOD32  \*ABS\*
+00040440 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+00040444 R_MIPS_TLS_DTPREL32  tlsvar_gd
+0004043c R_MIPS_TLS_TPREL32  tlsvar_ie
 
 
 Contents of section .got:
- 40450 00000000 80000000 00000420 00000000  ................
- 40460 00000000 00000000 00000000 00000000  ................
+ 40430 00000000 80000000 00000400 00000000  ................
+ 40440 00000000 00000000 00000000 00000000  ................

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests
  2013-09-24 22:16 ` Richard Sandiford
@ 2013-10-04 10:45   ` Richard Sandiford
  2013-10-04 11:43     ` Tristan Gingold
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Sandiford @ 2013-10-04 10:45 UTC (permalink / raw)
  To: Gregory Fong; +Cc: binutils, Tristan Gingold

Hi Tristian,

Just wanted to check, is it OK to backport this to 2.24?

Thanks,
Richard

Richard Sandiford <rdsandiford@googlemail.com> writes:
> Gregory Fong <gregory.0xf0@gmail.com> writes:
>> Attached are two patches regarding a bug with --as-needed on mips that
>> causes the following error when using --as-needed (example for a small
>> test program):
>>
>> /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 first patch fixes the bug by hiding _GLOBAL_OFFSET_TABLE_ in
>> elfxx-mips.c .  I know there was some concern that
>> _GLOBAL_OFFSET_TABLE_ possibly needs to be dynamic on some mips setups
>> (Eric mentioned SGI).  It doesn't seem to be an issue on my setup but
>> I thought I'd mention it here in case that comes up for someone.
>>
>> The second patch updates the ld mips elf tests to account for
>> the change to _GLOBAL_OFFSET_TABLE_.  I ran them using `make
>> check' from an x86_64-linux host with target mipsel-linux-uclibc.
>>
>> Follows up on the thread started by Vincent Wen (Re: binutils 2.19.92
>> linker broke with --as-needed flag).  For reference, see:
>>
>> original email:
>> https://lists.gnu.org/archive/html/bug-binutils/2013-02/msg00016.html
>> discussion: http://sourceware.org/ml/binutils/2013-03/msg00289.html
>> discussion: http://sourceware.org/ml/binutils/2013-04/msg00004.html
>>
>> Based off of Hans-Peter Nilsson's Nov 2004 change to hide
>> _GLOBAL_OFFSET_TABLE_ (see
>> http://sourceware.org/ml/binutils-cvs/2004-11/msg00003.html).
>
> Thanks for going through with the copyright assignment.  I updated the
> patch to current mainline (just a few minor testsuite changes) and applied
> it as below.
>
> Tristan, I'd like this to go in 2.24 too if that's OK.
>
> Thanks,
> Richard
>
>
> bfd/
> 2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>
>
> 	* elfxx-mips.c (mips_elf_create_got_section): Hide
> 	_GLOBAL_OFFSET_TABLE_.
>
> ld/testsuite/
> 2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>
>
> 	* ld-mips-elf/eh-frame5.d, ld-mips-elf/jalx-2.dd,
> 	ld-mips-elf/mips-elf.exp, ld-mips-elf/mips16-pic-2.ad,
> 	ld-mips-elf/mips16-pic-2.nd, ld-mips-elf/pic-and-nonpic-3a.dd,
> 	ld-mips-elf/pic-and-nonpic-3b.ad, ld-mips-elf/pic-and-nonpic-3b.dd,
> 	ld-mips-elf/pic-and-nonpic-3b.nd, ld-mips-elf/pic-and-nonpic-4b.ad,
> 	ld-mips-elf/pic-and-nonpic-4b.nd, ld-mips-elf/pic-and-nonpic-4b.rd,
> 	ld-mips-elf/pic-and-nonpic-5b.ad, ld-mips-elf/pic-and-nonpic-5b.nd,
> 	ld-mips-elf/pic-and-nonpic-6-n32.ad,
> 	ld-mips-elf/pic-and-nonpic-6-n32.dd,
> 	ld-mips-elf/pic-and-nonpic-6-n32.nd,
> 	ld-mips-elf/pic-and-nonpic-6-n64.ad,
> 	ld-mips-elf/pic-and-nonpic-6-n64.dd,
> 	ld-mips-elf/pic-and-nonpic-6-n64.nd,
> 	ld-mips-elf/pic-and-nonpic-6-o32.ad,
> 	ld-mips-elf/pic-and-nonpic-6-o32.dd,
> 	ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/rel32-n32.d,
> 	ld-mips-elf/rel32-o32.d, ld-mips-elf/rel64.d,
> 	ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1.r,
> 	ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-1.got,
> 	ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.got,
> 	ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-3.got,
> 	ld-mips-elf/tlsdyn-o32.d, ld-mips-elf/tlsdyn-o32.got,
> 	ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib-o32.got: Update
> 	for removal of _GLOBAL_OFFSET_TABLE_ from .dynsym.
>
> Index: bfd/elfxx-mips.c
> ===================================================================
> --- bfd/elfxx-mips.c	2013-09-24 21:49:27.682432333 +0100
> +++ bfd/elfxx-mips.c	2013-09-24 21:50:54.826233086 +0100
> @@ -5017,6 +5017,7 @@ mips_elf_create_got_section (bfd *abfd,
>    h->non_elf = 0;
>    h->def_regular = 1;
>    h->type = STT_OBJECT;
> +  h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
>    elf_hash_table (info)->hgot = h;
>  
>    if (info->shared
[snipped]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests
  2013-10-04 10:45   ` Richard Sandiford
@ 2013-10-04 11:43     ` Tristan Gingold
  0 siblings, 0 replies; 5+ messages in thread
From: Tristan Gingold @ 2013-10-04 11:43 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: Gregory Fong, binutils


On Oct 4, 2013, at 12:45 PM, Richard Sandiford <rdsandiford@googlemail.com> wrote:

> Hi Tristian,
> 
> Just wanted to check, is it OK to backport this to 2.24?

Yes, please.

> 
> Thanks,
> Richard
> 
> Richard Sandiford <rdsandiford@googlemail.com> writes:
>> Gregory Fong <gregory.0xf0@gmail.com> writes:
>>> Attached are two patches regarding a bug with --as-needed on mips that
>>> causes the following error when using --as-needed (example for a small
>>> test program):
>>> 
>>> /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 first patch fixes the bug by hiding _GLOBAL_OFFSET_TABLE_ in
>>> elfxx-mips.c .  I know there was some concern that
>>> _GLOBAL_OFFSET_TABLE_ possibly needs to be dynamic on some mips setups
>>> (Eric mentioned SGI).  It doesn't seem to be an issue on my setup but
>>> I thought I'd mention it here in case that comes up for someone.
>>> 
>>> The second patch updates the ld mips elf tests to account for
>>> the change to _GLOBAL_OFFSET_TABLE_.  I ran them using `make
>>> check' from an x86_64-linux host with target mipsel-linux-uclibc.
>>> 
>>> Follows up on the thread started by Vincent Wen (Re: binutils 2.19.92
>>> linker broke with --as-needed flag).  For reference, see:
>>> 
>>> original email:
>>> https://lists.gnu.org/archive/html/bug-binutils/2013-02/msg00016.html
>>> discussion: http://sourceware.org/ml/binutils/2013-03/msg00289.html
>>> discussion: http://sourceware.org/ml/binutils/2013-04/msg00004.html
>>> 
>>> Based off of Hans-Peter Nilsson's Nov 2004 change to hide
>>> _GLOBAL_OFFSET_TABLE_ (see
>>> http://sourceware.org/ml/binutils-cvs/2004-11/msg00003.html).
>> 
>> Thanks for going through with the copyright assignment.  I updated the
>> patch to current mainline (just a few minor testsuite changes) and applied
>> it as below.
>> 
>> Tristan, I'd like this to go in 2.24 too if that's OK.
>> 
>> Thanks,
>> Richard
>> 
>> 
>> bfd/
>> 2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>
>> 
>> 	* elfxx-mips.c (mips_elf_create_got_section): Hide
>> 	_GLOBAL_OFFSET_TABLE_.
>> 
>> ld/testsuite/
>> 2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>
>> 
>> 	* ld-mips-elf/eh-frame5.d, ld-mips-elf/jalx-2.dd,
>> 	ld-mips-elf/mips-elf.exp, ld-mips-elf/mips16-pic-2.ad,
>> 	ld-mips-elf/mips16-pic-2.nd, ld-mips-elf/pic-and-nonpic-3a.dd,
>> 	ld-mips-elf/pic-and-nonpic-3b.ad, ld-mips-elf/pic-and-nonpic-3b.dd,
>> 	ld-mips-elf/pic-and-nonpic-3b.nd, ld-mips-elf/pic-and-nonpic-4b.ad,
>> 	ld-mips-elf/pic-and-nonpic-4b.nd, ld-mips-elf/pic-and-nonpic-4b.rd,
>> 	ld-mips-elf/pic-and-nonpic-5b.ad, ld-mips-elf/pic-and-nonpic-5b.nd,
>> 	ld-mips-elf/pic-and-nonpic-6-n32.ad,
>> 	ld-mips-elf/pic-and-nonpic-6-n32.dd,
>> 	ld-mips-elf/pic-and-nonpic-6-n32.nd,
>> 	ld-mips-elf/pic-and-nonpic-6-n64.ad,
>> 	ld-mips-elf/pic-and-nonpic-6-n64.dd,
>> 	ld-mips-elf/pic-and-nonpic-6-n64.nd,
>> 	ld-mips-elf/pic-and-nonpic-6-o32.ad,
>> 	ld-mips-elf/pic-and-nonpic-6-o32.dd,
>> 	ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/rel32-n32.d,
>> 	ld-mips-elf/rel32-o32.d, ld-mips-elf/rel64.d,
>> 	ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1.r,
>> 	ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-1.got,
>> 	ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.got,
>> 	ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-3.got,
>> 	ld-mips-elf/tlsdyn-o32.d, ld-mips-elf/tlsdyn-o32.got,
>> 	ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib-o32.got: Update
>> 	for removal of _GLOBAL_OFFSET_TABLE_ from .dynsym.
>> 
>> Index: bfd/elfxx-mips.c
>> ===================================================================
>> --- bfd/elfxx-mips.c	2013-09-24 21:49:27.682432333 +0100
>> +++ bfd/elfxx-mips.c	2013-09-24 21:50:54.826233086 +0100
>> @@ -5017,6 +5017,7 @@ mips_elf_create_got_section (bfd *abfd,
>>   h->non_elf = 0;
>>   h->def_regular = 1;
>>   h->type = STT_OBJECT;
>> +  h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
>>   elf_hash_table (info)->hgot = h;
>> 
>>   if (info->shared
> [snipped]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-04 11:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29 23:50 [PATCH] mips/bfd/ld: Fix --as-needed on mips and update related ld tests Gregory Fong
2013-05-30 17:08 ` Richard Sandiford
2013-09-24 22:16 ` Richard Sandiford
2013-10-04 10:45   ` Richard Sandiford
2013-10-04 11:43     ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).