aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2008-07-10 19:06:54 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2008-07-10 19:06:54 +0000
commit0a61c8c283b8f3be8efc3816b84c88bc1962b04d (patch)
tree930ade3feb09e614c88aececb05df4607b0b0785 /ld
parent30c090907953c55bb80ec4af160054776d32303e (diff)
downloadfsf-binutils-gdb-0a61c8c283b8f3be8efc3816b84c88bc1962b04d.zip
fsf-binutils-gdb-0a61c8c283b8f3be8efc3816b84c88bc1962b04d.tar.gz
fsf-binutils-gdb-0a61c8c283b8f3be8efc3816b84c88bc1962b04d.tar.bz2
bfd/
* elfxx-mips.c (mips_elf_calculate_relocation): Calculate GP and GP0 for all relocation types. Allow any type of relocation to refer to __gnu_local_gp. ld/testsuite/ * ld-mips-elf/no-shared-1-o32.s, ld-mips-elf/no-shared-1-o32.d, ld-mips-elf/no-shared-1-n32.d, ld-mips-elf/no-shared-1-n64.s, ld-mips-elf/no-shared-1-n64.d, ld-mips-elf/no-shared-1.ld: New tests. * ld-mips-elf/mips-elf.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp9
-rw-r--r--ld/testsuite/ld-mips-elf/no-shared-1-n32.d25
-rw-r--r--ld/testsuite/ld-mips-elf/no-shared-1-n64.d26
-rw-r--r--ld/testsuite/ld-mips-elf/no-shared-1-n64.s13
-rw-r--r--ld/testsuite/ld-mips-elf/no-shared-1-o32.d24
-rw-r--r--ld/testsuite/ld-mips-elf/no-shared-1-o32.s13
-rw-r--r--ld/testsuite/ld-mips-elf/no-shared-1.ld11
8 files changed, 131 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 9159c2a..d3337f3 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * ld-mips-elf/no-shared-1-o32.s,
+ ld-mips-elf/no-shared-1-o32.d,
+ ld-mips-elf/no-shared-1-n32.d,
+ ld-mips-elf/no-shared-1-n64.s,
+ ld-mips-elf/no-shared-1-n64.d,
+ ld-mips-elf/no-shared-1.ld: New tests.
+ * ld-mips-elf/mips-elf.exp: Run them.
+
2008-07-07 Stan Shebs <stan@codesourcery.com>
* ld-arm/arm-elf.exp: Use objdump -d for arm-be8 test.
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 86462f4..80493e9 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -79,6 +79,15 @@ if { $linux_gnu } {
run_dump_test "multi-got-hidden-2"
}
+# Test __gnu_local_gp accesses
+if { $linux_gnu } {
+ run_dump_test "no-shared-1-o32"
+ if { $has_newabi } {
+ run_dump_test "no-shared-1-n32"
+ run_dump_test "no-shared-1-n64"
+ }
+}
+
if $has_newabi {
run_dump_test "elf-rel-got-n32"
run_dump_test "elf-rel-xgot-n32"
diff --git a/ld/testsuite/ld-mips-elf/no-shared-1-n32.d b/ld/testsuite/ld-mips-elf/no-shared-1-n32.d
new file mode 100644
index 0000000..a28b22e
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/no-shared-1-n32.d
@@ -0,0 +1,25 @@
+#as: -mabi=n32 -EB
+#source: no-shared-1-o32.s
+#ld: -melf32btsmipn32 -T no-shared-1.ld
+#objdump: -dr -j.text -j.data -j.got
+
+.*
+
+
+Disassembly of section \.text:
+
+00050000 <__start>:
+ 50000: 3c020007 lui v0,0x7
+ 50004: 24428000 addiu v0,v0,-32768
+ 50008: 8f828018 lw v0,-32744\(gp\)
+ 5000c: 8f828018 lw v0,-32744\(gp\)
+#...
+Disassembly of section \.data:
+
+00060000 <\.data>:
+ 60000: 00068000 .*
+#...
+Disassembly of section \.got:
+
+00060010 <_GLOBAL_OFFSET_TABLE_>:
+ 60010: 00000000 80000000 00068000 .*
diff --git a/ld/testsuite/ld-mips-elf/no-shared-1-n64.d b/ld/testsuite/ld-mips-elf/no-shared-1-n64.d
new file mode 100644
index 0000000..ea74ebb
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/no-shared-1-n64.d
@@ -0,0 +1,26 @@
+#as: -mabi=64 -EB
+#ld: -melf64btsmip -T no-shared-1.ld
+#objdump: -dr -j.text -j.data -j.got
+
+.*
+
+
+Disassembly of section \.text:
+
+0000000000050000 <__start>:
+ 50000: 3c020007 lui v0,0x7
+ 50004: 64428000 daddiu v0,v0,-32768
+ 50008: df828020 ld v0,-32736\(gp\)
+ 5000c: df828020 ld v0,-32736\(gp\)
+#...
+Disassembly of section \.data:
+
+0000000000060000 <\.data>:
+ 60000: 00000000 .*
+ 60004: 00068000 .*
+#...
+Disassembly of section \.got:
+
+0000000000060010 <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
+ 60018: 80000000 00000000 00000000 00068000 .*
diff --git a/ld/testsuite/ld-mips-elf/no-shared-1-n64.s b/ld/testsuite/ld-mips-elf/no-shared-1-n64.s
new file mode 100644
index 0000000..8eedf12
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/no-shared-1-n64.s
@@ -0,0 +1,13 @@
+ .abicalls
+ .text
+ .globl __start
+ .ent __start
+__start:
+ lui $2,%hi(__gnu_local_gp)
+ daddiu $2,$2,%lo(__gnu_local_gp)
+ ld $2,%got(__gnu_local_gp)($gp)
+ ld $2,%call16(__gnu_local_gp)($gp)
+ .end __start
+
+ .data
+ .8byte __gnu_local_gp
diff --git a/ld/testsuite/ld-mips-elf/no-shared-1-o32.d b/ld/testsuite/ld-mips-elf/no-shared-1-o32.d
new file mode 100644
index 0000000..b67737f
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/no-shared-1-o32.d
@@ -0,0 +1,24 @@
+#as: -mabi=32 -EB
+#ld: -melf32btsmip -T no-shared-1.ld
+#objdump: -dr -j.text -j.data -j.got
+
+.*
+
+
+Disassembly of section \.text:
+
+00050000 <__start>:
+ 50000: 3c020007 lui v0,0x7
+ 50004: 24428000 addiu v0,v0,-32768
+ 50008: 8f828018 lw v0,-32744\(gp\)
+ 5000c: 8f828018 lw v0,-32744\(gp\)
+#...
+Disassembly of section \.data:
+
+00060000 <\.data>:
+ 60000: 00068000 .*
+#...
+Disassembly of section \.got:
+
+00060010 <_GLOBAL_OFFSET_TABLE_>:
+ 60010: 00000000 80000000 00068000 .*
diff --git a/ld/testsuite/ld-mips-elf/no-shared-1-o32.s b/ld/testsuite/ld-mips-elf/no-shared-1-o32.s
new file mode 100644
index 0000000..f00fc4b
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/no-shared-1-o32.s
@@ -0,0 +1,13 @@
+ .abicalls
+ .text
+ .globl __start
+ .ent __start
+__start:
+ lui $2,%hi(__gnu_local_gp)
+ addiu $2,$2,%lo(__gnu_local_gp)
+ lw $2,%got(__gnu_local_gp)($gp)
+ lw $2,%call16(__gnu_local_gp)($gp)
+ .end __start
+
+ .data
+ .4byte __gnu_local_gp
diff --git a/ld/testsuite/ld-mips-elf/no-shared-1.ld b/ld/testsuite/ld-mips-elf/no-shared-1.ld
new file mode 100644
index 0000000..06d28a6
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/no-shared-1.ld
@@ -0,0 +1,11 @@
+SECTIONS
+{
+ . = 0x50000;
+ .text : { *(.text) }
+ .MIPS.stubs : { *(.MIPS.stubs) }
+
+ . = 0x60000;
+ .data : { *(.data) }
+ _gp = ALIGN (16) + 0x7ff0;
+ .got : { *(.got) }
+}