]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-srec/srec.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-srec / srec.exp
index 7cda271039ea58ac644d8a488d7d90132808f17a..c6c3fd0b1e81e2e8a60989f2d931da0b34c107f4 100644 (file)
@@ -1,6 +1,6 @@
 # Test linking directly to S-records.
 # By Ian Lance Taylor, Cygnus Support.
-#   Copyright (C) 1999-2018 Free Software Foundation, Inc.
+#   Copyright (C) 1999-2021 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -288,14 +288,6 @@ proc run_srec_test { test objs } {
        setup_xfail "riscv*-*-*"
     }
 
-    # SH64 targets cannot convert format in the linker 
-    # using the -oformat command line switch.
-    if [istarget sh64*-*-elf] {
-        # This is what gcc passes to ld by default.
-        set flags "$flags -mshelf32"
-       setup_xfail "sh64*-*-*"
-    }
-
     # V850 targets need libgcc.a
     if [istarget v850*-*-elf] {
        set objs "$objs -L ../gcc -lgcc"
@@ -350,7 +342,7 @@ set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output]
 # directly to the S-record format, and require that the two files
 # contain the same data.
 
-if { ![is_remote host] && [which $CC] == 0 } {
+if { ![check_compiler_available] } {
     untested $test1
     untested $test2
     return
@@ -358,12 +350,20 @@ if { ![is_remote host] && [which $CC] == 0 } {
 
 # Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records
 # tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work
-# with S-records.
-global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS
+# with S-records.  Also add $NOCF_PROTECTION_CFLAGS for S-records.
+# Also add $NOSANITIZE_CFLAGS for S-records.
 set old_CC "$CC"
-set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
+set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
 set old_CXX "$CXX"
-set CXX "$CXX $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
+set old_CXXFLAGS "$CXXFLAGS"
+set CXXFLAGS "$CXXFLAGS $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
+
+# S-records can't handle .note.gnu.property sections.
+if { [is_elf_format] \
+     && ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
+    set CC "$CC -Wa,-mx86-used-note=no"
+    set CXX "$CXX -Wa,-mx86-used-note=no"
+}
 
 if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
      || ![ld_compile $CC $srcdir/$subdir/sr2.c tmpdir/sr2.o] } {
@@ -371,6 +371,7 @@ if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
     unresolved $test2
     set CC "$old_CC"
     set CXX "$old_CXX"
+    set CXXFLAGS "$old_CXXFLAGS"
     return
 }
 
@@ -385,7 +386,9 @@ setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
 
 # The S-record linker doesn't do the magic TOC handling that XCOFF
 # linkers do.
-setup_xfail "*-*-aix*" "*-*-xcoff*"
+if [is_xcoff_format] {
+    setup_xfail *-*-*
+}
 
 # The S-record linker is not supported for ARC.
 setup_xfail "arc*-*-*"
@@ -426,6 +429,12 @@ setup_xfail "bfin-*-linux-uclibc"
 # generate the format if need be).
 setup_xfail "tile*-*-*"
 
+# The S-record linker is not supported for C-SKY.
+setup_xfail "csky*-*-*"
+
+# The S-record linker is not supported for eBPF.
+setup_xfail "bpf-*-*"
+
 run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
 
 # Now try linking a C++ program with global constructors and
@@ -436,6 +445,7 @@ if { ![is_remote host] && [which $CXX] == 0 } {
     untested $test2
     set CC "$old_CC"
     set CXX "$old_CXX"
+    set CXXFLAGS "$old_CXXFLAGS"
     return
 }
 
@@ -443,13 +453,16 @@ if ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/s
     unresolved $test2
     set CC "$old_CC"
     set CXX "$old_CXX"
+    set CXXFLAGS "$old_CXXFLAGS"
     return
 }
 
 # See above.
 setup_xfail "i*86-*-aout*"
 setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
-setup_xfail "*-*-aix*" "*-*-xcoff*"
+if [is_xcoff_format] {
+    setup_xfail *-*-*
+}
 setup_xfail "arc*-*-*"
 setup_xfail "arm*-*-*"
 setup_xfail "v850*-*-elf"
@@ -461,8 +474,11 @@ setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
 setup_xfail "score-*-*"
 setup_xfail "bfin-*-linux-uclibc"
 setup_xfail "tile*-*-*"
+setup_xfail "csky*-*-*"
+setup_xfail "bpf-*-*"
 
 run_srec_test $test2 "tmpdir/sr3.o"
 
 set CC "$old_CC"
 set CXX "$old_CXX"
+set CXXFLAGS "$old_CXXFLAGS"