aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog14
-rw-r--r--ld/testsuite/ld-sparc/gotop32.dd28
-rw-r--r--ld/testsuite/ld-sparc/gotop32.rd70
-rw-r--r--ld/testsuite/ld-sparc/gotop32.s28
-rw-r--r--ld/testsuite/ld-sparc/gotop32.sd10
-rw-r--r--ld/testsuite/ld-sparc/gotop32.td12
-rw-r--r--ld/testsuite/ld-sparc/gotop64.dd28
-rw-r--r--ld/testsuite/ld-sparc/gotop64.rd70
-rw-r--r--ld/testsuite/ld-sparc/gotop64.s28
-rw-r--r--ld/testsuite/ld-sparc/gotop64.sd10
-rw-r--r--ld/testsuite/ld-sparc/gotop64.td12
-rw-r--r--ld/testsuite/ld-sparc/sparc.exp10
12 files changed, 320 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index f199728..627d933 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2008-04-16 David S. Miller <davem@davemloft.net>
+
+ * ld-sparc/gotop32.dd: New.
+ * ld-sparc/gotop32.rd: Likewise.
+ * ld-sparc/gotop32.s: Likewise.
+ * ld-sparc/gotop32.sd: Likewise.
+ * ld-sparc/gotop32.td: Likewise.
+ * ld-sparc/gotop64.dd: Likewise.
+ * ld-sparc/gotop64.rd: Likewise.
+ * ld-sparc/gotop64.s: Likewise.
+ * ld-sparc/gotop64.sd: Likewise.
+ * ld-sparc/gotop64.td: Likewise.
+ * ld-sparc/sparc.exp: Run new gotdata tests.
+
2008-04-15 Andrew Stubbs <andrew.stubbs@st.com>
* ld-sh/arch/sh-dsp.s: Regenerate.
diff --git a/ld/testsuite/ld-sparc/gotop32.dd b/ld/testsuite/ld-sparc/gotop32.dd
new file mode 100644
index 0000000..9f6b1f6
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.dd
@@ -0,0 +1,28 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#objdump: -drj.text
+#target: sparc*-*-*
+
+.*: +file format elf32-sparc
+
+Disassembly of section .text:
+00001000 <foo-0x8>:
+ +1000: 81 c3 e0 08 retl *
+ +1004: ae 03 c0 17 add %o7, %l7, %l7
+
+00001008 <foo>:
+ +1008: 9d e3 bf 98 save %sp, -104, %sp
+ +100c: 2f 00 00 44 sethi %hi\(0x11000\), %l7
+ +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
+ +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
+#pass
diff --git a/ld/testsuite/ld-sparc/gotop32.rd b/ld/testsuite/ld-sparc/gotop32.rd
new file mode 100644
index 0000000..e4b4295
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.rd
@@ -0,0 +1,70 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#readelf: -WSsrl
+#target: sparc*-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+1000 0+ +AX +0 +0 4096
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+12000 0+2000 0+70 08 +WA +3 +0 +4
+ +\[[ 0-9]+\] .got +PROGBITS +0+12070 0+2070 0+8 04 +WA +0 +0 +4
+ +\[[ 0-9]+\] .data +PROGBITS +0+13000 0+3000 0+1000 00 +WA +0 +0 4096
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+#...
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x10000
+ +LOAD +0x0+2000 0x0+12000 0x0+12000 0x0+2000 0x0+2000 RW +0x10000
+ +DYNAMIC +0x0+2000 0x0+12000 0x0+12000 0x0+70 0x0+70 RW +0x4
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
+[0-9a-f ]+R_SPARC_GLOB_DAT +0+13000 +sym \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +1 *
+.* SECTION LOCAL +DEFAULT +2 *
+.* SECTION LOCAL +DEFAULT +3 *
+.* SECTION LOCAL +DEFAULT +4 *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +6 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* SECTION LOCAL +DEFAULT +8 *
+.* OBJECT +LOCAL +HIDDEN +ABS _DYNAMIC
+.* OBJECT +LOCAL +HIDDEN +ABS _PROCEDURE_LINKAGE_TABLE_
+.* OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
diff --git a/ld/testsuite/ld-sparc/gotop32.s b/ld/testsuite/ld-sparc/gotop32.s
new file mode 100644
index 0000000..ac01d6f
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.s
@@ -0,0 +1,28 @@
+ .data
+ .align 4096
+ .globl sym
+sym: .word 0x12345678
+
+ .text
+ .align 4096
+.LLGETPC0:
+ retl
+ add %o7, %l7, %l7
+
+ .globl foo
+ .type foo,#function
+ .proc 04
+foo:
+ save %sp, -104, %sp
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+ call .LLGETPC0
+ add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+ nop
+ sethi %gdop_hix22(sym), %l1
+ nop
+ xor %l1, %gdop_lox10(sym), %l1
+ nop
+ ld [%l7 + %l1], %i0, %gdop(sym)
+ nop
+ ret
+ restore
diff --git a/ld/testsuite/ld-sparc/gotop32.sd b/ld/testsuite/ld-sparc/gotop32.sd
new file mode 100644
index 0000000..fc16756
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.sd
@@ -0,0 +1,10 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#objdump: -sj.got
+#target: sparc*-*-*
+
+.*: +file format elf32-sparc
+
+Contents of section .got:
+ 12070 00012000 00000000 .*
diff --git a/ld/testsuite/ld-sparc/gotop32.td b/ld/testsuite/ld-sparc/gotop32.td
new file mode 100644
index 0000000..e73482d
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.td
@@ -0,0 +1,12 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#objdump: -sj.data
+#target: sparc*-*-*
+
+.*: +file format elf32-sparc
+
+Contents of section .data:
+ 13000 12345678 00000000 00000000 00000000 .*
+ 13010 00000000 00000000 00000000 00000000 .*
+#pass
diff --git a/ld/testsuite/ld-sparc/gotop64.dd b/ld/testsuite/ld-sparc/gotop64.dd
new file mode 100644
index 0000000..a78f55a
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.dd
@@ -0,0 +1,28 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#objdump: -drj.text
+#target: sparc*-*-*
+
+.*: +file format elf64-sparc
+
+Disassembly of section .text:
+0000000000001000 <foo-0x8>:
+ +1000: 81 c3 e0 08 retl *
+ +1004: ae 03 c0 17 add %o7, %l7, %l7
+
+0000000000001008 <foo>:
+ +1008: 9d e3 bf 60 save %sp, -160, %sp
+ +100c: 2f 00 04 04 sethi %hi\(0x101000\), %l7
+ +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
+ +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
+#pass
diff --git a/ld/testsuite/ld-sparc/gotop64.rd b/ld/testsuite/ld-sparc/gotop64.rd
new file mode 100644
index 0000000..24cf94f
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.rd
@@ -0,0 +1,70 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#readelf: -WSsrl
+#target: sparc*-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+1000 0+ +AX +0 +0 4096
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+102000 0+2000 0+e0 10 +WA +3 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+1020e0 0+20e0 0+10 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .data +PROGBITS +0+103000 0+3000 0+1000 00 +WA +0 +0 4096
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+#...
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x100000
+ +LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+2000 0x0+2000 RW +0x100000
+ +DYNAMIC +0x0+2000 0x0+102000 0x0+102000 0x0+e0 0x0+e0 RW +0x8
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f ]+R_SPARC_GLOB_DAT +0+103000 +sym \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +1 *
+.* SECTION LOCAL +DEFAULT +2 *
+.* SECTION LOCAL +DEFAULT +3 *
+.* SECTION LOCAL +DEFAULT +4 *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +6 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* SECTION LOCAL +DEFAULT +8 *
+.* OBJECT +LOCAL +HIDDEN +ABS _DYNAMIC
+.* OBJECT +LOCAL +HIDDEN +ABS _PROCEDURE_LINKAGE_TABLE_
+.* OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
diff --git a/ld/testsuite/ld-sparc/gotop64.s b/ld/testsuite/ld-sparc/gotop64.s
new file mode 100644
index 0000000..8a8ff82
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.s
@@ -0,0 +1,28 @@
+ .data
+ .align 4096
+ .globl sym
+sym: .word 0x12345678
+
+ .text
+ .align 4096
+.LLGETPC0:
+ retl
+ add %o7, %l7, %l7
+
+ .globl foo
+ .type foo,#function
+ .proc 04
+foo:
+ save %sp, -160, %sp
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+ call .LLGETPC0
+ add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+ nop
+ sethi %gdop_hix22(sym), %l1
+ nop
+ xor %l1, %gdop_lox10(sym), %l1
+ nop
+ ldx [%l7 + %l1], %i0, %gdop(sym)
+ nop
+ ret
+ restore
diff --git a/ld/testsuite/ld-sparc/gotop64.sd b/ld/testsuite/ld-sparc/gotop64.sd
new file mode 100644
index 0000000..9ab0f61
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.sd
@@ -0,0 +1,10 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#objdump: -sj.got
+#target: sparc*-*-*
+
+.*: +file format elf64-sparc
+
+Contents of section .got:
+ 1020e0 00000000 00102000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-sparc/gotop64.td b/ld/testsuite/ld-sparc/gotop64.td
new file mode 100644
index 0000000..f16cf50
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.td
@@ -0,0 +1,12 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#objdump: -sj.data
+#target: sparc*-*-*
+
+.*: +file format elf64-sparc
+
+Contents of section .data:
+ 103000 12345678 00000000 00000000 00000000 .*
+ 103010 00000000 00000000 00000000 00000000 .*
+#pass
diff --git a/ld/testsuite/ld-sparc/sparc.exp b/ld/testsuite/ld-sparc/sparc.exp
index d54c311..e41dfe5 100644
--- a/ld/testsuite/ld-sparc/sparc.exp
+++ b/ld/testsuite/ld-sparc/sparc.exp
@@ -89,6 +89,11 @@ set sparctests {
{"32-bit: TLS in debug sections" "-melf32_sparc"
"--32" {tlsg32.s}
{{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
+ {"32-bit: GOTDATA relocations" "-shared -melf32_sparc"
+ "--32 -K PIC" {gotop32.s}
+ {{readelf -WSsrl gotop32.rd} {objdump -drj.text gotop32.dd}
+ {objdump -sj.got gotop32.sd} {objdump -sj.data gotop32.td}}
+ "libgotop32.so"}
}
set sparc64tests {
{"64-bit: TLS -fpic -shared transitions" "-shared -melf64_sparc"
@@ -113,6 +118,11 @@ set sparc64tests {
{"64-bit: TLS in debug sections" "-melf64_sparc"
"--64 -Av9" {tlsg64.s}
{{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
+ {"64-bit: GOTDATA relocations" "-shared -melf64_sparc"
+ "--64 -K PIC" {gotop64.s}
+ {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd}
+ {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}}
+ "libgotop64.so"}
}
if { ![istarget "sparc64-*-elf*"] } {