aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elfvers
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-02-13 22:14:11 +0000
committerJakub Jelinek <jakub@redhat.com>2003-02-13 22:14:11 +0000
commit9147e853bf5d168c176eb3993f93bda12de96232 (patch)
treedd406335a96b74a500bd03985f52327908e76a15 /ld/testsuite/ld-elfvers
parent40f235b7e218cc05a6cc5eea2aaac15d1e292058 (diff)
downloadgdb-9147e853bf5d168c176eb3993f93bda12de96232.zip
gdb-9147e853bf5d168c176eb3993f93bda12de96232.tar.gz
gdb-9147e853bf5d168c176eb3993f93bda12de96232.tar.bz2
bfd/
* elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO. ld/testsuite/ * ld-shared/shared.exp: Run on s390*-*-linux* and x86_64-*-linux* too. xfail tests linking non-pic code into shared libs on x86_64-*-linux*. * ld-elfvsb/elfvsb.exp: Likewise. * ld-elfvers/vers.exp: Likewise. Add vers24a, vers24b and vers24c tests. * ld-elfvers/vers3.ver: Allow VERS_2.0 to come before GLIBC_* version. * ld-elfvers/vers19.ver: Likewise. * ld-elfvers/vers24a.c: New test. * ld-elfvers/vers24b.c: New test. * ld-elfvers/vers24c.c: New test. * ld-elfvers/vers24.map: New test. * ld-elfvers/vers24.rd: New test. * lib/ld-lib.exp (run_ld_link_tests): Add optional 7th argument cflags. If source files have .c extension, compile them first.
Diffstat (limited to 'ld/testsuite/ld-elfvers')
-rw-r--r--ld/testsuite/ld-elfvers/vers.exp29
-rw-r--r--ld/testsuite/ld-elfvers/vers19.ver2
-rw-r--r--ld/testsuite/ld-elfvers/vers24.map4
-rw-r--r--ld/testsuite/ld-elfvers/vers24.rd15
-rw-r--r--ld/testsuite/ld-elfvers/vers24a.c5
-rw-r--r--ld/testsuite/ld-elfvers/vers24b.c5
-rw-r--r--ld/testsuite/ld-elfvers/vers24c.c9
-rw-r--r--ld/testsuite/ld-elfvers/vers3.ver2
8 files changed, 67 insertions, 4 deletions
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp
index 4cd76b9..68b5b08 100644
--- a/ld/testsuite/ld-elfvers/vers.exp
+++ b/ld/testsuite/ld-elfvers/vers.exp
@@ -43,7 +43,9 @@ if { ![istarget hppa*64*-*-hpux*] \
&& ![istarget sparc*-*-linux*] \
&& ![istarget arm*-*-linux*] \
&& ![istarget mips*-*-linux*] \
- && ![istarget alpha*-*-linux*] } {
+ && ![istarget alpha*-*-linux*] \
+ && ![istarget s390*-*-linux*] \
+ && ![istarget x86_64-*-linux*] } {
return
}
@@ -719,7 +721,12 @@ build_vers_lib "vers1" vers1.c vers1 "" vers1.map vers1.ver vers1.dsym vers1.sym
# Test #2 - build a library, and link it against the library we built in step
# 1.
#
-build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym ""
+if [istarget x86_64-*-linux*] {
+ # x86_64 doesn't like non-pic shared libraries
+ xfail "vers2"
+} else {
+ build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym ""
+}
#
# Test #3 - build an executable, and link it against vers1.so.
@@ -838,3 +845,21 @@ build_vers_lib "vers23b" vers23b.c vers23b "" vers23b.map vers23b.ver vers23b.ds
build_vers_lib "vers23c" vers23b.c vers23c "vers23a.so" vers23b.map vers23c.ver vers23b.dsym ""
build_exec "vers23d" vers23.c vers23d "tmpdir/vers23a.so tmpdir/vers23c.so" "" vers23.ver vers23d.dsym ""
build_exec "vers23" vers23.c vers23 "tmpdir/vers23a.so tmpdir/vers23b.o tmpdir/vers23b.so" "" vers23.ver vers23.dsym ""
+
+# Test .symver x,x@VERS.0
+set as_pic_flags ""
+if [istarget sparc*-*-*] {
+ set as_pic_flags "-K PIC"
+}
+run_ld_link_tests [list "\"vers24a\"
+ \"-shared --version-script $srcdir/$subdir/vers24.map\"
+ \"$as_pic_flags\" {vers24a.c vers24b.c} { { readelf -Wrs vers24.rd } }
+ \"libvers24a.so\" \"-fpic\""]
+run_ld_link_tests [list "\"vers24b\"
+ \"-shared --version-script $srcdir/$subdir/vers24.map\"
+ \"$as_pic_flags\" {vers24b.c vers24a.c} { { readelf -Wrs vers24.rd } }
+ \"libvers24b.so\" \"-fpic\""]
+run_ld_link_tests [list "\"vers24c\"
+ \"-shared --version-script $srcdir/$subdir/vers24.map\"
+ \"$as_pic_flags\" {vers24c.c} { { readelf -Wrs vers24.rd } }
+ \"libvers24c.so\" \"-fpic\""]
diff --git a/ld/testsuite/ld-elfvers/vers19.ver b/ld/testsuite/ld-elfvers/vers19.ver
index e694a27..5969797 100644
--- a/ld/testsuite/ld-elfvers/vers19.ver
+++ b/ld/testsuite/ld-elfvers/vers19.ver
@@ -1,3 +1,3 @@
Version References:
required from vers17.so:
- 0x0a7922b0 0x00 02 VERS_2.0
+ 0x0a7922b0 0x00 0[23] VERS_2.0
diff --git a/ld/testsuite/ld-elfvers/vers24.map b/ld/testsuite/ld-elfvers/vers24.map
new file mode 100644
index 0000000..06ea42f
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers24.map
@@ -0,0 +1,4 @@
+VERS.0 {
+ global: x; foo;
+ local: *;
+};
diff --git a/ld/testsuite/ld-elfvers/vers24.rd b/ld/testsuite/ld-elfvers/vers24.rd
new file mode 100644
index 0000000..9ed8762
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers24.rd
@@ -0,0 +1,15 @@
+Relocation section .*
+# Ensure there is a dynamic relocation against x
+#...
+[0-9a-f]+ +[0-9a-f]+ R_.* +x(| \+ 0)
+#...
+Symbol table '.dynsym' contains [0-9]+ entries:
+# And ensure the dynamic symbol table contains at least x@VERS.0
+# and foo@@VERS.0 symbols
+#...
+ +[0-9]+: [0-9a-f]+ +(4 OBJECT +GLOBAL DEFAULT +[0-9]+ x|[0-9]+ FUNC +GLOBAL DEFAULT +[0-9]+ foo@)@VERS\.0
+#...
+ +[0-9]+: [0-9a-f]+ +(4 OBJECT +GLOBAL DEFAULT +[0-9]+ x|[0-9]+ FUNC +GLOBAL DEFAULT +[0-9]+ foo@)@VERS\.0
+#...
+Symbol table '.symtab' contains [0-9]+ entries:
+#pass
diff --git a/ld/testsuite/ld-elfvers/vers24a.c b/ld/testsuite/ld-elfvers/vers24a.c
new file mode 100644
index 0000000..7fef8d8
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers24a.c
@@ -0,0 +1,5 @@
+/* Test whether .symver x, x@foo
+ causes relocations against x within the same shared library
+ to become dynamic relocations against x@foo. */
+int x = 12;
+__asm__ (".symver x, x@VERS.0");
diff --git a/ld/testsuite/ld-elfvers/vers24b.c b/ld/testsuite/ld-elfvers/vers24b.c
new file mode 100644
index 0000000..8a18b3a
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers24b.c
@@ -0,0 +1,5 @@
+extern int x;
+void foo (void)
+{
+ x = 24;
+}
diff --git a/ld/testsuite/ld-elfvers/vers24c.c b/ld/testsuite/ld-elfvers/vers24c.c
new file mode 100644
index 0000000..267c424
--- /dev/null
+++ b/ld/testsuite/ld-elfvers/vers24c.c
@@ -0,0 +1,9 @@
+/* Test whether .symver x, x@foo
+ causes relocations against x within the same shared library
+ to become dynamic relocations against x@foo. */
+int x = 12;
+__asm__ (".symver x, x@VERS.0");
+void foo (void)
+{
+ x = 24;
+}
diff --git a/ld/testsuite/ld-elfvers/vers3.ver b/ld/testsuite/ld-elfvers/vers3.ver
index aa230ee..41dad48 100644
--- a/ld/testsuite/ld-elfvers/vers3.ver
+++ b/ld/testsuite/ld-elfvers/vers3.ver
@@ -1,4 +1,4 @@
Version References:
required from tmpdir/vers1.so:
- 0x0a7922b0 0x00 02 VERS_2.0
+ 0x0a7922b0 0x00 0[23] VERS_2.0