aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-ifunc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-11 12:58:52 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-11 12:59:11 -0700
commit97dc35c88dd470465a99edeb0b491012a368f2bf (patch)
treedbbd0ec476974879e80a24140beed3c941f315a8 /ld/testsuite/ld-ifunc
parent922c5db5e733526f12e2fbfeb72c7f1f90089d53 (diff)
downloadgdb-97dc35c88dd470465a99edeb0b491012a368f2bf.zip
gdb-97dc35c88dd470465a99edeb0b491012a368f2bf.tar.gz
gdb-97dc35c88dd470465a99edeb0b491012a368f2bf.tar.bz2
Skip IFUNC relocations in debug sections
Skip IFUNC relocations in debug sections ignored by ld.so. bfd/ PR ld/18808 * elf32-i386.c (elf_i386_relocate_section): Skip IFUNC relocations in debug sections. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. ld/testsuite/ PR ld/18808 * ld-ifunc/ifunc.exp: Add a test for PR ld/18808. * ld-ifunc/pr18808.out: New file. * ld-ifunc/pr18808a.c: Likewise. * ld-ifunc/pr18808b.c: Likewise.
Diffstat (limited to 'ld/testsuite/ld-ifunc')
-rw-r--r--ld/testsuite/ld-ifunc/ifunc.exp27
-rw-r--r--ld/testsuite/ld-ifunc/pr18808.out1
-rw-r--r--ld/testsuite/ld-ifunc/pr18808a.c9
-rw-r--r--ld/testsuite/ld-ifunc/pr18808b.c24
4 files changed, 61 insertions, 0 deletions
diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
index e08261b..498cb2d 100644
--- a/ld/testsuite/ld-ifunc/ifunc.exp
+++ b/ld/testsuite/ld-ifunc/ifunc.exp
@@ -457,3 +457,30 @@ run_ld_link_exec_tests [] [list \
"-fpic" \
] \
]
+
+# Run-time tests which require working ifunc attribute support.
+if { ![check_ifunc_attribute_available] } {
+ return
+}
+
+run_cc_link_tests [list \
+ [list \
+ "Build libpr18808.so" \
+ "-shared" \
+ "-fPIC -O2 -g" \
+ { pr18808b.c } \
+ {} \
+ "libpr18808.so" \
+ ] \
+]
+
+run_ld_link_exec_tests [] [list \
+ [list \
+ "Run pr18808" \
+ "tmpdir/libpr18808.so" \
+ "" \
+ { pr18808a.c } \
+ "pr18808" \
+ "pr18808.out" \
+ ] \
+]
diff --git a/ld/testsuite/ld-ifunc/pr18808.out b/ld/testsuite/ld-ifunc/pr18808.out
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/pr18808.out
@@ -0,0 +1 @@
+OK
diff --git a/ld/testsuite/ld-ifunc/pr18808a.c b/ld/testsuite/ld-ifunc/pr18808a.c
new file mode 100644
index 0000000..35228ae
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/pr18808a.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+void bar(void);
+int main(void)
+{
+ bar();
+ printf("OK\n");
+ return 0;
+}
diff --git a/ld/testsuite/ld-ifunc/pr18808b.c b/ld/testsuite/ld-ifunc/pr18808b.c
new file mode 100644
index 0000000..6f0db5a
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/pr18808b.c
@@ -0,0 +1,24 @@
+int foo (int x) __attribute__ ((ifunc ("resolve_foo")));
+extern void abort (void);
+
+static int foo_impl(int x)
+{
+ return x;
+}
+
+int bar()
+{
+ int (*f)(int) = foo;
+
+ if (foo (5) != 5)
+ abort ();
+
+ if (f(42) != 42)
+ abort ();
+}
+
+
+void *resolve_foo (void)
+{
+ return (void *) foo_impl;
+}