aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-10-31 11:13:30 +1030
committerAlan Modra <amodra@gmail.com>2017-11-01 18:45:34 +1030
commite48f0c8f1b9fdb195394dc7afea02ce55e4ba5e4 (patch)
treed2b4ea2ba537515a88f277b056a99dae6d9d32d1 /ld
parent46b06a98d112ee433a8f81c700a8852c92ca8132 (diff)
downloadgdb-e48f0c8f1b9fdb195394dc7afea02ce55e4ba5e4.zip
gdb-e48f0c8f1b9fdb195394dc7afea02ce55e4ba5e4.tar.gz
gdb-e48f0c8f1b9fdb195394dc7afea02ce55e4ba5e4.tar.bz2
PR22374 testcase, function pointer references in .data
Function pointer references in .data ought to use a dynamic reloc. There shouldn't be any need for a PLT entry and definitely no copy reloc. This test fails on quite a few targets, but isn't something that anyone should worry about too much. It's really just a missed optimization. PR 22374 * testsuite/ld-elf/pr22374a.s, * testsuite/ld-elf/pr22374b.s, * testsuite/ld-elf/pr22374-1.r, * testsuite/ld-elf/pr22374-2.r: New test. * testsuite/ld-elf/elf.exp: Run it.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/testsuite/ld-elf/elf.exp11
-rw-r--r--ld/testsuite/ld-elf/pr22374-1.r8
-rw-r--r--ld/testsuite/ld-elf/pr22374-2.r4
-rw-r--r--ld/testsuite/ld-elf/pr22374a.s2
-rw-r--r--ld/testsuite/ld-elf/pr22374b.s5
6 files changed, 39 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4fb7e84..84bebb3 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,14 @@
2017-11-01 Alan Modra <amodra@gmail.com>
+ PR 22374
+ * testsuite/ld-elf/pr22374a.s,
+ * testsuite/ld-elf/pr22374b.s,
+ * testsuite/ld-elf/pr22374-1.r,
+ * testsuite/ld-elf/pr22374-2.r: New test.
+ * testsuite/ld-elf/elf.exp: Run it.
+
+2017-11-01 Alan Modra <amodra@gmail.com>
+
* testsuite/ld-elf/elf.exp: Merge some conditionals, a better
name than "shared library for next test", and use xfail arg
of run_ld_link_tests in a few places.
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 29cc5e0..acdad8d 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -192,6 +192,17 @@ if { [check_shared_lib_support] } then {
"pr20995-2" \
"" "tmpdir/pr20995-2.so" "$AFLAGS_NONPIC" \
{pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995-2"]]
+
+ setup_xfail "tic6x-*-*"
+ run_ld_link_tests {
+ {"Build pr22374 shared library"
+ "-shared" "" "" "pr22374b.s" {} "pr22374.so" }
+ {"pr22374 function pointer initialization"
+ "" "tmpdir/pr22374.so" "" "pr22374a.s"
+ { {readelf {--wide -r --dyn-syms} "pr22374-1.r"}
+ {readelf {--wide -r} "pr22374-2.r"} }
+ "pr22374" }
+ }
}
if [is_underscore_target] {
diff --git a/ld/testsuite/ld-elf/pr22374-1.r b/ld/testsuite/ld-elf/pr22374-1.r
new file mode 100644
index 0000000..0c4fac4
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22374-1.r
@@ -0,0 +1,8 @@
+Relocation section .* contains 1 entries:
+.*
+.* +0+ +foo.*
+
+Symbol table '.dynsym' contains .* entries:
+#...
+.*: 0+ +0 FUNC +GLOBAL DEFAULT +UND foo
+#pass
diff --git a/ld/testsuite/ld-elf/pr22374-2.r b/ld/testsuite/ld-elf/pr22374-2.r
new file mode 100644
index 0000000..67cd845
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22374-2.r
@@ -0,0 +1,4 @@
+#failif
+Relocation section .* contains 1 entries:
+.*
+.*COPY.*
diff --git a/ld/testsuite/ld-elf/pr22374a.s b/ld/testsuite/ld-elf/pr22374a.s
new file mode 100644
index 0000000..e85c120
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22374a.s
@@ -0,0 +1,2 @@
+ .data
+ .dc.a foo
diff --git a/ld/testsuite/ld-elf/pr22374b.s b/ld/testsuite/ld-elf/pr22374b.s
new file mode 100644
index 0000000..24d89de
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22374b.s
@@ -0,0 +1,5 @@
+ .global foo
+ .type foo, %function
+foo:
+ .dc.a 0
+ .size foo, .-foo