aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elf
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r--ld/testsuite/ld-elf/elf.exp10
-rw-r--r--ld/testsuite/ld-elf/symbolic-func.r18
-rw-r--r--ld/testsuite/ld-elf/symbolic-func.s13
3 files changed, 40 insertions, 1 deletions
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index d1a70ea..55bcb72 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -77,7 +77,7 @@ if { ![istarget hppa64*-hpux*] } {
}
}
-# Only run these tests on targets thats support creating shared libraries.
+# Only run these tests on targets that support creating shared libraries.
if { [check_shared_lib_support] } then {
# Run a test to check linking a shared library with a broken linker
# script that accidentally marks dynamic sections as notes. The
@@ -107,6 +107,14 @@ if { [check_shared_lib_support] } then {
"--as-needed" "--start-group tmpdir/pr17068a.a tmpdir/pr17068.so tmpdir/pr17068b.a --end-group" ""
{start.s pr17068.s} {} "pr17068"}
}
+ # xfail on tic6x due to non-PIC/non-PID warnings
+ setup_xfail "tic6x-*-*"
+ run_ld_link_tests {
+ {"-Bsymbolic-functions"
+ "-shared -Bsymbolic-functions" "" ""
+ {symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}}
+ "symbolic-func.so"}
+ }
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
diff --git a/ld/testsuite/ld-elf/symbolic-func.r b/ld/testsuite/ld-elf/symbolic-func.r
new file mode 100644
index 0000000..174e76f
--- /dev/null
+++ b/ld/testsuite/ld-elf/symbolic-func.r
@@ -0,0 +1,18 @@
+# Most targets will emit an R_*_RELATIVE reloc here, but RELATIVE
+# relocs are superfluous. A target can do without them by simply
+# defining an ADDR32 or ADDR64 style reloc without a symbol to behave
+# like a RELATIVE reloc. GLOB_DAT relocs are similarly superfluous.
+# In fact, a RELATIVE reloc can be wrong even if a target does have
+# them, if the 32-bit or 64-bit field being relocated is unaligned.
+# In that case the target ought to emit a UADDR32/64 or similar rather
+# than a RELATIVE reloc.
+#
+# We also allow a dynamic reloc with a reference to .text as that
+# should also resolve correctly. No reloc, or one referencing "fun"
+# is incorrect. Also fail the test on finding a reloc at offset 0,
+# typically a NONE reloc.
+
+Relocation section.*
+ *Offset.*
+0*[1-9a-f][0-9a-f]* +[^ ]+ +[^ ]+ +([0-9a-f]+( +\.text( \+ 0)?)?)?
+#pass
diff --git a/ld/testsuite/ld-elf/symbolic-func.s b/ld/testsuite/ld-elf/symbolic-func.s
new file mode 100644
index 0000000..29f4138
--- /dev/null
+++ b/ld/testsuite/ld-elf/symbolic-func.s
@@ -0,0 +1,13 @@
+ .text
+ .global fun
+ .type fun, %function
+fun:
+ .space 4
+ .size fun, .-fun
+
+ .section .data.rel.ro,"aw",%progbits
+ .p2align 3
+ .type fun_ptr, %object
+fun_ptr:
+ .dc.a fun
+ .size fun_ptr, .-fun_ptr