aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-shared
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-shared')
-rw-r--r--ld/testsuite/ld-shared/shared.exp31
1 files changed, 31 insertions, 0 deletions
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 479bf76..7987b02 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -66,6 +66,7 @@ if { [istarget *-*-linux*aout*] \
set tmpdir tmpdir
set SHCFLAG ""
+set shared_needs_pic "no"
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
@@ -97,6 +98,27 @@ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
close $file
}
+if [istarget arm*-*-linux*] {
+ # On ARM section anchors can change the symbol pre-emptability for
+ # non-PIC shared libraries, causing these tests to fail. Turn section
+ # anchors off.
+ set SHCFLAG "-fno-section-anchors"
+
+ # On targets that have MOVW the compiler will emit relocations which
+ # the linker doesn't support when compiling -shared without -fpic. The
+ # test to find out whether we want to XFAIL the non-PIC tests requires
+ # a compile - so we pre-calculate it here. We also note that this can
+ # only affect arm*-*-*eabi targets as the old ABI doesn't support v7.
+ if [istarget arm*-*-*eabi] {
+ set file [open $tmpdir/movw-detect.c w]
+ puts $file "void foo(void) { __asm (\"movw r0, #0\"); }"
+ close $file
+ if [run_host_cmd_yesno "$CC" "$CFLAGS -c $tmpdir/movw-detect.c -o $tmpdir/movw-detect.o"] {
+ set shared_needs_pic "yes"
+ }
+ }
+}
+
# The test procedure.
proc shared_test { progname testname main sh1 sh2 dat args } {
global CC
@@ -212,6 +234,9 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
}
setup_xfail "x86_64-*-linux*"
setup_xfail "s390x-*-linux*"
+ if [ string match $shared_needs_pic "yes" ] {
+ setup_xfail "arm*-*-linux*"
+ }
shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
# Test ELF shared library relocations with a non-zero load
@@ -232,6 +257,9 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
}
setup_xfail "x86_64-*-linux*"
setup_xfail "s390x-*-linux*"
+ if [ string match $shared_needs_pic "yes" ] {
+ setup_xfail "arm*-*-linux*"
+ }
shared_test shnp "shared (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o shared \
"-T $srcdir/$subdir/elf-offset.ld"
@@ -281,6 +309,9 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
}
setup_xfail "x86_64-*-linux*"
setup_xfail "s390x-*-linux*"
+ if [ string match $shared_needs_pic "yes" ] {
+ setup_xfail "arm*-*-linux*"
+ }
shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
}
} else {