aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2010-02-11 19:57:40 +0000
committerDavid S. Miller <davem@redhat.com>2010-02-11 19:57:40 +0000
commit00c5099111744132fa72c773faf4df4a6dad1fb9 (patch)
treebfb6f183da74d795cce5f259eb00d559e40ea3fa /ld/testsuite/ld-sparc
parent6fa78d941bfeeaabea9a746a6588831b63daf0ec (diff)
downloadgdb-00c5099111744132fa72c773faf4df4a6dad1fb9.zip
gdb-00c5099111744132fa72c773faf4df4a6dad1fb9.tar.gz
gdb-00c5099111744132fa72c773faf4df4a6dad1fb9.tar.bz2
bfd/
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): For R_SPARC_GOTDATA_OP_HIX22 and R_SPARC_GOTDATA_OP_LOX10, only bump the GOT refcount for global symbols. (_bfd_sparc_elf_gc_sweep_hook): Likewise only decrement the GOT count for these relocs on global symbols. (gdopoff): New. (_bfd_sparc_elf_relocate_section): Perform GOTDATA optimizations on local symbol references which are not STT_GNU_IFUNC. Handle relocation of them like R_SPARC_HIX22 and R_SPARC_LOX10 respectively, and deal with negative vs. non-negative values properly. ld/testsuite * ld-sparc/gotop32.s: Add local symbol case. * ld-sparc/gotop64.s: Likewise. * ld-sparc/gotop32.rd: Adjust expected results. * ld-sparc/gotop32.td: Likewise. * ld-sparc/gotop64.dd: Likewise. * ld-sparc/gotop64.rd: Likewise. * ld-sparc/gotop64.td: Likewise.
Diffstat (limited to 'ld/testsuite/ld-sparc')
-rw-r--r--ld/testsuite/ld-sparc/gotop32.dd12
-rw-r--r--ld/testsuite/ld-sparc/gotop32.rd1
-rw-r--r--ld/testsuite/ld-sparc/gotop32.s9
-rw-r--r--ld/testsuite/ld-sparc/gotop32.td2
-rw-r--r--ld/testsuite/ld-sparc/gotop64.dd12
-rw-r--r--ld/testsuite/ld-sparc/gotop64.rd1
-rw-r--r--ld/testsuite/ld-sparc/gotop64.s9
-rw-r--r--ld/testsuite/ld-sparc/gotop64.td2
8 files changed, 40 insertions, 8 deletions
diff --git a/ld/testsuite/ld-sparc/gotop32.dd b/ld/testsuite/ld-sparc/gotop32.dd
index 9f6b1f6..a599930 100644
--- a/ld/testsuite/ld-sparc/gotop32.dd
+++ b/ld/testsuite/ld-sparc/gotop32.dd
@@ -17,12 +17,18 @@ Disassembly of section .text:
+1010: 7f ff ff fc call 1000 <_.*>
+1014: ae 05 e0 60 add %l7, 0x60, %l7 ! 11060 <.*>
+1018: 01 00 00 00 nop *
- +101c: 23 00 00 04 sethi %hi\(0x1000\), %l1
+ +101c: 23 00 00 00 sethi %hi\(0\), %l1
+1020: 01 00 00 00 nop *
+1024: a2 1c 60 04 xor %l1, 4, %l1
+1028: 01 00 00 00 nop *
+102c: f0 05 c0 11 ld \[ %l7 \+ %l1 \], %i0
+1030: 01 00 00 00 nop *
- +1034: 81 c7 e0 08 ret
- +1038: 81 e8 00 00 restore
+ +1034: 23 00 00 03 sethi %hi\(0xc00\), %l1
+ +1038: 01 00 00 00 nop
+ +103c: a2 1c 63 94 xor %l1, 0x394, %l1
+ +1040: 01 00 00 00 nop
+ +1044: b0 05 c0 11 add %l7, %l1, %i0
+ +1048: 01 00 00 00 nop
+ +104c: 81 c7 e0 08 ret
+ +1050: 81 e8 00 00 restore
#pass
diff --git a/ld/testsuite/ld-sparc/gotop32.rd b/ld/testsuite/ld-sparc/gotop32.rd
index 566066c..1cecad8 100644
--- a/ld/testsuite/ld-sparc/gotop32.rd
+++ b/ld/testsuite/ld-sparc/gotop32.rd
@@ -59,6 +59,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* SECTION +LOCAL +DEFAULT +6 *
.* SECTION +LOCAL +DEFAULT +7 *
.* SECTION +LOCAL +DEFAULT +8 *
+.* NOTYPE +LOCAL +DEFAULT +8 local_sym
.* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
.* OBJECT +LOCAL +DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
.* OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
diff --git a/ld/testsuite/ld-sparc/gotop32.s b/ld/testsuite/ld-sparc/gotop32.s
index ac01d6f..604694c 100644
--- a/ld/testsuite/ld-sparc/gotop32.s
+++ b/ld/testsuite/ld-sparc/gotop32.s
@@ -3,6 +3,9 @@
.globl sym
sym: .word 0x12345678
+local_sym:
+ .word 0xdeadbeef
+
.text
.align 4096
.LLGETPC0:
@@ -24,5 +27,11 @@ foo:
nop
ld [%l7 + %l1], %i0, %gdop(sym)
nop
+ sethi %gdop_hix22(local_sym), %l1
+ nop
+ xor %l1, %gdop_lox10(local_sym), %l1
+ nop
+ ld [%l7 + %l1], %i0, %gdop(local_sym)
+ nop
ret
restore
diff --git a/ld/testsuite/ld-sparc/gotop32.td b/ld/testsuite/ld-sparc/gotop32.td
index e73482d..520788b 100644
--- a/ld/testsuite/ld-sparc/gotop32.td
+++ b/ld/testsuite/ld-sparc/gotop32.td
@@ -7,6 +7,6 @@
.*: +file format elf32-sparc
Contents of section .data:
- 13000 12345678 00000000 00000000 00000000 .*
+ 13000 12345678 deadbeef 00000000 00000000 .*
13010 00000000 00000000 00000000 00000000 .*
#pass
diff --git a/ld/testsuite/ld-sparc/gotop64.dd b/ld/testsuite/ld-sparc/gotop64.dd
index a78f55a..d73fb18 100644
--- a/ld/testsuite/ld-sparc/gotop64.dd
+++ b/ld/testsuite/ld-sparc/gotop64.dd
@@ -17,12 +17,18 @@ Disassembly of section .text:
+1010: 7f ff ff fc call 1000 <_.*>
+1014: ae 05 e0 d0 add %l7, 0xd0, %l7 ! 1010d0 <.*>
+1018: 01 00 00 00 nop *
- +101c: 23 00 00 08 sethi %hi\(0x2000\), %l1
+ +101c: 23 00 00 00 sethi %hi\(0\), %l1
+1020: 01 00 00 00 nop *
+1024: a2 1c 60 08 xor %l1, 8, %l1
+1028: 01 00 00 00 nop *
+102c: f0 5d c0 11 ldx \[ %l7 \+ %l1 \], %i0
+1030: 01 00 00 00 nop *
- +1034: 81 c7 e0 08 ret
- +1038: 81 e8 00 00 restore
+ +1034: 23 00 00 03 sethi %hi\(0xc00\), %l1
+ +1038: 01 00 00 00 nop *
+ +103c: a2 1c 63 24 xor %l1, 0x324, %l1
+ +1040: 01 00 00 00 nop *
+ +1044: b0 05 c0 11 add %l7, %l1, %i0
+ +1048: 01 00 00 00 nop *
+ +104c: 81 c7 e0 08 ret
+ +1050: 81 e8 00 00 restore
#pass
diff --git a/ld/testsuite/ld-sparc/gotop64.rd b/ld/testsuite/ld-sparc/gotop64.rd
index 4d3e519..509c8f8 100644
--- a/ld/testsuite/ld-sparc/gotop64.rd
+++ b/ld/testsuite/ld-sparc/gotop64.rd
@@ -59,6 +59,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* SECTION +LOCAL +DEFAULT +6 *
.* SECTION +LOCAL +DEFAULT +7 *
.* SECTION +LOCAL +DEFAULT +8 *
+.* NOTYPE +LOCAL +DEFAULT +8 local_sym
.* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
.* OBJECT +LOCAL +DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
.* OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
diff --git a/ld/testsuite/ld-sparc/gotop64.s b/ld/testsuite/ld-sparc/gotop64.s
index 8a8ff82..9910813 100644
--- a/ld/testsuite/ld-sparc/gotop64.s
+++ b/ld/testsuite/ld-sparc/gotop64.s
@@ -3,6 +3,9 @@
.globl sym
sym: .word 0x12345678
+local_sym:
+ .word 0xdeadbeef
+
.text
.align 4096
.LLGETPC0:
@@ -24,5 +27,11 @@ foo:
nop
ldx [%l7 + %l1], %i0, %gdop(sym)
nop
+ sethi %gdop_hix22(local_sym), %l1
+ nop
+ xor %l1, %gdop_lox10(local_sym), %l1
+ nop
+ ldx [%l7 + %l1], %i0, %gdop(local_sym)
+ nop
ret
restore
diff --git a/ld/testsuite/ld-sparc/gotop64.td b/ld/testsuite/ld-sparc/gotop64.td
index f16cf50..28d40ed 100644
--- a/ld/testsuite/ld-sparc/gotop64.td
+++ b/ld/testsuite/ld-sparc/gotop64.td
@@ -7,6 +7,6 @@
.*: +file format elf64-sparc
Contents of section .data:
- 103000 12345678 00000000 00000000 00000000 .*
+ 103000 12345678 deadbeef 00000000 00000000 .*
103010 00000000 00000000 00000000 00000000 .*
#pass