# Test linking directly to S-records.
# By Ian Lance Taylor, Cygnus Support.
-# Copyright (C) 1999-2016 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# Tell the ELF linker to not do anything clever with .eh_frame,
# not to put anything in small data, and define various symbols.
- set flags "--traditional-format -G 0 "
- append flags [ld_simple_link_defsyms]
+ set flags "--traditional-format -G 0 -e 0 "
+ append flags [ld_link_defsyms]
# If the linker script uses SIZEOF_HEADERS, use a -Ttext argument
# to force both the normal link and the S-record link to be put in
setup_xfail "msp430*-*-*"
}
- # 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*-*-*"
+ # The RISC-V target does not correctly process
+ # relocs when output format is not ELF.
+ if [istarget riscv*-*-*] {
+ setup_xfail "riscv*-*-*"
}
# V850 targets need libgcc.a
set flags "$flags -no-relax"
}
- if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \
- || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } {
+ if { ![ld_link $ld tmpdir/sr1 "$flags $objs"] \
+ || ![ld_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } {
fail $test
return
}
}
# Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records
-# tests.
-global PLT_CFLAGS
+# tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work
+# with S-records.
+global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS
set old_CC "$CC"
-set CC "$CC $PLT_CFLAGS"
+set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
set old_CXX "$CXX"
-set CXX "$CXX $PLT_CFLAGS"
+set CXX "$CXX $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
|| ![ld_compile $CC $srcdir/$subdir/sr2.c tmpdir/sr2.o] } {
# generate the format if need be).
setup_xfail "tile*-*-*"
+# The S-record linker is not supported for C-SKY.
+setup_xfail "csky*-*-*"
+
run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
# Now try linking a C++ program with global constructors and
setup_xfail "score-*-*"
setup_xfail "bfin-*-linux-uclibc"
setup_xfail "tile*-*-*"
+setup_xfail "csky*-*-*"
run_srec_test $test2 "tmpdir/sr3.o"