aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2013-10-13 10:03:22 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2013-10-13 10:03:22 +0000
commitc5d6fa4495dd20cc44698346f102fd7702fd601d (patch)
tree8143608bc9d5fa9672f935421ad9a3b302e41c01 /ld
parent3fcec3ee7795b07b20b3e02df70c9c326abfd81d (diff)
downloadgdb-c5d6fa4495dd20cc44698346f102fd7702fd601d.zip
gdb-c5d6fa4495dd20cc44698346f102fd7702fd601d.tar.gz
gdb-c5d6fa4495dd20cc44698346f102fd7702fd601d.tar.bz2
bfd/
* elfxx-mips.c (mips_use_local_got_p): New function. (mips_elf_count_got_symbols, mips_elf_calculate_relocation): Use it. (_bfd_mips_elf_check_relocs): Set pointer_equality_needed for GOT and absolute references. ld/testsuite/ * 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.gd, ld-mips-elf/pic-and-nonpic-6-n32.nd, ld-mips-elf/pic-and-nonpic-6-n32.rd, 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.gd, ld-mips-elf/pic-and-nonpic-6-n64.nd, ld-mips-elf/pic-and-nonpic-6-n64.rd, 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.gd, ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/pic-and-nonpic-6-o32.rd: Fix symbol value of extf4. No longer expect extf3, extf4 and extd2 to be in the global GOT.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog19
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad4
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd26
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.gd17
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd39
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.rd4
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad4
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd28
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.gd41
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd37
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.rd6
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad4
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd26
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.gd17
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd39
-rw-r--r--ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.rd4
16 files changed, 206 insertions, 109 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 6beeb25..b04f027 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+2013-10-13 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * 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.gd,
+ ld-mips-elf/pic-and-nonpic-6-n32.nd,
+ ld-mips-elf/pic-and-nonpic-6-n32.rd,
+ 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.gd,
+ ld-mips-elf/pic-and-nonpic-6-n64.nd,
+ ld-mips-elf/pic-and-nonpic-6-n64.rd,
+ 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.gd,
+ ld-mips-elf/pic-and-nonpic-6-o32.nd,
+ ld-mips-elf/pic-and-nonpic-6-o32.rd: Fix symbol value of extf4.
+ No longer expect extf3, extf4 and extd2 to be in the global GOT.
+
2013-10-03 Will Newton <will.newton@linaro.org>
* ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64.
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
index fab5581..5df3c6c 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
@@ -16,10 +16,10 @@ Dynamic section at offset .* contains .*:
0x70000001 \(MIPS_RLD_VERSION\) * 1
0x70000005 \(MIPS_FLAGS\) * NOTPOT
0x70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
- 0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
+ 0x7000000a \(MIPS_LOCAL_GOTNO\) * 5
0x70000011 \(MIPS_SYMTABNO\) * 12
0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x5
+ 0x70000013 \(MIPS_GOTSYM\) * 0x8
0x00000014 \(PLTREL\) * REL
0x00000017 \(JMPREL\) * 0x43028
0x00000002 \(PLTRELSZ\) * 24 \(bytes\)
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd
index df8d02a..276d874 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.dd
@@ -2,13 +2,13 @@
#
# -32752: lazy resolution function
# -32748: reserved for module pointer
-# -32744: extf2's GOT entry (undefined 0)
-# -32740: extf3's GOT entry (PLT entry)
-# -32736: extd2's GOT entry (copy reloc)
-# -32732: extf1's GOT entry (.MIPS.stubs entry)
-# -32728: extd1's GOT entry (undefined 0)
-# -32724: extf4's GOT entry (PLT entry)
-# -32620: extd4's GOT entry (undefined 0, reloc only)
+# -32744: extd2's local GOT entry (copy reloc)
+# -32740: extf3's local GOT entry (PLT entry)
+# -32736: extf4's local GOT entry (PLT entry)
+# -32732: extf2's global GOT entry (undefined 0)
+# -32728: extf1's global GOT entry (.MIPS.stubs entry)
+# -32724: extd1's global GOT entry (undefined 0)
+# -32720: extd4's global GOT entry (undefined 0, reloc only)
.*
@@ -61,14 +61,14 @@ Disassembly of section \.text:
44020: 3c1c0006 lui gp,0x6
44024: 0399e021 addu gp,gp,t9
44028: 279c3fd0 addiu gp,gp,16336
- 4402c: 8f998024 lw t9,-32732\(gp\)
- 44030: 8f848018 lw a0,-32744\(gp\)
- 44034: 8f858028 lw a1,-32728\(gp\)
+ 4402c: 8f998028 lw t9,-32728\(gp\)
+ 44030: 8f848024 lw a0,-32732\(gp\)
+ 44034: 8f85802c lw a1,-32724\(gp\)
44038: 0320f809 jalr t9
- 4403c: 8f868020 lw a2,-32736\(gp\)
+ 4403c: 8f868018 lw a2,-32744\(gp\)
44040: 8f99801c lw t9,-32740\(gp\)
44044: 03200008 jr t9
- 44048: 8f84802c lw a0,-32724\(gp\)
+ 44048: 8f848020 lw a0,-32736\(gp\)
0004404c <f3>:
4404c: 03e00008 jr ra
@@ -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: 24180008 li t8,8
+ 440ac: 24180009 li t8,9
\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.gd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.gd
index 8b6b5a0..d5d1b42 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.gd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.gd
@@ -7,14 +7,17 @@ Primary GOT:
000a0000 -32752\(gp\) 00000000 Lazy resolver
000a0004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+ Local entries:
+ Address Access Initial
+ 000a0008 -32744\(gp\) 000a2000
+ 000a000c -32740\(gp\) 00043080
+ 000a0010 -32736\(gp\) 00043060
+
Global entries:
Address Access Initial Sym\.Val\. Type Ndx Name
- 000a0008 -32744\(gp\) 00000000 00000000 FUNC UND extf2
- 000a000c -32740\(gp\) 00000000 00000000 FUNC UND extf3
- 000a0010 -32736\(gp\) 000a2000 000a2000 OBJECT 16 extd2
- 000a0014 -32732\(gp\) 000440a0 000440a0 FUNC UND extf1
- 000a0018 -32728\(gp\) 00000000 00000000 OBJECT UND extd1
- 000a001c -32724\(gp\) 00000000 00000000 FUNC UND extf4
+ 000a0014 -32732\(gp\) 00000000 00000000 FUNC UND extf2
+ 000a0018 -32728\(gp\) 000440a0 000440a0 FUNC UND extf1
+ 000a001c -32724\(gp\) 00000000 00000000 OBJECT UND extd1
000a0020 -32720\(gp\) 00000000 00000000 OBJECT UND extd4
@@ -27,6 +30,6 @@ PLT GOT:
Entries:
Address Initial Sym.Val. Type Ndx Name
- 00081008 00043040 00000000 FUNC UND extf4
+ 00081008 00043040 00043060 FUNC UND extf4
0008100c 00043040 00000000 FUNC UND extf5
00081010 00043040 00000000 FUNC UND extf3
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd
index 07bfa6b..f93c741 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.nd
@@ -1,17 +1,40 @@
Symbol table '\.dynsym' contains .*:
+#
+# extf4 is referenced by a JAL and .word. The former requires a PLT entry
+# and the latter requires pointer equality, which means a symbol value is
+# needed.
#...
-.*: 00000000 +0 +FUNC +GLOBAL +DEFAULT +UND +extf5
+.*: 0+43060 +0 +FUNC +GLOBAL +DEFAULT \[MIPS PLT\] +UND +extf4
+#
+# extf5 is called but does not have its address taken. It needs a PLT
+# but no symbol value should be set.
+#...
+.*: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf5
+#
+# extd2 is referenced by %got, .word and %hi/%lo. The last pair forces
+# a copy reloc.
+#
+.*: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+#
+# extf3 is referenced by a JAL and a GOT CALL reloc. The JAL forces a PLT
+# that the GOT CALL reloc will also use, but pointer equality isn't needed
+# and so no symbol value should be set.
+#
+.*: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+#
+# extd3 is referenced by .word and %hi/%lo. The latter pair forces
+# a copy reloc.
+#...
+.*: 0+a2018 +28 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd3
+#
# The index on the next line should correspond to MIPS_GOTSYM,
# and the remaining symbols should have the same order as the
# GOT layout given in the *.dd dump.
-#...
- *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
+#
+ *8: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
*11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
#pass
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.rd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.rd
index 0fd5b7e..afeae98 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.rd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.rd
@@ -2,13 +2,13 @@
Relocation section '\.rel\.dyn' at offset .* contains .*:
* Offset * Info * Type * Sym\.Value * Sym\. Name
00000000 * 00000000 * R_MIPS_NONE *
-000a2018 * [^ ]*7e * R_MIPS_COPY * 000a2018 * extd3
000a2000 * [^ ]*7e * R_MIPS_COPY * 000a2000 * extd2
+000a2018 * [^ ]*7e * R_MIPS_COPY * 000a2018 * extd3
000a1000 * [^ ]*03 * R_MIPS_REL32 * 00000000 * extd1
000a1014 * [^ ]*03 * R_MIPS_REL32 * 00000000 * extd4
Relocation section '\.rel\.plt' at offset .* contains .*:
* Offset * Info * Type * Sym\.Value * Sym\. Name
-00081008 * [^ ]*7f * R_MIPS_JUMP_SLOT * 00000000 * extf4
+00081008 * [^ ]*7f * R_MIPS_JUMP_SLOT * 00043060 * extf4
0008100c * [^ ]*7f * R_MIPS_JUMP_SLOT * 00000000 * extf5
00081010 * [^ ]*7f * R_MIPS_JUMP_SLOT * 00000000 * extf3
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
index 5550483..d8fc300 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
@@ -16,10 +16,10 @@ Dynamic section at offset .* contains .*:
0x0+70000001 \(MIPS_RLD_VERSION\) * 1
0x0+70000005 \(MIPS_FLAGS\) * NOTPOT
0x0+70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
- 0x0+7000000a \(MIPS_LOCAL_GOTNO\) * 2
+ 0x0+7000000a \(MIPS_LOCAL_GOTNO\) * 5
0x0+70000011 \(MIPS_SYMTABNO\) * 12
0x0+70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x0+70000013 \(MIPS_GOTSYM\) * 0x5
+ 0x0+70000013 \(MIPS_GOTSYM\) * 0x8
0x0+00000014 \(PLTREL\) * REL
0x0+00000017 \(JMPREL\) * 0x43050
0x0+00000002 \(PLTRELSZ\) * 48 \(bytes\)
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd
index 2480623..fbb3615 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.dd
@@ -1,14 +1,14 @@
# GOT layout:
#
# -32752: lazy resolution function
-# -32744: reserved for module pointer
-# -32736: extf2's GOT entry (undefined 0)
-# -32728: extf3's GOT entry (PLT entry)
-# -32720: extd2's GOT entry (copy reloc)
-# -32712: extf1's GOT entry (.MIPS.stubs entry)
-# -32704: extd1's GOT entry (undefined 0)
-# -32696: extf4's GOT entry (PLT entry)
-# -32688: extd4's GOT entry (undefined 0, reloc only)
+# -32748: reserved for module pointer
+# -32744: extd2's local GOT entry (copy reloc)
+# -32740: extf3's local GOT entry (PLT entry)
+# -32736: extf4's local GOT entry (PLT entry)
+# -32732: extf2's global GOT entry (undefined 0)
+# -32728: extf1's global GOT entry (.MIPS.stubs entry)
+# -32724: extd1's global GOT entry (undefined 0)
+# -32720: extd4's global GOT entry (undefined 0, reloc only)
.*
@@ -61,14 +61,14 @@ Disassembly of section \.text:
44020: 3c1c0006 lui gp,0x6
44024: 0399e021 addu gp,gp,t9
44028: 279c3fd0 addiu gp,gp,16336
- 4402c: df998038 ld t9,-32712\(gp\)
- 44030: df848020 ld a0,-32736\(gp\)
- 44034: df858040 ld a1,-32704\(gp\)
+ 4402c: df998040 ld t9,-32704\(gp\)
+ 44030: df848038 ld a0,-32712\(gp\)
+ 44034: df858048 ld a1,-32696\(gp\)
44038: 0320f809 jalr t9
- 4403c: df868030 ld a2,-32720\(gp\)
+ 4403c: df868020 ld a2,-32736\(gp\)
44040: df998028 ld t9,-32728\(gp\)
44044: 03200008 jr t9
- 44048: df848048 ld a0,-32696\(gp\)
+ 44048: df848030 ld a0,-32720\(gp\)
0+4404c <f3>:
4404c: 03e00008 jr ra
@@ -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: 64180008 daddiu t8,zero,8
+ 440ac: 64180009 daddiu t8,zero,9
\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.gd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.gd
index 767d150..46cbcdd 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.gd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.gd
@@ -1,32 +1,35 @@
Primary GOT:
- Canonical gp value: 00000000000a7ff0
+ Canonical gp value: 0+0a7ff0
Reserved entries:
- Address Access Initial Purpose
- 00000000000a0000 -32752\(gp\) 0000000000000000 Lazy resolver
- 00000000000a0008 -32744\(gp\) 8000000000000000 Module pointer \(GNU extension\)
+ * Address * Access * Initial Purpose
+ 0+0a0000 -32752\(gp\) 0+ Lazy resolver
+ 0+0a0008 -32744\(gp\) 8000000000000000 Module pointer \(GNU extension\)
+
+ Local entries:
+ * Address * Access * Initial
+ 0+0a0010 -32736\(gp\) 0+0a2000
+ 0+0a0018 -32728\(gp\) 0+0430c0
+ 0+0a0020 -32720\(gp\) 0+0430a0
Global entries:
- Address Access Initial Sym\.Val\. Type Ndx Name
- 00000000000a0010 -32736\(gp\) 0000000000000000 0000000000000000 FUNC UND extf2
- 00000000000a0018 -32728\(gp\) 0000000000000000 0000000000000000 FUNC UND extf3
- 00000000000a0020 -32720\(gp\) 00000000000a2000 00000000000a2000 OBJECT 16 extd2
- 00000000000a0028 -32712\(gp\) 00000000000440a0 00000000000440a0 FUNC UND extf1
- 00000000000a0030 -32704\(gp\) 0000000000000000 0000000000000000 OBJECT UND extd1
- 00000000000a0038 -32696\(gp\) 0000000000000000 0000000000000000 FUNC UND extf4
- 00000000000a0040 -32688\(gp\) 0000000000000000 0000000000000000 OBJECT UND extd4
+ * Address * Access * Initial * Sym\.Val\. * Type * Ndx Name
+ 0+0a0028 -32712\(gp\) 0+000000 0+000000 FUNC UND extf2
+ 0+0a0030 -32704\(gp\) 0+0440a0 0+0440a0 FUNC UND extf1
+ 0+0a0038 -32696\(gp\) 0+000000 0+000000 OBJECT UND extd1
+ 0+0a0040 -32688\(gp\) 0+000000 0+000000 OBJECT UND extd4
PLT GOT:
Reserved entries:
- Address Initial Purpose
- 0000000000081000 0000000000000000 PLT lazy resolver
- 0000000000081008 0000000000000000 Module pointer
+ * Address * Initial * Purpose
+ 0+081000 0+ PLT lazy resolver
+ 0+081008 0+ Module pointer
Entries:
- Address Initial Sym.Val. Type Ndx Name
- 0000000000081010 0000000000043080 0000000000000000 FUNC UND extf4
- 0000000000081018 0000000000043080 0000000000000000 FUNC UND extf5
- 0000000000081020 0000000000043080 0000000000000000 FUNC UND extf3
+ * Address * Initial * Sym.Val. * Type * Ndx Name
+ 0+081010 0+043080 0+0430a0 FUNC UND extf4
+ 0+081018 0+043080 0+000000 FUNC UND extf5
+ 0+081020 0+043080 0+000000 FUNC UND extf3
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd
index 867389b..63b3fc4 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.nd
@@ -1,17 +1,40 @@
Symbol table '\.dynsym' contains .*:
+#
+# extf4 is referenced by a JAL and .word. The former requires a PLT entry
+# and the latter requires pointer equality, which means a symbol value is
+# needed.
+#...
+.*: 0+430a0 +0 +FUNC +GLOBAL +DEFAULT \[MIPS PLT\] +UND +extf4
+#
+# extf5 is called but does not have its address taken. It needs a PLT
+# but no symbol value should be set.
#...
.*: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf5
+#
+# extd2 is referenced by %got, .word and %hi/%lo. The last pair forces
+# a copy reloc.
+#
+.*: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+#
+# extf3 is referenced by a JAL and a GOT CALL reloc. The JAL forces a PLT
+# that the GOT CALL reloc will also use, but pointer equality isn't needed
+# and so no symbol value should be set.
+#
+.*: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+#
+# extd3 is referenced by .word and %hi/%lo. The latter pair forces
+# a copy reloc.
+#...
+.*: 0+a2018 +28 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd3
+#
# The index on the next line should correspond to MIPS_GOTSYM,
# and the remaining symbols should have the same order as the
# GOT layout given in the *.dd dump.
-#...
- *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
+#
+ *8: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
*11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
#pass
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.rd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.rd
index 666785e..2b25b0a 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.rd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.rd
@@ -4,10 +4,10 @@ Relocation section '\.rel\.dyn' at offset .* contains .*:
0+00000 * 0+ * R_MIPS_NONE *
*Type2: R_MIPS_NONE *
*Type3: R_MIPS_NONE *
-0+a2018 * [^ ]*7e * R_MIPS_COPY * 0+a2018 * extd3
+0+a2000 * [^ ]*7e * R_MIPS_COPY * 0+a2000 * extd2
*Type2: R_MIPS_NONE *
*Type3: R_MIPS_NONE *
-0+a2000 * [^ ]*7e * R_MIPS_COPY * 0+a2000 * extd2
+0+a2018 * [^ ]*7e * R_MIPS_COPY * 0+a2018 * extd3
*Type2: R_MIPS_NONE *
*Type3: R_MIPS_NONE *
0+a1000 * [^ ]*03 * R_MIPS_REL32 * 0+00000 * extd1
@@ -19,7 +19,7 @@ Relocation section '\.rel\.dyn' at offset .* contains .*:
Relocation section '\.rel\.plt' at offset .* contains .*:
* Offset * Info * Type * Sym\. Value * Sym\. Name
-0+81010 * [^ ]*7f * R_MIPS_JUMP_SLOT * 0+00000 * extf4
+0+81010 * [^ ]*7f * R_MIPS_JUMP_SLOT * 0+430a0 * extf4
*Type2: R_MIPS_NONE *
*Type3: R_MIPS_NONE *
0+81018 * [^ ]*7f * R_MIPS_JUMP_SLOT * 0+00000 * extf5
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
index fab5581..5df3c6c 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
@@ -16,10 +16,10 @@ Dynamic section at offset .* contains .*:
0x70000001 \(MIPS_RLD_VERSION\) * 1
0x70000005 \(MIPS_FLAGS\) * NOTPOT
0x70000006 \(MIPS_BASE_ADDRESS\) * 0x40000
- 0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
+ 0x7000000a \(MIPS_LOCAL_GOTNO\) * 5
0x70000011 \(MIPS_SYMTABNO\) * 12
0x70000012 \(MIPS_UNREFEXTNO\) * .*
- 0x70000013 \(MIPS_GOTSYM\) * 0x5
+ 0x70000013 \(MIPS_GOTSYM\) * 0x8
0x00000014 \(PLTREL\) * REL
0x00000017 \(JMPREL\) * 0x43028
0x00000002 \(PLTRELSZ\) * 24 \(bytes\)
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd
index 7f101ac..e10a0af 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.dd
@@ -2,13 +2,13 @@
#
# -32752: lazy resolution function
# -32748: reserved for module pointer
-# -32744: extf2's GOT entry (undefined 0)
-# -32740: extf3's GOT entry (PLT entry)
-# -32736: extd2's GOT entry (copy reloc)
-# -32732: extf1's GOT entry (.MIPS.stubs entry)
-# -32728: extd1's GOT entry (undefined 0)
-# -32724: extf4's GOT entry (PLT entry)
-# -32620: extd4's GOT entry (undefined 0, reloc only)
+# -32744: extd2's local GOT entry (copy reloc)
+# -32740: extf3's local GOT entry (PLT entry)
+# -32736: extf4's local GOT entry (PLT entry)
+# -32732: extf2's global GOT entry (undefined 0)
+# -32728: extf1's global GOT entry (.MIPS.stubs entry)
+# -32724: extd1's global GOT entry (undefined 0)
+# -32720: extd4's global GOT entry (undefined 0, reloc only)
.*
@@ -61,14 +61,14 @@ Disassembly of section \.text:
44020: 3c1c0006 lui gp,0x6
44024: 279c3fd0 addiu gp,gp,16336
44028: 0399e021 addu gp,gp,t9
- 4402c: 8f998024 lw t9,-32732\(gp\)
- 44030: 8f848018 lw a0,-32744\(gp\)
- 44034: 8f858028 lw a1,-32728\(gp\)
+ 4402c: 8f998028 lw t9,-32728\(gp\)
+ 44030: 8f848024 lw a0,-32732\(gp\)
+ 44034: 8f85802c lw a1,-32724\(gp\)
44038: 0320f809 jalr t9
- 4403c: 8f868020 lw a2,-32736\(gp\)
+ 4403c: 8f868018 lw a2,-32744\(gp\)
44040: 8f99801c lw t9,-32740\(gp\)
44044: 03200008 jr t9
- 44048: 8f84802c lw a0,-32724\(gp\)
+ 44048: 8f848020 lw a0,-32736\(gp\)
0004404c <f3>:
4404c: 03e00008 jr ra
@@ -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: 24180008 li t8,8
+ 440ac: 24180009 li t8,9
\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.gd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.gd
index 8b6b5a0..d5d1b42 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.gd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.gd
@@ -7,14 +7,17 @@ Primary GOT:
000a0000 -32752\(gp\) 00000000 Lazy resolver
000a0004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+ Local entries:
+ Address Access Initial
+ 000a0008 -32744\(gp\) 000a2000
+ 000a000c -32740\(gp\) 00043080
+ 000a0010 -32736\(gp\) 00043060
+
Global entries:
Address Access Initial Sym\.Val\. Type Ndx Name
- 000a0008 -32744\(gp\) 00000000 00000000 FUNC UND extf2
- 000a000c -32740\(gp\) 00000000 00000000 FUNC UND extf3
- 000a0010 -32736\(gp\) 000a2000 000a2000 OBJECT 16 extd2
- 000a0014 -32732\(gp\) 000440a0 000440a0 FUNC UND extf1
- 000a0018 -32728\(gp\) 00000000 00000000 OBJECT UND extd1
- 000a001c -32724\(gp\) 00000000 00000000 FUNC UND extf4
+ 000a0014 -32732\(gp\) 00000000 00000000 FUNC UND extf2
+ 000a0018 -32728\(gp\) 000440a0 000440a0 FUNC UND extf1
+ 000a001c -32724\(gp\) 00000000 00000000 OBJECT UND extd1
000a0020 -32720\(gp\) 00000000 00000000 OBJECT UND extd4
@@ -27,6 +30,6 @@ PLT GOT:
Entries:
Address Initial Sym.Val. Type Ndx Name
- 00081008 00043040 00000000 FUNC UND extf4
+ 00081008 00043040 00043060 FUNC UND extf4
0008100c 00043040 00000000 FUNC UND extf5
00081010 00043040 00000000 FUNC UND extf3
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd
index 07bfa6b..f93c741 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.nd
@@ -1,17 +1,40 @@
Symbol table '\.dynsym' contains .*:
+#
+# extf4 is referenced by a JAL and .word. The former requires a PLT entry
+# and the latter requires pointer equality, which means a symbol value is
+# needed.
#...
-.*: 00000000 +0 +FUNC +GLOBAL +DEFAULT +UND +extf5
+.*: 0+43060 +0 +FUNC +GLOBAL +DEFAULT \[MIPS PLT\] +UND +extf4
+#
+# extf5 is called but does not have its address taken. It needs a PLT
+# but no symbol value should be set.
+#...
+.*: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf5
+#
+# extd2 is referenced by %got, .word and %hi/%lo. The last pair forces
+# a copy reloc.
+#
+.*: 0+a2000 +24 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd2
+#
+# extf3 is referenced by a JAL and a GOT CALL reloc. The JAL forces a PLT
+# that the GOT CALL reloc will also use, but pointer equality isn't needed
+# and so no symbol value should be set.
+#
+.*: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf3
+#
+# extd3 is referenced by .word and %hi/%lo. The latter pair forces
+# a copy reloc.
+#...
+.*: 0+a2018 +28 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +extd3
+#
# The index on the next line should correspond to MIPS_GOTSYM,
# and the remaining symbols should have the same order as the
# GOT layout given in the *.dd dump.
-#...
- *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
+#
+ *8: 0+ +0 +FUNC +GLOBAL +DEFAULT +UND +extf2
+ *9: 0+440a0 +0 +FUNC +GLOBAL +DEFAULT +UND +extf1
+ *10: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd1
*11: 0+ +0 +OBJECT +GLOBAL +DEFAULT +UND +extd4
#pass
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.rd b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.rd
index 0fd5b7e..afeae98 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.rd
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.rd
@@ -2,13 +2,13 @@
Relocation section '\.rel\.dyn' at offset .* contains .*:
* Offset * Info * Type * Sym\.Value * Sym\. Name
00000000 * 00000000 * R_MIPS_NONE *
-000a2018 * [^ ]*7e * R_MIPS_COPY * 000a2018 * extd3
000a2000 * [^ ]*7e * R_MIPS_COPY * 000a2000 * extd2
+000a2018 * [^ ]*7e * R_MIPS_COPY * 000a2018 * extd3
000a1000 * [^ ]*03 * R_MIPS_REL32 * 00000000 * extd1
000a1014 * [^ ]*03 * R_MIPS_REL32 * 00000000 * extd4
Relocation section '\.rel\.plt' at offset .* contains .*:
* Offset * Info * Type * Sym\.Value * Sym\. Name
-00081008 * [^ ]*7f * R_MIPS_JUMP_SLOT * 00000000 * extf4
+00081008 * [^ ]*7f * R_MIPS_JUMP_SLOT * 00043060 * extf4
0008100c * [^ ]*7f * R_MIPS_JUMP_SLOT * 00000000 * extf5
00081010 * [^ ]*7f * R_MIPS_JUMP_SLOT * 00000000 * extf3