aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2008-03-20 10:53:11 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2008-03-20 10:53:11 +0000
commitccb4c9519b8b4528411a85b654af60c7dd598894 (patch)
treeaa0b1ca991bdaa02f5f3cb701bf727f7cc697d70 /ld
parent51e38d68782784e67211a66c5408d1c1943f1aa9 (diff)
downloadbinutils-ccb4c9519b8b4528411a85b654af60c7dd598894.zip
binutils-ccb4c9519b8b4528411a85b654af60c7dd598894.tar.gz
binutils-ccb4c9519b8b4528411a85b654af60c7dd598894.tar.bz2
binutils/
* readelf.c (print_mips_got_entry): New function. (process_mips_specific): Print GOT information. ld/testsuite/ * ld-mips-elf/got-dump-1.d, ld-mips-elf/got-dump-1.s, ld-mips-elf/got-dump-1.ld, ld-mips-elf/got-dump-2.d, ld-mips-elf/got-dump-2.s, ld-mips-elf/got-dump-2.ld: New tests. * ld-mips-elf/mips-elf.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-mips-elf/got-dump-1.d25
-rw-r--r--ld/testsuite/ld-mips-elf/got-dump-1.ld19
-rw-r--r--ld/testsuite/ld-mips-elf/got-dump-1.s22
-rw-r--r--ld/testsuite/ld-mips-elf/got-dump-2.d25
-rw-r--r--ld/testsuite/ld-mips-elf/got-dump-2.ld18
-rw-r--r--ld/testsuite/ld-mips-elf/got-dump-2.s22
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp4
8 files changed, 142 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 2068cb9..92a4488 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2008-03-20 Richard Sandiford <rsandifo@nildram.co.uk>
+ * ld-mips-elf/got-dump-1.d, ld-mips-elf/got-dump-1.s,
+ ld-mips-elf/got-dump-1.ld, ld-mips-elf/got-dump-2.d,
+ ld-mips-elf/got-dump-2.s, ld-mips-elf/got-dump-2.ld: New tests.
+ * ld-mips-elf/mips-elf.exp: Run them.
+
+2008-03-20 Richard Sandiford <rsandifo@nildram.co.uk>
+
* ld-mips-elf/elf-rel-got-n64-linux.d: Expect bit 63 rather than
bit 31 of the second GOT entry to be set.
* ld-mips-elf/elf-rel-got-n64.d: Likewise.
diff --git a/ld/testsuite/ld-mips-elf/got-dump-1.d b/ld/testsuite/ld-mips-elf/got-dump-1.d
new file mode 100644
index 0000000..eaf9c6b
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/got-dump-1.d
@@ -0,0 +1,25 @@
+#name: GOT dump (readelf -A) test 1
+#source: got-dump-1.s
+#as: -mips3
+#ld: -Tgot-dump-1.ld -shared
+#readelf: -A
+
+Primary GOT:
+ Canonical gp value: 00068000
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 00060010 -32752\(gp\) 00000000 Lazy resolver
+ 00060014 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+ Address Access Initial
+ 00060018 -32744\(gp\) 00060000
+ 0006001c -32740\(gp\) 00060004
+
+ Global entries:
+ Address Access Initial Sym.Val. Type Ndx Name
+ 00060020 -32736\(gp\) 00050020 00050020 FUNC UND extern
+ 00060024 -32732\(gp\) 00000000 00000000 NOTYPE UND undef
+ 00060028 -32728\(gp\) 00050000 00050000 FUNC 7 glob
+
diff --git a/ld/testsuite/ld-mips-elf/got-dump-1.ld b/ld/testsuite/ld-mips-elf/got-dump-1.ld
new file mode 100644
index 0000000..4fe5c1a
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/got-dump-1.ld
@@ -0,0 +1,19 @@
+SECTIONS
+{
+ . = 0x40000;
+ .reginfo : { *(.reginfo) }
+ .dynamic : { *(.dynamic) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.dyn : { *(.rel.dyn) }
+
+ . = 0x50000;
+ .text : { *(.text) }
+ .MIPS.stubs : { *(.MIPS.stubs) }
+
+ . = 0x60000;
+ .data : { *(.data) }
+ _gp = ALIGN (16) + 0x7ff0;
+ .got : { *(.got) }
+}
diff --git a/ld/testsuite/ld-mips-elf/got-dump-1.s b/ld/testsuite/ld-mips-elf/got-dump-1.s
new file mode 100644
index 0000000..d6c318e
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/got-dump-1.s
@@ -0,0 +1,22 @@
+ .global glob
+ .ent glob
+glob:
+ lw $4,%got(local)($28)
+ addiu $4,$4,%lo(local)
+ lw $4,%got(hidden)($28)
+ lw $4,%call16(glob)($28)
+ lw $4,%call16(extern)($28)
+ .end glob
+
+ .data
+ .type local,%object
+ .size local,4
+local:
+ .word undef
+
+ .globl hidden
+ .hidden hidden
+ .type hidden,%object
+ .size hidden,4
+hidden:
+ .word 0
diff --git a/ld/testsuite/ld-mips-elf/got-dump-2.d b/ld/testsuite/ld-mips-elf/got-dump-2.d
new file mode 100644
index 0000000..1e656f0
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/got-dump-2.d
@@ -0,0 +1,25 @@
+#name: GOT dump (readelf -A) test 2
+#source: got-dump-2.s
+#as: -mips3 -EB -64
+#ld: -Tgot-dump-2.ld -shared -melf64btsmip
+#readelf: -A
+
+Primary GOT:
+ Canonical gp value: 0001236000008000
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 0001236000000010 -32752\(gp\) 0000000000000000 Lazy resolver
+ 0001236000000018 -32744\(gp\) 8000000000000000 Module pointer \(GNU extension\)
+
+ Local entries:
+ Address Access Initial
+ 0001236000000020 -32736\(gp\) 0001236000000000
+ 0001236000000028 -32728\(gp\) 0001236000000008
+
+ Global entries:
+ Address Access Initial Sym.Val. Type Ndx Name
+ 0001236000000030 -32720\(gp\) 0001235000000020 0001235000000020 FUNC UND extern
+ 0001236000000038 -32712\(gp\) 0000000000000000 0000000000000000 NOTYPE UND undef
+ 0001236000000040 -32704\(gp\) 0001235000000000 0001235000000000 FUNC 7 glob
+
diff --git a/ld/testsuite/ld-mips-elf/got-dump-2.ld b/ld/testsuite/ld-mips-elf/got-dump-2.ld
new file mode 100644
index 0000000..cab0f4b
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/got-dump-2.ld
@@ -0,0 +1,18 @@
+SECTIONS
+{
+ . = 0x1234000000000;
+ .dynamic : { *(.dynamic) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.dyn : { *(.rel.dyn) }
+
+ . = 0x1235000000000;
+ .text : { *(.text) }
+ .MIPS.stubs : { *(.MIPS.stubs) }
+
+ . = 0x1236000000000;
+ .data : { *(.data) }
+ _gp = ALIGN (16) + 0x7ff0;
+ .got : { *(.got) }
+}
diff --git a/ld/testsuite/ld-mips-elf/got-dump-2.s b/ld/testsuite/ld-mips-elf/got-dump-2.s
new file mode 100644
index 0000000..5a237fe
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/got-dump-2.s
@@ -0,0 +1,22 @@
+ .global glob
+ .ent glob
+glob:
+ ld $4,%got_page(local)($28)
+ daddiu $4,$4,%got_ofst(local)
+ ld $4,%got_disp(hidden)($28)
+ ld $4,%call16(glob)($28)
+ ld $4,%call16(extern)($28)
+ .end glob
+
+ .data
+ .type local,%object
+ .size local,8
+local:
+ .dword undef
+
+ .globl hidden
+ .hidden hidden
+ .type hidden,%object
+ .size hidden,8
+hidden:
+ .dword 0
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 404ee2a..96e42a9 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -156,6 +156,10 @@ if { $linux_gnu } {
run_dump_test "got-page-2"
}
run_dump_test "got-page-3"
+ run_dump_test "got-dump-1"
+ if $has_newabi {
+ run_dump_test "got-dump-2"
+ }
}
if $has_newabi {