aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2008-12-23 11:45:25 +0000
committerHans-Peter Nilsson <hp@axis.com>2008-12-23 11:45:25 +0000
commitd6e0b1603bd96aaa1fbc1ad0b899601454657cb3 (patch)
treed568097e8bfad29a0701deb46171b45b3165a07a /ld
parent846b9259cba427eb321444d30ef4c3dcb72e83e2 (diff)
downloadgdb-d6e0b1603bd96aaa1fbc1ad0b899601454657cb3.zip
gdb-d6e0b1603bd96aaa1fbc1ad0b899601454657cb3.tar.gz
gdb-d6e0b1603bd96aaa1fbc1ad0b899601454657cb3.tar.bz2
* lib/ld-lib.exp (run_dump_test): New option ld_after_inputfiles.
* ld-cris/libdso-1c.d, ld-cris/expdref2.s, ld-cris/libdso-15b.d, ld-cris/expdyn1w.s, ld-cris/libdso-1d.d, ld-cris/tls-ie-78.d: New tests.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-cris/expdref2.s11
-rw-r--r--ld/testsuite/ld-cris/expdyn1w.s3
-rw-r--r--ld/testsuite/ld-cris/libdso-15b.d36
-rw-r--r--ld/testsuite/ld-cris/libdso-1c.d35
-rw-r--r--ld/testsuite/ld-cris/libdso-1d.d36
-rw-r--r--ld/testsuite/ld-cris/tls-ie-78.d44
-rw-r--r--ld/testsuite/lib/ld-lib.exp6
8 files changed, 177 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index de2862f..b8f9094 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-23 Hans-Peter Nilsson <hp@axis.com>
+
+ * lib/ld-lib.exp (run_dump_test): New option ld_after_inputfiles.
+ * ld-cris/libdso-1c.d, ld-cris/expdref2.s, ld-cris/libdso-15b.d,
+ ld-cris/expdyn1w.s, ld-cris/libdso-1d.d, ld-cris/tls-ie-78.d: New
+ tests.
+
2008-12-23 Nick Clifton <nickc@redhat.com>
* ld-i386/i386.exp: Do not run ifunc test.
diff --git a/ld/testsuite/ld-cris/expdref2.s b/ld/testsuite/ld-cris/expdref2.s
new file mode 100644
index 0000000..424e90c
--- /dev/null
+++ b/ld/testsuite/ld-cris/expdref2.s
@@ -0,0 +1,11 @@
+ .text
+ .global x
+ .type x,@function
+x:
+ move.d expobj2:GOT,$r10
+ move.d expobj2:PLT,$r10
+ move.d expfn2:GOT,$r10
+ move.d expfn2:PLT,$r10
+.Lfe1:
+ .size x,.Lfe1-x
+
diff --git a/ld/testsuite/ld-cris/expdyn1w.s b/ld/testsuite/ld-cris/expdyn1w.s
new file mode 100644
index 0000000..35d36db
--- /dev/null
+++ b/ld/testsuite/ld-cris/expdyn1w.s
@@ -0,0 +1,3 @@
+ .weak expobj
+ .weak expfn
+ .include "expdyn1.s"
diff --git a/ld/testsuite/ld-cris/libdso-15b.d b/ld/testsuite/ld-cris/libdso-15b.d
new file mode 100644
index 0000000..0f14c5e
--- /dev/null
+++ b/ld/testsuite/ld-cris/libdso-15b.d
@@ -0,0 +1,36 @@
+#source: expdref2.s
+#as: --pic --no-underscore --em=criself
+#ld: --shared -m crislinux
+#ld_after_inputfiles: tmpdir/libdso-15.so
+#objdump: -s -T
+
+# A DSO that refers to two symbols in another DSO with
+# GOT/PLT-generating relocs, using weak aliases where the strong
+# definition is also in the other DSO.
+# There was a bug causing GOT markups to be during symbol handling,
+# with a newly added assertion failure and a reloc turned R_CRIS_NONE.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+0+ w[ ]+DO \*UND\*[ ]+0+ TST3[ ]+__expobj2
+#...
+0+[ ]+DO \*UND\*[ ]+0+ TST3[ ]+expobj2
+0+[ ]+DF \*UND\*[ ]+0+ TST3[ ]+expfn2
+#...
+Contents of section .rela.dyn:
+ 01d4 fc220000 0a040000 00000000 00230000 .*
+ 01e4 0a050000 00000000 .*
+Contents of section .plt:
+ 01ec fce17e7e 0401307a 08013009 00000000 .*
+ 01fc 00000000 6f0d0c00 00003009 3f7e0000 .*
+ 020c 00002ffe ecffffff 6f0d1000 00003009 .*
+ 021c 3f7e0000 00002ffe ecffffff .*
+Contents of section .text:
+ 0228 6fae0c00 00006fae ccffffff 6fae1000 .*
+ 0238 00006fae d4ffffff .*
+#...
+Contents of section .got:
+ 22f0 40220000 00000000 00000000 00000000 .*
+ 2300 00000000 .*
diff --git a/ld/testsuite/ld-cris/libdso-1c.d b/ld/testsuite/ld-cris/libdso-1c.d
new file mode 100644
index 0000000..066d5e2
--- /dev/null
+++ b/ld/testsuite/ld-cris/libdso-1c.d
@@ -0,0 +1,35 @@
+#source: expdref1.s
+#as: --pic --no-underscore --em=criself -I$srcdir/$subdir
+#ld: --shared -m crislinux
+#ld_after_inputfiles: tmpdir/libdso-1b.so
+#objdump: -s -T
+
+# A DSO linked to another DSO that has two versioned symbols, to which
+# this DSO refers with two relocs each, a GOT and a PLT reference.
+# There was a bug such that GOT markups were lost, resulting in wrong
+# offsets into the GOT, with a tell-tale sign being one or more
+# R_CRIS_NONE relocs. There should be two GOT relocs here, one each
+# for the symbols.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+0+[ ]+DF \*UND\* 0+[ ]+TST2[ ]+expobj
+0+[ ]+DF \*UND\* 0+[ ]+TST2[ ]+expfn
+#...
+Contents of section .rela.dyn:
+ 01a4 cc220000 0a030000 00000000 d0220000 .*
+ 01b4 0a040000 00000000 .*
+Contents of section .plt:
+ 01bc fce17e7e 0401307a 08013009 00000000 .*
+ 01cc 00000000 6f0d0c00 00003009 3f7e0000 .*
+ 01dc 00002ffe ecffffff 6f0d1000 00003009 .*
+ 01ec 3f7e0000 00002ffe ecffffff .*
+Contents of section .text:
+ 01f8 6fae0c00 00006fae ccffffff 6fae1000 .*
+ 0208 00006fae d4ffffff .*
+#...
+Contents of section .got:
+ 22c0 10220000 00000000 00000000 00000000 .*
+ 22d0 00000000 .*
diff --git a/ld/testsuite/ld-cris/libdso-1d.d b/ld/testsuite/ld-cris/libdso-1d.d
new file mode 100644
index 0000000..47721de
--- /dev/null
+++ b/ld/testsuite/ld-cris/libdso-1d.d
@@ -0,0 +1,36 @@
+#source: expdref1.s
+#source: expdyn1w.s
+#as: --pic --no-underscore --em=criself -I$srcdir/$subdir
+#ld: --shared -m crislinux
+#ld_after_inputfiles: tmpdir/libdso-1b.so
+#objdump: -s -T
+
+# A DSO linked to another DSO that has two versioned symbols, to which
+# this DSO refers with two relocs each, a GOT and a PLT reference.
+# This DSO has weak definitions of those symbols.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+0+1f2 w DF .text 0+2 expfn
+0+22a0 w DO .data 0+4 expobj
+#...
+Contents of section .rela.dyn:
+ 0184 98220000 0a020000 00000000 9c220000 .*
+ 0194 0a030000 00000000 .*
+Contents of section .plt:
+ 019c fce17e7e 0401307a 08013009 00000000 .*
+ 01ac 00000000 6f0d0c00 00003009 3f7e0000 .*
+ 01bc 00002ffe ecffffff 6f0d1000 00003009 .*
+ 01cc 3f7e0000 00002ffe ecffffff .*
+Contents of section .text:
+ 01d8 6fae1000 00006fae e0ffffff 6fae0c00 .*
+ 01e8 00006fae c0ffffff 0f050f05 .*
+Contents of section .dynamic:
+#...
+Contents of section .got:
+ 228c f4210000 00000000 00000000 00000000 .*
+ 229c 00000000 .*
+Contents of section .data:
+ 22a0 00000000 .*
diff --git a/ld/testsuite/ld-cris/tls-ie-78.d b/ld/testsuite/ld-cris/tls-ie-78.d
new file mode 100644
index 0000000..3994df8
--- /dev/null
+++ b/ld/testsuite/ld-cris/tls-ie-78.d
@@ -0,0 +1,44 @@
+#source: start1.s
+#source: tls128.s
+#source: tls-ie-8e.s
+#as: --no-underscore --em=criself
+#ld: -m crislinux
+#ld_after_inputfiles: tmpdir/tls-dso-xz-1.so
+#objdump: -s -h -t -T -R -r -p
+
+# Check that we have proper NPTL/TLS markings and GOT for a
+# R_CRIS_32_IE, for an executable, symbol defined elsewhere.
+
+.*: file format elf32-cris
+
+Program Header:
+#...
+ TLS off .*
+ filesz 0x0+80 memsz 0x0+80 flags r--
+
+Dynamic Section:
+ NEEDED tmpdir/tls-dso-xz-1.so
+#...
+private flags = 0:
+#...
+ 8 .got[ ]+0+10 .*
+ CONTENTS, ALLOC, LOAD, DATA
+SYMBOL TABLE:
+#...
+0+ \*UND\* 0+ x
+#...
+DYNAMIC SYMBOL TABLE:
+0+ D \*UND\* 0+ x
+#...
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+0+822d4 R_CRIS_32_TPREL x
+
+Contents of section .interp:
+#...
+Contents of section \.text:
+ 801bc 41b20000 6faed422 08000000 .*
+Contents of section \.tdata:
+#...
+Contents of section \.got:
+ 822c8 48220800 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index d4e996e..6152065 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -564,6 +564,9 @@ proc simple_diff { file_1 file_2 } {
# Link assembled files using FLAGS, in the order of the "source"
# directives, when using multiple files.
#
+# ld_after_inputfiles: FLAGS
+# Similar to "ld", but put after all input files.
+#
# objcopy_linked_file: FLAGS
# Run objcopy on the linked file with the specified flags.
# This lets you transform the linked file using objcopy, before the
@@ -650,6 +653,7 @@ proc run_dump_test { name } {
set run_objcopy 0
set opts(as) {}
set opts(ld) {}
+ set opts(ld_after_inputfiles) {}
set opts(xfail) {}
set opts(target) {}
set opts(notarget) {}
@@ -842,7 +846,7 @@ proc run_dump_test { name } {
# Add -L$srcdir/$subdir so that the linker command can use
# linker scripts in the source directory.
set cmd "$LD $LDFLAGS -L$srcdir/$subdir \
- $opts(ld) -o $objfile $objfiles"
+ $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
send_log "$cmd\n"
set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]