aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mn10300
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-10-19 17:31:31 +0000
committerNick Clifton <nickc@redhat.com>2007-10-19 17:31:31 +0000
commitbfff1642494227904c6c9a6c285cbaa6cf615bbb (patch)
tree7bf1ece58861b5e9c520e056102994251c0a7504 /ld/testsuite/ld-mn10300
parent97030eea009ba78139fe20eae4585984435ac178 (diff)
downloadgdb-bfff1642494227904c6c9a6c285cbaa6cf615bbb.zip
gdb-bfff1642494227904c6c9a6c285cbaa6cf615bbb.tar.gz
gdb-bfff1642494227904c6c9a6c285cbaa6cf615bbb.tar.bz2
Add MN10300 linker relaxation support for symbol differences
Diffstat (limited to 'ld/testsuite/ld-mn10300')
-rw-r--r--ld/testsuite/ld-mn10300/i112045-1.d22
-rw-r--r--ld/testsuite/ld-mn10300/i112045-1.s14
-rw-r--r--ld/testsuite/ld-mn10300/i112045-2.d6
-rw-r--r--ld/testsuite/ld-mn10300/i112045-2.s12
-rw-r--r--ld/testsuite/ld-mn10300/i126256-1.c7
-rw-r--r--ld/testsuite/ld-mn10300/i126256-2.c5
-rw-r--r--ld/testsuite/ld-mn10300/i135409.d11
-rw-r--r--ld/testsuite/ld-mn10300/i135409.s29
-rw-r--r--ld/testsuite/ld-mn10300/i36434-2.s16
-rw-r--r--ld/testsuite/ld-mn10300/i36434.d16
-rw-r--r--ld/testsuite/ld-mn10300/i36434.s10
-rw-r--r--ld/testsuite/ld-mn10300/mn10300.exp94
12 files changed, 242 insertions, 0 deletions
diff --git a/ld/testsuite/ld-mn10300/i112045-1.d b/ld/testsuite/ld-mn10300/i112045-1.d
new file mode 100644
index 0000000..dcb5a41
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i112045-1.d
@@ -0,0 +1,22 @@
+
+tmpdir/i112045-1.x: file format elf32-.*
+
+Disassembly of section .text:
+
+0+0 <_start>:
+ 0: fc d0 f8 0f[ ]+add 4088,a0
+ 4: 00 00
+ 6: cb[ ]+nop[ ]+
+ 7: cb[ ]+nop[ ]+
+
+0+08 <L01>:
+ 8: fc d0 2b 01[ ]+add 299,a0
+ c: 00 00
+ e: cb[ ]+nop[ ]+
+ f: cb[ ]+nop[ ]+
+
+0+010 <L02>:
+ 10: fc d0 08 00[ ]+add 8,a0
+ 14: 00 00
+ 16: cb[ ]+nop[ ]+
+ 17: cb[ ]+nop[ ]+
diff --git a/ld/testsuite/ld-mn10300/i112045-1.s b/ld/testsuite/ld-mn10300/i112045-1.s
new file mode 100644
index 0000000..b9e0346
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i112045-1.s
@@ -0,0 +1,14 @@
+ .text
+ .global _start
+_start:
+ add 0x1000 - L01, A0
+ nop
+ nop
+L01:
+ add L01 + 0x123, A0
+ nop
+ nop
+L02:
+ add L02 - L01, A0
+ nop
+ nop
diff --git a/ld/testsuite/ld-mn10300/i112045-2.d b/ld/testsuite/ld-mn10300/i112045-2.d
new file mode 100644
index 0000000..9aa2d82
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i112045-2.d
@@ -0,0 +1,6 @@
+
+tmpdir/i112045-2.x: file format elf32-.*
+
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+[0-9a-f]+ R_MN10300_RELATIVE \*ABS\*\+0x[0-9a-f]+
diff --git a/ld/testsuite/ld-mn10300/i112045-2.s b/ld/testsuite/ld-mn10300/i112045-2.s
new file mode 100644
index 0000000..90e942d
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i112045-2.s
@@ -0,0 +1,12 @@
+ .section .data
+L01:
+ .long L04 - L01
+L02:
+ .long L04 - L02
+L03:
+ .long L04 - L03
+L04:
+ .long L04
+ .long L00
+ .equ L00, 0xff
+
diff --git a/ld/testsuite/ld-mn10300/i126256-1.c b/ld/testsuite/ld-mn10300/i126256-1.c
new file mode 100644
index 0000000..5907d87
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i126256-1.c
@@ -0,0 +1,7 @@
+void
+sub0 (int i)
+{
+ extern int sub (int);
+
+ sub (i);
+}
diff --git a/ld/testsuite/ld-mn10300/i126256-2.c b/ld/testsuite/ld-mn10300/i126256-2.c
new file mode 100644
index 0000000..2948e5b
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i126256-2.c
@@ -0,0 +1,5 @@
+int
+sub (int i)
+{
+ return i + 10;
+}
diff --git a/ld/testsuite/ld-mn10300/i135409.d b/ld/testsuite/ld-mn10300/i135409.d
new file mode 100644
index 0000000..2d64a42
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i135409.d
@@ -0,0 +1,11 @@
+
+Symbol table '.symtab' contains .. entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+ ..: 0[0-9a-f]+[ ]+7 FUNC LOCAL DEFAULT . _func
+#...
+ ..: 0[0-9a-f]+[ ]+0 NOTYPE LOCAL DEFAULT . A
+ ..: 0[0-9a-f]+[ ]+7 FUNC GLOBAL DEFAULT . _func2
+#...
+ ..: 0[0-9a-f]+[ ]+0 NOTYPE GLOBAL DEFAULT . BOTTOM
+#...
diff --git a/ld/testsuite/ld-mn10300/i135409.s b/ld/testsuite/ld-mn10300/i135409.s
new file mode 100644
index 0000000..b9faaf4
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i135409.s
@@ -0,0 +1,29 @@
+ .text
+
+ nop
+
+ .global _start
+_start:
+ .type _func, @function
+_func:
+ mov L001,A1
+ nop
+A:
+ mov L001,A1
+ .size _func, . - _func
+
+
+ .global _func2
+_func2:
+ .type _func2, @function
+ mov L001,A1
+ nop
+ mov L001,A1
+ .size _func2, . - _func2
+
+ .global BOTTOM
+BOTTOM:
+
+ .data
+L001:
+
diff --git a/ld/testsuite/ld-mn10300/i36434-2.s b/ld/testsuite/ld-mn10300/i36434-2.s
new file mode 100644
index 0000000..cf31ce1
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i36434-2.s
@@ -0,0 +1,16 @@
+ .section .text
+ .global _bar
+ .type _bar,@function
+_bar:
+ mov .LC1,d0
+ mov .LC2,d1
+ nop
+
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC1:
+ .rept 32768
+ .byte 'a'
+ .endr
+ .byte 0
+.LC2:
+ .string "abc\n"
diff --git a/ld/testsuite/ld-mn10300/i36434.d b/ld/testsuite/ld-mn10300/i36434.d
new file mode 100644
index 0000000..25cea45
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i36434.d
@@ -0,0 +1,16 @@
+
+tmpdir/i36434.x: file format elf32-.*
+
+Disassembly of section .text:
+
+08000000 <_start>:
+ 8000000: fc cd 18 80 mov 134250520,d1
+ 8000004: 00 08
+ 8000006: cb nop
+
+08000007 <_bar>:
+ 8000007: fc cc 14 00 mov 134217748,d0
+ 800000b: 00 08
+ 800000d: fc cd 15 80 mov 134250517,d1
+ 8000011: 00 08
+ 8000013: cb nop
diff --git a/ld/testsuite/ld-mn10300/i36434.s b/ld/testsuite/ld-mn10300/i36434.s
new file mode 100644
index 0000000..84c1d83
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/i36434.s
@@ -0,0 +1,10 @@
+ .section .text
+ .global _start
+ .type _start,@function
+_start:
+ mov .LC2,d1
+ nop
+
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC2:
+ .string "\n"
diff --git a/ld/testsuite/ld-mn10300/mn10300.exp b/ld/testsuite/ld-mn10300/mn10300.exp
new file mode 100644
index 0000000..14ba85b
--- /dev/null
+++ b/ld/testsuite/ld-mn10300/mn10300.exp
@@ -0,0 +1,94 @@
+# Expect script for ld-mn10300 tests
+# Copyright (C) 2007 Free Software Foundation
+#
+# 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 3 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.
+#
+
+if {!([istarget "am3*-*-*"]) && !([istarget "mn10300*-*-*"]) } {
+ return
+}
+
+# Set up a list as described in ld-lib.exp
+
+set am33_tests {
+ {
+ "am33 string merging"
+ "--relax -Ttext 0x8000000"
+ ""
+ { "i36434.s" "i36434-2.s" }
+ { {objdump -dz i36434.d} }
+ "i36434.x"
+ }
+ {
+ "difference of two symbols"
+ "-Ttext 0"
+ ""
+ { "i112045-1.s" }
+ { {objdump -d i112045-1.d} }
+ "i112045-1.x"
+ }
+ {
+ "(shared) difference of two symbols"
+ "-shared"
+ ""
+ { "i112045-2.s" }
+ { {objdump -R i112045-2.d} }
+ "i112045-2.x"
+ }
+ {
+ "adjustment of symbols due to relaxation"
+ "-Tdata 1f -relax"
+ ""
+ { "i135409.s" }
+ { {readelf --syms i135409.d } }
+ "i135409.x"
+ }
+}
+
+run_ld_link_tests $am33_tests
+
+proc i126256-test { } {
+ global CC
+ global ld
+ global srcdir
+ global subdir
+
+ set tmpdir tmpdir
+ set testname "Issue 126256 - seg fault whilst linking one shared library into another when relaxation is enabled."
+
+ if { ![ld_compile "$CC -mrelax -fPIC" $srcdir/$subdir/i126256-1.c $tmpdir/i126256-1.o] } {
+ unresolved $testname
+ return
+ }
+
+ if { ![ld_compile "$CC -mrelax -fPIC" $srcdir/$subdir/i126256-2.c $tmpdir/i126256-2.o] } {
+ unresolved $testname
+ return
+ }
+
+ if { ![ld_simple_link $ld $tmpdir/i126256-1.so "-shared $tmpdir/i126256-1.o -e 0"]} {
+ unresolved $testname
+ return
+ }
+
+ if { ![ld_simple_link $ld $tmpdir/i126256-2.so "--relax -shared $tmpdir/i126256-2.o $tmpdir/i126256-1.so -e 0"]} {
+ fail $testname
+ return
+ }
+
+ pass $testname
+}
+
+i126256-test