aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2002-01-31 10:42:18 +0000
committerHans-Peter Nilsson <hp@axis.com>2002-01-31 10:42:18 +0000
commitf7a2c2f698acd6554284d5e05a1f82724c306359 (patch)
treefd6e6d9055cc7ef95a0a49085deb3223edd2696d /ld
parentc312a6a4894911fd22cc103702aeb333b6871964 (diff)
downloadgdb-f7a2c2f698acd6554284d5e05a1f82724c306359.zip
gdb-f7a2c2f698acd6554284d5e05a1f82724c306359.tar.gz
gdb-f7a2c2f698acd6554284d5e05a1f82724c306359.tar.bz2
* ld-cris/weakref1.d, ld-cris/libdso-1.d, ld-cris/gotrel2.s,
ld-cris/expdyn1.d, ld-cris/expdyn1.s, ld-cris/dso-1.s: New tests. * ld-cris/cris.exp: Split run_dump_tests in two parts, executing tests named *dso-*.d first and copying their tmpdir/dump to files named as the .d-file.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog8
-rw-r--r--ld/testsuite/ld-cris/cris.exp29
-rw-r--r--ld/testsuite/ld-cris/dso-1.s7
-rw-r--r--ld/testsuite/ld-cris/expdyn1.d14
-rw-r--r--ld/testsuite/ld-cris/expdyn1.s17
-rw-r--r--ld/testsuite/ld-cris/gotrel2.s5
-rw-r--r--ld/testsuite/ld-cris/libdso-1.d13
-rw-r--r--ld/testsuite/ld-cris/weakref1.d17
8 files changed, 108 insertions, 2 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index eff1c9a..a59759c 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2002-01-31 Hans-Peter Nilsson <hp@axis.com>
+
+ * ld-cris/weakref1.d, ld-cris/libdso-1.d, ld-cris/gotrel2.s,
+ ld-cris/expdyn1.d, ld-cris/expdyn1.s, ld-cris/dso-1.s: New tests.
+ * ld-cris/cris.exp: Split run_dump_tests in two parts, executing
+ tests named *dso-*.d first and copying their tmpdir/dump to files
+ named as the .d-file.
+
2002-01-31 Alan Modra <amodra@bigpond.net.au>
* ld-scripts/crossref.exp: Allow foo to have a leading dot.
diff --git a/ld/testsuite/ld-cris/cris.exp b/ld/testsuite/ld-cris/cris.exp
index 296f703..2278dab 100644
--- a/ld/testsuite/ld-cris/cris.exp
+++ b/ld/testsuite/ld-cris/cris.exp
@@ -23,8 +23,33 @@ if ![istarget cris-*-*] {
}
set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+
+# First, execute those tests that are named to indicate that they create a
+# DSO. Copy the file from the run_dump_test "tmpdir/dump" to a unique
+# expected name.
+# FIXME: Add option "output: filename" to run_dump_test.
+# FIXME: Add option "ldtail: option" to run_dump_test, so we can link
+# libraries in the right order.
+foreach atest $rd_test_list {
+ # We need to check against runtest_file_p too, or we'd mindlessly copy
+ # the last tmpdir/dump in selective test-runs.
+ if { [string match $srcdir/$subdir/*dso-*.d $atest] \
+ && [runtest_file_p $runtests [file tail $atest]] } {
+ verbose [file rootname $atest]
+ run_dump_test [file rootname $atest]
+ set cmd "cp tmpdir/dump tmpdir/[file rootname [file tail $atest]].so"
+ send_log "$cmd\n"
+ set cmdret [catch "exec $cmd" comp_output]
+ send_log "$comp_output\n"
+ # FIXME: What if it fails? Need we do something?
+ }
+}
+
+# Then run the ordinary tests. This round, exclude the dso-* tests.
foreach atest $rd_test_list {
# We need to strip the ".d", but can leave the dirname.
- verbose [file rootname $atest]
- run_dump_test [file rootname $atest]
+ if { ! [string match $srcdir/$subdir/*dso-*.d $atest] } {
+ verbose [file rootname $atest]
+ run_dump_test [file rootname $atest]
+ }
}
diff --git a/ld/testsuite/ld-cris/dso-1.s b/ld/testsuite/ld-cris/dso-1.s
new file mode 100644
index 0000000..85aeffd
--- /dev/null
+++ b/ld/testsuite/ld-cris/dso-1.s
@@ -0,0 +1,7 @@
+ .text
+ .global dsofn
+ .type dsofn,@function
+dsofn:
+ nop
+.Lfe:
+ .size dsofn,.Lfe1-dsofn
diff --git a/ld/testsuite/ld-cris/expdyn1.d b/ld/testsuite/ld-cris/expdyn1.d
new file mode 100644
index 0000000..eab40e2
--- /dev/null
+++ b/ld/testsuite/ld-cris/expdyn1.d
@@ -0,0 +1,14 @@
+#source: expdyn1.s
+#as: --no-underscore
+#ld: -m crislinux -export-dynamic tmpdir/libdso-1.so
+#objdump: -T
+
+.*: file format elf32-cris
+
+# Exporting dynamic symbols means objects as well as functions.
+
+DYNAMIC SYMBOL TABLE:
+#...
+00080206 g DF .text 00000002 expfn
+00082208 g DO .data 00000000 expobj
+#pass
diff --git a/ld/testsuite/ld-cris/expdyn1.s b/ld/testsuite/ld-cris/expdyn1.s
new file mode 100644
index 0000000..100cef4
--- /dev/null
+++ b/ld/testsuite/ld-cris/expdyn1.s
@@ -0,0 +1,17 @@
+ .data
+ .global expobj
+ .type expobj,@object
+expobj:
+ .dword 0
+
+ .text
+ .global _start
+_start:
+ nop
+ .global expfn
+expfn:
+ .type expfn,@function
+ nop
+.Lfe1:
+ .size expfn,.Lfe1-expfn
+
diff --git a/ld/testsuite/ld-cris/gotrel2.s b/ld/testsuite/ld-cris/gotrel2.s
new file mode 100644
index 0000000..3f98674
--- /dev/null
+++ b/ld/testsuite/ld-cris/gotrel2.s
@@ -0,0 +1,5 @@
+ .text
+ .weak undefweak
+ .global _start
+_start:
+ move.d [$r0+undefweak:GOT],$r3
diff --git a/ld/testsuite/ld-cris/libdso-1.d b/ld/testsuite/ld-cris/libdso-1.d
new file mode 100644
index 0000000..28d15e2
--- /dev/null
+++ b/ld/testsuite/ld-cris/libdso-1.d
@@ -0,0 +1,13 @@
+#source: dso-1.s
+#as: --pic --no-underscore
+#ld: --shared -m crislinux
+#objdump: -T
+
+# Just check that we actually got a DSO with the dsofn symbol.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+00000214 g DF .text 00000000 dsofn
+#pass
diff --git a/ld/testsuite/ld-cris/weakref1.d b/ld/testsuite/ld-cris/weakref1.d
new file mode 100644
index 0000000..166d489
--- /dev/null
+++ b/ld/testsuite/ld-cris/weakref1.d
@@ -0,0 +1,17 @@
+#source: gotrel2.s
+#as: --pic --no-underscore
+#ld: -m crislinux tmpdir/libdso-1.so
+#objdump: -R
+
+# A dynamic reloc for an undefined weak reference in a program got a
+# confused symbol reference count mismatch with a bfd assertion. Linking
+# with a DSO was needed as a catalyst to get to the faulty code; nothing
+# in the DSO was needed. We just check that we don't get the bfd
+# assertion. Note that no actual dynamic reloc is created for the
+# unresolved weak. Perhaps it should; the symbol could be defined in a
+# preloaded object or a new version of the DSO. FIXME: Revisit and adjust
+# test-result.
+
+.*: file format elf32-cris
+
+DYNAMIC RELOCATION RECORDS \(none\)