summaryrefslogtreecommitdiffstats
path: root/ld/testsuite/ld-sh
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2001-10-14 15:18:11 +0000
committerHans-Peter Nilsson <hp@axis.com>2001-10-14 15:18:11 +0000
commit7739e068a7ea8b3668c2e37702b80aff02f19662 (patch)
tree86a2e74da2c5fe4672077d086979869ec31ca984 /ld/testsuite/ld-sh
parentc987d8c09dafb9cb2c1b37c3aface3494c2e1717 (diff)
downloadppe42-binutils-7739e068a7ea8b3668c2e37702b80aff02f19662.tar.gz
ppe42-binutils-7739e068a7ea8b3668c2e37702b80aff02f19662.zip
* ld-sh/rd-sh.exp: New framework file.
* ld-sh/ld-r-1.d, ld-sh/ldr1.s, ld-sh/ldr2.s, ld-sh/shared-1.d, ld-sh/weak1.s, ld-sh/weak1.d, ld-sh/sub2l.s, ld-sh/sub2l-1.d: New test files.
Diffstat (limited to 'ld/testsuite/ld-sh')
-rw-r--r--ld/testsuite/ld-sh/ld-r-1.d22
-rw-r--r--ld/testsuite/ld-sh/ldr1.s5
-rw-r--r--ld/testsuite/ld-sh/ldr2.s3
-rw-r--r--ld/testsuite/ld-sh/rd-sh.exp36
-rw-r--r--ld/testsuite/ld-sh/shared-1.d22
-rw-r--r--ld/testsuite/ld-sh/sub2l-1.d23
-rw-r--r--ld/testsuite/ld-sh/sub2l.s26
-rw-r--r--ld/testsuite/ld-sh/weak1.d20
-rw-r--r--ld/testsuite/ld-sh/weak1.s19
9 files changed, 176 insertions, 0 deletions
diff --git a/ld/testsuite/ld-sh/ld-r-1.d b/ld/testsuite/ld-sh/ld-r-1.d
new file mode 100644
index 0000000000..51c55a011c
--- /dev/null
+++ b/ld/testsuite/ld-sh/ld-r-1.d
@@ -0,0 +1,22 @@
+#source: ldr1.s
+#source: ldr2.s
+#as: -little
+#ld: -r -EL
+#readelf: -r -x1 -x2
+#target: sh*-*-elf sh*-*-linux*
+
+# Make sure relocations against global and local symbols with relative and
+# absolute 32-bit relocs don't come out wrong after ld -r. Remember that
+# SH uses partial_inplace (sort-of REL within RELA) with its confusion
+# where and which addends to use and how. A file linked -r must have the
+# same layout as a plain assembly file: the addend is in the data only.
+
+Relocation section '\.rela\.text' at offset 0x1b8 contains 1 entries:
+ Offset Info Type Symbol's Value Symbol's Name Addend
+00000008 00000101 R_SH_DIR32 00000000 \.text \+ 0
+
+Hex dump of section '\.text':
+ 0x00000000 0000000c 00090009 00090009 .*
+
+Hex dump of section '\.rela\.text':
+ 0x00000000 00000000 00000101 00000008 .*
diff --git a/ld/testsuite/ld-sh/ldr1.s b/ld/testsuite/ld-sh/ldr1.s
new file mode 100644
index 0000000000..9f493891d7
--- /dev/null
+++ b/ld/testsuite/ld-sh/ldr1.s
@@ -0,0 +1,5 @@
+ .text
+ nop
+ nop
+ nop
+ nop
diff --git a/ld/testsuite/ld-sh/ldr2.s b/ld/testsuite/ld-sh/ldr2.s
new file mode 100644
index 0000000000..94e06585d9
--- /dev/null
+++ b/ld/testsuite/ld-sh/ldr2.s
@@ -0,0 +1,3 @@
+ .text
+ .long bar
+bar:
diff --git a/ld/testsuite/ld-sh/rd-sh.exp b/ld/testsuite/ld-sh/rd-sh.exp
new file mode 100644
index 0000000000..5bc9a0c575
--- /dev/null
+++ b/ld/testsuite/ld-sh/rd-sh.exp
@@ -0,0 +1,36 @@
+# Expect script for run_dump_test based ld-sh tests.
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Written by Hans-Peter Nilsson (hp@bitrange.com)
+#
+
+# This file is kept separate from sh.exp, because having it separate
+# simplifies selective testing, like in "make check-ld
+# RUNTESTFLAGS=rd-sh.exp=shared-1". It is assumed that sh.exp is a place
+# for constructs where the name of the test is harder to extract and
+# select than here.
+
+if ![istarget sh*-*-*] {
+ return
+}
+
+set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach shtest $rd_test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $shtest]
+ run_dump_test [file rootname $shtest]
+}
diff --git a/ld/testsuite/ld-sh/shared-1.d b/ld/testsuite/ld-sh/shared-1.d
new file mode 100644
index 0000000000..af5494bdeb
--- /dev/null
+++ b/ld/testsuite/ld-sh/shared-1.d
@@ -0,0 +1,22 @@
+#source: ldr1.s
+#source: ldr2.s
+#as: -little
+#ld: -shared -EL
+#readelf: -r -x4 -x5
+#target: sh*-*-elf sh*-*-linux*
+
+# Make sure relocations against global and local symbols with relative and
+# absolute 32-bit relocs don't come out wrong after ld -r. Remember that
+# SH uses partial_inplace (sort-of REL within RELA) with related confusion
+# about how, when, where and which addends to use. A DSO must have the
+# same value in the addend as in the data, so either can be used.
+
+Relocation section '\.rela\.text' at offset 0x32c contains 1 entries:
+ Offset Info Type Symbol's Value Symbol's Name Addend
+00000340 000000a5 R_SH_RELATIVE 00000344
+
+Hex dump of section '\.rela\.text':
+ 0x0000032c 00000344 000000a5 00000340 .*
+
+Hex dump of section '\.text':
+ 0x00000338 00000344 00090009 00090009 .*
diff --git a/ld/testsuite/ld-sh/sub2l-1.d b/ld/testsuite/ld-sh/sub2l-1.d
new file mode 100644
index 0000000000..87c7ca16e3
--- /dev/null
+++ b/ld/testsuite/ld-sh/sub2l-1.d
@@ -0,0 +1,23 @@
+#source: sub2l.s
+#as: -little
+#ld: -EL -e 0x1000
+#objdump: -st
+
+
+.*/dump: file format elf32-shl
+
+SYMBOL TABLE:
+#...
+0+1000 l .text 00000000 f
+0+1002 l .text 00000000 f2
+0+1028 l .text 00000000 L
+0+1020 g .text 00000000 ff
+#...
+
+Contents of section \.text:
+ 1000 0b000900 09000900 09000900 09000900 .*
+ 1010 09000900 09000900 09000900 09000900 .*
+ 1020 09000900 09000900 0b000900 d8ffffff .*
+ 1030 daffffff 02100000 28100000 24100000 .*
+Contents of section \.data:
+#pass
diff --git a/ld/testsuite/ld-sh/sub2l.s b/ld/testsuite/ld-sh/sub2l.s
new file mode 100644
index 0000000000..1a077d0960
--- /dev/null
+++ b/ld/testsuite/ld-sh/sub2l.s
@@ -0,0 +1,26 @@
+! "The subtraction of two symbols".
+ .little
+ .text
+ .align 5
+f:
+ rts
+f2:
+ nop
+
+ .section .text.foo,"ax",@progbits
+ .align 5
+ .global ff
+ff:
+ nop
+ nop
+ nop
+ nop
+L:
+ rts
+ nop
+ .align 2
+ .long f-L
+ .long f2-L
+ .long f2
+ .long L
+ .long ff+4
diff --git a/ld/testsuite/ld-sh/weak1.d b/ld/testsuite/ld-sh/weak1.d
new file mode 100644
index 0000000000..fe27278073
--- /dev/null
+++ b/ld/testsuite/ld-sh/weak1.d
@@ -0,0 +1,20 @@
+#source: weak1.s
+#as: -little
+#ld: -e 0x1000 -EL
+#objdump: -ts
+
+.*: file format elf32-shl
+
+SYMBOL TABLE:
+#...
+0+10a0 l .data 0+ d0
+0+1000 l .text 0+ f
+0+10a4 w .data 0+ w0
+#...
+
+Contents of section .text:
+ 1000 01d11260 0b000900 a4100000 09000900 .*
+ 1010 09000900 09000900 09000900 09000900 .*
+Contents of section .data:
+ 10a0 01000000 00000000 .*
+#pass
diff --git a/ld/testsuite/ld-sh/weak1.s b/ld/testsuite/ld-sh/weak1.s
new file mode 100644
index 0000000000..79192afb52
--- /dev/null
+++ b/ld/testsuite/ld-sh/weak1.s
@@ -0,0 +1,19 @@
+ .data
+ .align 2
+d0:
+ .long 1
+ .global w0
+w0:
+ .long 0
+ .weak w0
+ .text
+ .align 5
+f:
+ mov.l .L3,r1
+ mov.l @r1,r0
+ rts
+ nop
+ .align 2
+.L3:
+ .long w0
+
OpenPOWER on IntegriCloud