From d98164028637041c5de99af0d057bde3f168a8a8 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 2 Jan 2017 22:45:37 +1030 Subject: Run more ld tests when not native Many of the ld tests are not run for cross builds, in some cases because the test needs to run a newly linked executable, and in others simply because it was easier to write the test for native only. Even when a test needs to run, it's good to compile and link to exercise the linker. So that's what this patch does. I've also rid us of the old ld_link procedure with all the HOSTING_CRT0 etc. setup. It's much simpler to just link with $CC. This does mean that a cross build with cross-compiler installed but no cross C-library will give lots of failures. If that turns out to be too annoying, I guess we can write a tcl procedure to detect it and not run all the extra tests. * Makefile.am (bootstrap): Delete rule. (ld-partial, ld1, ld1-full, ld2, ld3): Likewise. (HOSTING_CRT0, HOSTING_SCRT0): Don't define. (HOSTING_LIBS, HOSTING_SLIBS, HOSTING_EMU): Likewise. * configure.ac (HOSTING_CRT0, HOSTING_SCRT0): Don't define. (HOSTING_LIBS, HOSTING_SLIBS): Likewise. * configure.host (HOSTING_CRT0, HOSTING_LIBS): Don't define. * Makefile.in: Regenerate. * configure: Regenerate. * testsuite/config/default.exp (get_link_files): Delete. (HOSTING_CRT0, HOSTING_SCRT0, HOSTING_LIBS, HOSTING_SLIBS): Don't define. (ld_simple_link): Delete. * testsuite/lib/ld-lib.exp (default_ld_link): Delete (default_ld_simple_link): Rename to default_ld_link. (ld_simple_link_defsyms): Rename to ld_link_defsyms. (run_ld_link_tests): Use ld_link, not ld_simple_link. (run_cc_link_tests): Likewise. (run_ld_link_exec_tests): Use $CC or $CXX to link, not $ld. Don't run exe when not native, and return unsupported. * testsuite/ld-bootstrap/bootstrap.exp: Create gccld1 etc. dirs. Link ld1 etc. using $CC. * testsuite/ld-cdtest/cdtest.exp: Link cdtest using $CC. * testsuite/ld-checks/checks.exp: Use ld_link, not ld_simple_link. * testsuite/ld-cygwin/exe-export.exp: Likewise. * testsuite/ld-elf/binutils.exp: Likewise. * testsuite/ld-elf/eh-group.exp: Likewise. * testsuite/ld-elf/exclude.exp: Likewise. * testsuite/ld-elf/frame.exp: Likewise. * testsuite/ld-elf/sec-to-seg.exp: Likewise. * testsuite/ld-elf/tls_common.exp: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Likewise. * testsuite/ld-fastcall/fastcall.exp: Likewise. * testsuite/ld-gc/gc.exp: Likewise. * testsuite/ld-ifunc/binutils.exp: Likewise. * testsuite/ld-mep/mep.exp: Likewise. * testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise. * testsuite/ld-mn10300/mn10300.exp: Likewise. * testsuite/ld-nios2/nios2.exp: Likewise. * testsuite/ld-pe/pe-compile.exp: Likewise. * testsuite/ld-pe/pe-run.exp: Likewise. * testsuite/ld-pe/pe-run2.exp: Likewise. * testsuite/ld-plugin/plugin.exp: Likewise. * testsuite/ld-scripts/align.exp: Likewise. * testsuite/ld-scripts/alignof.exp: Likewise. * testsuite/ld-scripts/assert.exp: Likewise. * testsuite/ld-scripts/defined.exp: Likewise. * testsuite/ld-scripts/extern.exp: Likewise. * testsuite/ld-scripts/log2.exp: Likewise. * testsuite/ld-scripts/map-address.exp: Likewise. * testsuite/ld-scripts/phdrs.exp: Likewise. * testsuite/ld-scripts/phdrs2.exp: Likewise. * testsuite/ld-scripts/script.exp: Likewise. * testsuite/ld-scripts/section-flags.exp: Likewise. * testsuite/ld-scripts/sizeof.exp: Likewise. * testsuite/ld-scripts/sysroot-prefix.exp: Likewise. * testsuite/ld-scripts/weak.exp: Likewise. * testsuite/ld-selective/selective.exp: Likewise. * testsuite/ld-sh/sh.exp: Likewise. * testsuite/ld-sh/sh64/relax.exp: Likewise. * testsuite/ld-sh/sh64/relfail.exp: Likewise. * testsuite/ld-srec/srec.exp: Likewise. * testsuite/ld-tic6x/tic6x.exp: Likewise. * testsuite/ld-undefined/weak-undef.exp: Likewise. * testsuite/ld-versados/versados.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Likewise. * testsuite/ld-xtensa/coalesce.exp: Likewise. * testsuite/ld-xtensa/diff_overflow.exp: Likewise. * testsuite/ld-xtensa/lcall.exp: Likewise. * testsuite/ld-elf/audit.exp: Run non-native too. * testsuite/ld-elf/compress.exp: Likewise. Replace ld options with gcc -Wl, options. * testsuite/ld-elf/dwarf.exp: Run non-native too. Use ld_link, not ld_simple_link. Add -Wl,--no-as-needed to some tests. * testsuite/ld-elf/elf.exp: Run non-native too. Formatting. * testsuite/ld-elf/indirect.exp: Run non-native too. Add -Wl,--no-as-needed to most tests. * testsuite/ld-elf/shared.exp: Run non-native too. Use braces to simplify quoting. Set run_tests using [list] rather than brace assignment to expand $extralibs. Add -Wl,--no-as-needed to many test. Prefix ld options with -Wl,. (mix_pic_and_non_pic): Don't run exe if not native. * testsuite/ld-elf/wrap.exp: Run non-native too. Add -Wl,--no-as-needed and prefix ld options with -Wl,. * testsuite/ld-elfvers/vers.exp: Run non-native too. Use ld_link, not ld_simple_link. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. (visibility_test): Don't run exe if not native. * testsuite/ld-elfweak/elfweak.exp: Run non-native too. Use ld_link, not ld_simple_link. (build_exec): Don't run exe if not native. * testsuite/ld-ifunc/ifunc.exp: Run non-native too. Use ld_link, not ld_simple_link. Link using $CC. Add -Wl,--no-as-needed to some tests and prefix ld options with -Wl,. Expect GNU for hppa-linux even when no ifuncs. Delete cleanup. * testsuite/ld-pie/pie.exp: Run non-native too. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-shared/shared.exp: Likewise. Use ld_link, not ld_simple_link. (shared_test): Don't run exe if not native. * testsuite/ld-size/size.exp: Run non-native too. Add -Wl,--no-as-needed to some tests. Prefix ld options with -Wl,. * testsuite/ld-unique/unique.exp: Run non-native too. Use ld_link, not ld_simple_link. Link using $CC. Add -Wl,--no-as-needed to some tests and prefix ld options with -Wl,. Expect GNU for hppa-linux even when no unique syms. Delete cleanup. * testsuite/ld-x86-64/tls.exp: Add -Wl,--no-as-needed to some tests and prefix ld options with -Wl,. * testsuite/ld-x86-64/x86-64.exp: Use ld_link, not ld_simple_link. Add -Wl,--no-as-needed to some tests. Prefix ld options with -Wl,. --- ld/ChangeLog | 113 ++++++++++ ld/Makefile.am | 61 ------ ld/Makefile.in | 61 ------ ld/configure | 12 +- ld/configure.ac | 4 - ld/configure.host | 231 +------------------- ld/testsuite/config/default.exp | 35 --- ld/testsuite/ld-bootstrap/bootstrap.exp | 60 ++--- ld/testsuite/ld-cdtest/cdtest.exp | 4 +- ld/testsuite/ld-checks/checks.exp | 4 +- ld/testsuite/ld-cygwin/exe-export.exp | 2 +- ld/testsuite/ld-elf/audit.exp | 5 - ld/testsuite/ld-elf/binutils.exp | 2 +- ld/testsuite/ld-elf/compress.exp | 17 +- ld/testsuite/ld-elf/dwarf.exp | 9 +- ld/testsuite/ld-elf/eh-group.exp | 2 +- ld/testsuite/ld-elf/elf.exp | 44 ++-- ld/testsuite/ld-elf/exclude.exp | 14 +- ld/testsuite/ld-elf/frame.exp | 4 +- ld/testsuite/ld-elf/indirect.exp | 37 ++-- ld/testsuite/ld-elf/sec-to-seg.exp | 2 +- ld/testsuite/ld-elf/shared.exp | 325 ++++++++++++++-------------- ld/testsuite/ld-elf/tls_common.exp | 8 +- ld/testsuite/ld-elf/wrap.exp | 9 +- ld/testsuite/ld-elfcomm/elfcomm.exp | 10 +- ld/testsuite/ld-elfvers/vers.exp | 12 +- ld/testsuite/ld-elfvsb/elfvsb.exp | 27 ++- ld/testsuite/ld-elfweak/elfweak.exp | 22 +- ld/testsuite/ld-fastcall/fastcall.exp | 2 +- ld/testsuite/ld-gc/gc.exp | 8 +- ld/testsuite/ld-ifunc/binutils.exp | 2 +- ld/testsuite/ld-ifunc/ifunc.exp | 63 ++---- ld/testsuite/ld-mep/mep.exp | 2 +- ld/testsuite/ld-mips-elf/mips-elf-flags.exp | 4 +- ld/testsuite/ld-mn10300/mn10300.exp | 4 +- ld/testsuite/ld-nios2/nios2.exp | 2 +- ld/testsuite/ld-pe/pe-compile.exp | 4 +- ld/testsuite/ld-pe/pe-run.exp | 12 +- ld/testsuite/ld-pe/pe-run2.exp | 12 +- ld/testsuite/ld-pie/pie.exp | 9 +- ld/testsuite/ld-plugin/lto.exp | 5 - ld/testsuite/ld-plugin/plugin.exp | 2 +- ld/testsuite/ld-scripts/align.exp | 2 +- ld/testsuite/ld-scripts/alignof.exp | 2 +- ld/testsuite/ld-scripts/assert.exp | 2 +- ld/testsuite/ld-scripts/defined.exp | 2 +- ld/testsuite/ld-scripts/extern.exp | 2 +- ld/testsuite/ld-scripts/log2.exp | 2 +- ld/testsuite/ld-scripts/map-address.exp | 2 +- ld/testsuite/ld-scripts/phdrs.exp | 2 +- ld/testsuite/ld-scripts/phdrs2.exp | 2 +- ld/testsuite/ld-scripts/script.exp | 8 +- ld/testsuite/ld-scripts/section-flags.exp | 2 +- ld/testsuite/ld-scripts/sizeof.exp | 2 +- ld/testsuite/ld-scripts/sysroot-prefix.exp | 2 +- ld/testsuite/ld-scripts/weak.exp | 2 +- ld/testsuite/ld-selective/selective.exp | 2 +- ld/testsuite/ld-sh/sh.exp | 8 +- ld/testsuite/ld-sh/sh64/relax.exp | 2 +- ld/testsuite/ld-sh/sh64/relfail.exp | 2 +- ld/testsuite/ld-shared/shared.exp | 15 +- ld/testsuite/ld-size/size.exp | 24 +- ld/testsuite/ld-srec/srec.exp | 6 +- ld/testsuite/ld-tic6x/tic6x.exp | 12 +- ld/testsuite/ld-undefined/weak-undef.exp | 6 +- ld/testsuite/ld-unique/unique.exp | 40 +--- ld/testsuite/ld-versados/versados.exp | 4 +- ld/testsuite/ld-x86-64/dwarfreloc.exp | 4 +- ld/testsuite/ld-x86-64/tls.exp | 12 +- ld/testsuite/ld-x86-64/x86-64.exp | 48 ++-- ld/testsuite/ld-xtensa/coalesce.exp | 2 +- ld/testsuite/ld-xtensa/diff_overflow.exp | 2 +- ld/testsuite/ld-xtensa/lcall.exp | 2 +- ld/testsuite/lib/ld-lib.exp | 58 +---- 74 files changed, 596 insertions(+), 954 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 1fb60ed..c216229 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,118 @@ 2017-01-02 Alan Modra + * Makefile.am (bootstrap): Delete rule. + (ld-partial, ld1, ld1-full, ld2, ld3): Likewise. + (HOSTING_CRT0, HOSTING_SCRT0): Don't define. + (HOSTING_LIBS, HOSTING_SLIBS, HOSTING_EMU): Likewise. + * configure.ac (HOSTING_CRT0, HOSTING_SCRT0): Don't define. + (HOSTING_LIBS, HOSTING_SLIBS): Likewise. + * configure.host (HOSTING_CRT0, HOSTING_LIBS): Don't define. + * Makefile.in: Regenerate. + * configure: Regenerate. + * testsuite/config/default.exp (get_link_files): Delete. + (HOSTING_CRT0, HOSTING_SCRT0, HOSTING_LIBS, HOSTING_SLIBS): Don't + define. + (ld_simple_link): Delete. + * testsuite/lib/ld-lib.exp (default_ld_link): Delete + (default_ld_simple_link): Rename to default_ld_link. + (ld_simple_link_defsyms): Rename to ld_link_defsyms. + (run_ld_link_tests): Use ld_link, not ld_simple_link. + (run_cc_link_tests): Likewise. + (run_ld_link_exec_tests): Use $CC or $CXX to link, not $ld. + Don't run exe when not native, and return unsupported. + * testsuite/ld-bootstrap/bootstrap.exp: Create gccld1 etc. dirs. + Link ld1 etc. using $CC. + * testsuite/ld-cdtest/cdtest.exp: Link cdtest using $CC. + * testsuite/ld-checks/checks.exp: Use ld_link, not ld_simple_link. + * testsuite/ld-cygwin/exe-export.exp: Likewise. + * testsuite/ld-elf/binutils.exp: Likewise. + * testsuite/ld-elf/eh-group.exp: Likewise. + * testsuite/ld-elf/exclude.exp: Likewise. + * testsuite/ld-elf/frame.exp: Likewise. + * testsuite/ld-elf/sec-to-seg.exp: Likewise. + * testsuite/ld-elf/tls_common.exp: Likewise. + * testsuite/ld-elfcomm/elfcomm.exp: Likewise. + * testsuite/ld-fastcall/fastcall.exp: Likewise. + * testsuite/ld-gc/gc.exp: Likewise. + * testsuite/ld-ifunc/binutils.exp: Likewise. + * testsuite/ld-mep/mep.exp: Likewise. + * testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise. + * testsuite/ld-mn10300/mn10300.exp: Likewise. + * testsuite/ld-nios2/nios2.exp: Likewise. + * testsuite/ld-pe/pe-compile.exp: Likewise. + * testsuite/ld-pe/pe-run.exp: Likewise. + * testsuite/ld-pe/pe-run2.exp: Likewise. + * testsuite/ld-plugin/plugin.exp: Likewise. + * testsuite/ld-scripts/align.exp: Likewise. + * testsuite/ld-scripts/alignof.exp: Likewise. + * testsuite/ld-scripts/assert.exp: Likewise. + * testsuite/ld-scripts/defined.exp: Likewise. + * testsuite/ld-scripts/extern.exp: Likewise. + * testsuite/ld-scripts/log2.exp: Likewise. + * testsuite/ld-scripts/map-address.exp: Likewise. + * testsuite/ld-scripts/phdrs.exp: Likewise. + * testsuite/ld-scripts/phdrs2.exp: Likewise. + * testsuite/ld-scripts/script.exp: Likewise. + * testsuite/ld-scripts/section-flags.exp: Likewise. + * testsuite/ld-scripts/sizeof.exp: Likewise. + * testsuite/ld-scripts/sysroot-prefix.exp: Likewise. + * testsuite/ld-scripts/weak.exp: Likewise. + * testsuite/ld-selective/selective.exp: Likewise. + * testsuite/ld-sh/sh.exp: Likewise. + * testsuite/ld-sh/sh64/relax.exp: Likewise. + * testsuite/ld-sh/sh64/relfail.exp: Likewise. + * testsuite/ld-srec/srec.exp: Likewise. + * testsuite/ld-tic6x/tic6x.exp: Likewise. + * testsuite/ld-undefined/weak-undef.exp: Likewise. + * testsuite/ld-versados/versados.exp: Likewise. + * testsuite/ld-x86-64/dwarfreloc.exp: Likewise. + * testsuite/ld-xtensa/coalesce.exp: Likewise. + * testsuite/ld-xtensa/diff_overflow.exp: Likewise. + * testsuite/ld-xtensa/lcall.exp: Likewise. + * testsuite/ld-elf/audit.exp: Run non-native too. + * testsuite/ld-elf/compress.exp: Likewise. Replace ld options with + gcc -Wl, options. + * testsuite/ld-elf/dwarf.exp: Run non-native too. Use ld_link, + not ld_simple_link. Add -Wl,--no-as-needed to some tests. + * testsuite/ld-elf/elf.exp: Run non-native too. Formatting. + * testsuite/ld-elf/indirect.exp: Run non-native too. Add + -Wl,--no-as-needed to most tests. + * testsuite/ld-elf/shared.exp: Run non-native too. Use braces + to simplify quoting. Set run_tests using [list] rather than + brace assignment to expand $extralibs. Add -Wl,--no-as-needed + to many test. Prefix ld options with -Wl,. + (mix_pic_and_non_pic): Don't run exe if not native. + * testsuite/ld-elf/wrap.exp: Run non-native too. Add + -Wl,--no-as-needed and prefix ld options with -Wl,. + * testsuite/ld-elfvers/vers.exp: Run non-native too. Use ld_link, + not ld_simple_link. + * testsuite/ld-elfvsb/elfvsb.exp: Likewise. + (visibility_test): Don't run exe if not native. + * testsuite/ld-elfweak/elfweak.exp: Run non-native too. Use ld_link, + not ld_simple_link. + (build_exec): Don't run exe if not native. + * testsuite/ld-ifunc/ifunc.exp: Run non-native too. Use ld_link, + not ld_simple_link. Link using $CC. Add -Wl,--no-as-needed + to some tests and prefix ld options with -Wl,. Expect GNU + for hppa-linux even when no ifuncs. Delete cleanup. + * testsuite/ld-pie/pie.exp: Run non-native too. + * testsuite/ld-plugin/lto.exp: Likewise. + * testsuite/ld-shared/shared.exp: Likewise. Use ld_link, + not ld_simple_link. + (shared_test): Don't run exe if not native. + * testsuite/ld-size/size.exp: Run non-native too. Add + -Wl,--no-as-needed to some tests. Prefix ld options with -Wl,. + * testsuite/ld-unique/unique.exp: Run non-native too. Use ld_link, + not ld_simple_link. Link using $CC. Add -Wl,--no-as-needed + to some tests and prefix ld options with -Wl,. Expect GNU + for hppa-linux even when no unique syms. Delete cleanup. + * testsuite/ld-x86-64/tls.exp: Add -Wl,--no-as-needed to some + tests and prefix ld options with -Wl,. + * testsuite/ld-x86-64/x86-64.exp: Use ld_link, not ld_simple_link. + Add -Wl,--no-as-needed to some tests. Prefix ld options with -Wl,. + +2017-01-02 Alan Modra + * emulparams/elf32metag.sh (COMMONPAGESIZE): Define. 2017-01-02 Alan Modra diff --git a/ld/Makefile.am b/ld/Makefile.am index 21e0aeb..3a3e34d 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -88,13 +88,6 @@ TEXI2POD = perl $(BASEDIR)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ --release="binutils-$(VERSION)" --section=1 -#stuff for self hosting (can be overridden in config file). -HOSTING_CRT0 = @HOSTING_CRT0@ -HOSTING_SCRT0 = @HOSTING_SCRT0@ -HOSTING_LIBS = @HOSTING_LIBS@ -HOSTING_SLIBS = @HOSTING_SLIBS@ -HOSTING_EMU = -m $(EMUL) - # Setup the testing framework, if you have one EXPECT = expect RUNTEST = runtest @@ -2118,60 +2111,6 @@ check-DEJAGNU: site.exp else echo "WARNING: could not find \`runtest'" 1>&2; :;\ fi -# Rules for testing by relinking ld itself. -# A similar test is in the testsuite. This target is for ease of use -# when porting ld. - -ld-partial.@OBJEXT@: ld-new$(EXEEXT) - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld-partial.@OBJEXT@ -r $(OFILES) -ld1$(EXEEXT): ld-partial.@OBJEXT@ - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.@OBJEXT@ $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -ld1-full$(EXEEXT): ld-new - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -ld2$(EXEEXT): ld1$(EXEEXT) - ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -ld3$(EXEEXT): ld2$(EXEEXT) - ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -bootstrap: ld3$(EXEEXT) - cmp ld2$(EXEEXT) ld3$(EXEEXT) - -.PHONY: bootstrap - -# A test program for C++ constructors and destructors. -# This test is now in the testsuite. -# -#cdtest: cdtest-main.@OBJEXT@ cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \ -# cdtest-main.@OBJEXT@ cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ $(HOSTING_LIBS) -# -#cdtest.out: cdtest -# ./cdtest > cdtest.tmp -# mv cdtest.tmp cdtest.out -# -#cdtest-ur.@OBJEXT@: cdtest-main.@OBJEXT@ cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest-ur.@OBJEXT@ -Ur cdtest-main.@OBJEXT@ \ -# cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ -# -#cdtest-ur: cdtest-ur.@OBJEXT@ -# ./ld.new $(HOSTING_EMU) -o cdtest-ur $(HOSTING_CRT0) cdtest-ur.@OBJEXT@ \ -# $(HOSTING_LIBS) -# -#cdtest-ur.out: cdtest-ur -# ./cdtest-ur > cdtest-ur.tmp -# mv cdtest-ur.tmp cdtest-ur.out -# -#check-cdtest: cdtest.out cdtest-ur.out $(srcdir)/cdtest.exp -# diff $(srcdir)/cdtest.exp cdtest.out -# diff $(srcdir)/cdtest.exp cdtest-ur.out -# -#.PHONY: check-cdtest - -# END OF CHECK TARGETS - # # Build a dummy plugin using libtool. # diff --git a/ld/Makefile.in b/ld/Makefile.in index 80d97c1..9c5f77e 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -282,12 +282,6 @@ GENCAT = @GENCAT@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ HDEFINES = @HDEFINES@ - -#stuff for self hosting (can be overridden in config file). -HOSTING_CRT0 = @HOSTING_CRT0@ -HOSTING_LIBS = @HOSTING_LIBS@ -HOSTING_SCRT0 = @HOSTING_SCRT0@ -HOSTING_SLIBS = @HOSTING_SLIBS@ INCINTL = @INCINTL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -466,7 +460,6 @@ TEXI2POD = perl $(BASEDIR)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ --release="binutils-$(VERSION)" --section=1 -HOSTING_EMU = -m $(EMUL) # Setup the testing framework, if you have one EXPECT = expect @@ -955,37 +948,6 @@ ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) \ ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) -# A test program for C++ constructors and destructors. -# This test is now in the testsuite. -# -#cdtest: cdtest-main.@OBJEXT@ cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \ -# cdtest-main.@OBJEXT@ cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ $(HOSTING_LIBS) -# -#cdtest.out: cdtest -# ./cdtest > cdtest.tmp -# mv cdtest.tmp cdtest.out -# -#cdtest-ur.@OBJEXT@: cdtest-main.@OBJEXT@ cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest-ur.@OBJEXT@ -Ur cdtest-main.@OBJEXT@ \ -# cdtest-bar.@OBJEXT@ cdtest-foo.@OBJEXT@ -# -#cdtest-ur: cdtest-ur.@OBJEXT@ -# ./ld.new $(HOSTING_EMU) -o cdtest-ur $(HOSTING_CRT0) cdtest-ur.@OBJEXT@ \ -# $(HOSTING_LIBS) -# -#cdtest-ur.out: cdtest-ur -# ./cdtest-ur > cdtest-ur.tmp -# mv cdtest-ur.tmp cdtest-ur.out -# -#check-cdtest: cdtest.out cdtest-ur.out $(srcdir)/cdtest.exp -# diff $(srcdir)/cdtest.exp cdtest.out -# diff $(srcdir)/cdtest.exp cdtest-ur.out -# -#.PHONY: check-cdtest - -# END OF CHECK TARGETS - # # Build a dummy plugin using libtool. # @@ -3692,29 +3654,6 @@ check-DEJAGNU: site.exp else echo "WARNING: could not find \`runtest'" 1>&2; :;\ fi -# Rules for testing by relinking ld itself. -# A similar test is in the testsuite. This target is for ease of use -# when porting ld. - -ld-partial.@OBJEXT@: ld-new$(EXEEXT) - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld-partial.@OBJEXT@ -r $(OFILES) -ld1$(EXEEXT): ld-partial.@OBJEXT@ - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.@OBJEXT@ $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -ld1-full$(EXEEXT): ld-new - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -ld2$(EXEEXT): ld1$(EXEEXT) - ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -ld3$(EXEEXT): ld2$(EXEEXT) - ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS) - -bootstrap: ld3$(EXEEXT) - cmp ld2$(EXEEXT) ld3$(EXEEXT) - -.PHONY: bootstrap - # DOCUMENTATION TARGETS # Manual configuration file; not usually attached to normal configuration, # because almost all configs use "gen" version of manual. diff --git a/ld/configure b/ld/configure index b3cf784..c238f54 100755 --- a/ld/configure +++ b/ld/configure @@ -616,10 +616,6 @@ enable_initfini_array ENABLE_PLUGINS_FALSE ENABLE_PLUGINS_TRUE NATIVE_LIB_DIRS -HOSTING_SLIBS -HOSTING_LIBS -HOSTING_SCRT0 -HOSTING_CRT0 HDEFINES do_compare GENINSRC_NEVER_FALSE @@ -11724,7 +11720,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11727 "configure" +#line 11723 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11830,7 +11826,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11833 "configure" +#line 11829 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16411,10 +16407,6 @@ do_compare="$gcc_cv_prog_cmp_skip" - - - - for ac_header in string.h strings.h stdlib.h unistd.h elf-hints.h limits.h locale.h sys/param.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` diff --git a/ld/configure.ac b/ld/configure.ac index 36a9f50..fe8eff6 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -206,10 +206,6 @@ ACX_PROG_CMP_IGNORE_INITIAL . ${srcdir}/configure.host AC_SUBST(HDEFINES) -AC_SUBST(HOSTING_CRT0) -AC_SUBST(HOSTING_SCRT0) -AC_SUBST(HOSTING_LIBS) -AC_SUBST(HOSTING_SLIBS) AC_SUBST(NATIVE_LIB_DIRS) AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h elf-hints.h limits.h locale.h sys/param.h) diff --git a/ld/configure.host b/ld/configure.host index 7632793..331ec0e 100644 --- a/ld/configure.host +++ b/ld/configure.host @@ -22,237 +22,10 @@ # This file sets the following shell variables: # HDEFINES host specific compiler flags -# HOSTING_CRT0 crt0.o file used for bootstrapping -# HOSTING_LIBS libraries used for bootstrapping HDEFINES= -HOSTING_CRT0=/lib/crt0.o -HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$$libgcc $$libgcc_eh"; fi; fi; if [ -f ../gcc/libunwind.a ]; then libgcc="$$libgcc ../gcc/libunwind.a"; else libunwind=\`${CC} -print-file-name=libunwind.a\`; if [ x"$$libunwind" != xlibunwind.a ]; then libgcc="$$libgcc $$libunwind"; fi; fi; echo --start-group $$libgcc -lc --end-group`' - -# -# Generic configurations: -# case "${host}" in - -*-*-dragonfly*) - HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.2\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.2` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`' - HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' - ;; - -*-*-freebsd* | *-*-kfreebsd*-gnu) - HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.1\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`' - HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' - ;; - -*-*-linux*aout* | *-*-linux*oldld) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -*-*-linux*libc1*) - HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' - ;; - -*-*-linux*) - HOSTING_CRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_SCRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=Scrt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbeginS.o ]; then echo ../gcc/crtbeginS.o; else ${CC} --print-file-name=crtbeginS.o; fi`' - HOSTING_SLIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtendS.o ]; then echo ../gcc/crtendS.o; else ${CC} --print-file-name=crtendS.o; fi` `${CC} --print-file-name=crtn.o`' - HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' - ;; - -*-*-gnu*) - # When creating static executables, we ought to use crt0.o instead of crt1.o, - # , - # but the testing infrastructure is not prepared for that. This is not - # relevant for most tests, and the few remaining ones have been XFAILed. - HOSTING_CRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so[^ ]*\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' - ;; - -*-*-netbsd*) - # Different versions of NetBSD with the ELF object format use different - # sets of start/end files. - HOSTING_CRT0='-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o' - if [ -f `${CC} --print-file-name=crti.o` ]; then - # Support for GCC's crtstuff present. - HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crti.o`" - if [ -f ../gcc/crtbegin.o ]; then - HOSTING_CRT0="$HOSTING_CRT0 ../gcc/crtbegin.o" - else - HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crtbegin.o`" - fi - else - # Support for GCC's crtstuff not present. - HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crtbegin.o`" - fi - if [ -f `${CC} --print-file-name=crtn.o` ]; then - # Support for GCC's crtstuff present. - if [ -f ../gcc/crtbegin.o ]; then - HOSTING_LIBS="$HOSTING_LIBS ../gcc/crtend.o" - else - HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtend.o`" - fi - HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtn.o`" - else - # Support for GCC's crtstuff not present. - HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtend.o`" - fi - ;; - -*-*-openbsd*) - HOSTING_CRT0="-dynamic-linker /usr/libexec/ld.so /usr/lib/crt0.o" - HOSTING_CRT0="$HOSTING_CRT0 /usr/lib/crtbegin.o" - HOSTING_LIBS="$HOSTING_LIBS /usr/lib/crtend.o" - ;; - + m88*-*-dgux*) + HDEFINES=-D__using_DGUX ;; esac - -# -# Now more specific configurations -# - -case "${host}" in - -*-*-linux*aout* | *-*-linux*oldld | *-*-linux*libc1*) - # No further tweaking needed - ;; - -arm*-*-linux-*) - HOSTING_CRT0='-p '"$HOSTING_CRT0" - ;; - -hppa*64*-*-hpux11*) - HOSTING_CRT0=/usr/ccs/lib/pa20_64/crt0.o - # Even if CC is not gcc, the tests use gcc. - HOSTING_LIBS='--start-group `if [ -f ../gcc/libgcc.a ]; then echo ../gcc/libgcc.a; else if test "$GCC" = yes; then ${CC} --print-libgcc-file-name; else gcc --print-libgcc-file-name; fi fi` -lc --end-group /usr/lib/pa20_64/milli.a' - ;; - -i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[12] | i[3-7]86-*-freebsd[12]\.* | i[3-7]86-*-freebsd*aout*) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -i[3-7]86-*-sysv4*) - HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o' - ;; - -i[3-7]86-sequent-ptx* | i[3-7]86-sequent-sysv*) - HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`' - ;; - -i[3-7]86-*-sysv*) - HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`' - HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o' - ;; - -i[3-7]86-*-solaris*) - HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`' - ;; - -i[3-7]86-*-sco* | i[3-7]86-*-isc*) - # In some configurations gcc does not use crtbegin.o and crtend.o. - # In that case gcc -print-file-name=crtbegin.o will simply print - # crtbegin.o. We create dummy crtbegin.o and crtend.o files to - # handle this. - echo "int dummy_crtbegin () { return 0; }" > crtbegin.c - ${CC} -c crtbegin.c -o crtbegin.o - rm -f crtbegin.c - echo "int dummy_crteng () { return 0; }" > crtend.c - ${CC} -c crtend.c -o crtend.o - rm -f crtend.c - HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o' - ;; - -i[3-7]86-pc-interix*) - HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o' - HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a' - ;; - -i[3-7]86-*-cygwin* | x86_64-*-cygwin*) - HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -L/usr/lib/w32api -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' - ;; - -i[3-7]86-*-mingw*) - #We only support msvcrt.dll, crtid == 2. - HOSTING_CRT0='/mingw/lib/crt2.o' - HOSTING_LIBS='-L/mingw/lib -lmingw32 -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lmoldname -lmingwex -lmsvcrt `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' - ;; - -mips*-sgi-irix4* | mips*-sgi-irix5*) - HOSTING_CRT0=/usr/lib/crt1.o - HOSTING_LIBS="$HOSTING_LIBS"' /usr/lib/crtn.o' - ;; - -mips*-sgi-irix6*) - HOSTING_CRT0='/usr/lib32/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o ; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='-L/usr/lib32 '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors' - ;; - -m68*-motorola-sysv) - HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`${CC} -print-file-name=\`crt0.o ]; then echo \`${CC} -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`' - HOSTING_LIBS=`sed -e 's,-lc,-lc881,' <tmpdir/cdtest.out\n" @@ -95,7 +95,7 @@ if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/c if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { fail $test2 } else { - if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] { + if ![ld_link $CC tmpdir/cdtest tmpdir/cdtest.o] { fail $test2 } else { send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" diff --git a/ld/testsuite/ld-checks/checks.exp b/ld/testsuite/ld-checks/checks.exp index 9775b34..b1c8454 100644 --- a/ld/testsuite/ld-checks/checks.exp +++ b/ld/testsuite/ld-checks/checks.exp @@ -43,7 +43,7 @@ proc section_check {} { return } - if ![ld_simple_link $ld tmpdir/asm.x "$ldflags tmpdir/asm.o"] { + if ![ld_link $ld tmpdir/asm.x "$ldflags tmpdir/asm.o"] { fail $test } else { pass $test @@ -55,7 +55,7 @@ proc section_check {} { # script is used. set ldflags "--check-sections -T $srcdir/$subdir/script -e foo" - # Perform the equivalent of invoking ld_simple_link + # Perform the equivalent of invoking ld_link # except that we need to massage the output further. set exec_output [run_host_cmd "$ld" "-o tmpdir/asm.x $ldflags tmpdir/asm.o"] diff --git a/ld/testsuite/ld-cygwin/exe-export.exp b/ld/testsuite/ld-cygwin/exe-export.exp index 4643bac..f3bf275 100644 --- a/ld/testsuite/ld-cygwin/exe-export.exp +++ b/ld/testsuite/ld-cygwin/exe-export.exp @@ -63,7 +63,7 @@ proc run_dlltool { lib_file def_file } { } # ld_special_link -# A copy of ld_simple_link (from ld-lib.exp) with extra +# A copy of ld_link (from ld-lib.exp) with extra # code to strip warnings about creating libraries. # proc ld_special_link { ld target objects } { diff --git a/ld/testsuite/ld-elf/audit.exp b/ld/testsuite/ld-elf/audit.exp index b278ec1..aad5339 100644 --- a/ld/testsuite/ld-elf/audit.exp +++ b/ld/testsuite/ld-elf/audit.exp @@ -25,11 +25,6 @@ if ![is_elf_format] { return } -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - # Check if compiler works if { [which $CC] == 0 } { return diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp index 2a41bdf..61e6031 100644 --- a/ld/testsuite/ld-elf/binutils.exp +++ b/ld/testsuite/ld-elf/binutils.exp @@ -61,7 +61,7 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options " return } - if { ![ld_simple_link $ld tmpdir/$test "$ld_options -z stack-size=0 tmpdir/$test.o"] } { + if { ![ld_link $ld tmpdir/$test "$ld_options -z stack-size=0 tmpdir/$test.o"] } { if { [string match "*not supported*" $link_output] || [string match "*unrecognized option*" $link_output] || [string match "*-z relro ignored*" $link_output] } { diff --git a/ld/testsuite/ld-elf/compress.exp b/ld/testsuite/ld-elf/compress.exp index a5c154f..b2b6ca1 100644 --- a/ld/testsuite/ld-elf/compress.exp +++ b/ld/testsuite/ld-elf/compress.exp @@ -25,11 +25,6 @@ if ![is_elf_format] { return } -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - # Check if compiler works if { [which $CC] == 0 } { return @@ -92,22 +87,22 @@ set run_tests { "tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o" "" {main.c} "normal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"} {"Run zlibnormal with libzlibfoo.so with zlib compressed debug sections" - "tmpdir/begin.o tmpdir/libzlibfoo.so tmpdir/end.o --compress-debug-sections=zlib" "" + "tmpdir/begin.o tmpdir/libzlibfoo.so tmpdir/end.o -Wl,--compress-debug-sections=zlib" "" {main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib"} {"Run zlibnormal with libfoozlib.so with zlib compressed debug sections" - "tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o --compress-debug-sections=zlib" "" + "tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o -Wl,--compress-debug-sections=zlib" "" {main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib"} {"Run gnunormal with libgnufoo.so with zlib-gnu compressed debug sections" - "tmpdir/gnubegin.o tmpdir/libgnufoo.so tmpdir/end.o --compress-debug-sections=zlib-gnu" "" + "tmpdir/gnubegin.o tmpdir/libgnufoo.so tmpdir/end.o -Wl,--compress-debug-sections=zlib-gnu" "" {main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu"} {"Run gnunormal with libfoozlib.so with zlib-gnu compressed debug sections" - "tmpdir/gnubegin.o tmpdir/libfoozlib.so tmpdir/end.o --compress-debug-sections=zlib-gnu" "" + "tmpdir/gnubegin.o tmpdir/libfoozlib.so tmpdir/end.o -Wl,--compress-debug-sections=zlib-gnu" "" {main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu"} {"Run gabinormal with libgabifoo.so with zlib-gabi compressed debug sections" - "tmpdir/zlibbegin.o tmpdir/libgabifoo.so tmpdir/gabiend.o --compress-debug-sections=zlib-gabi" "" + "tmpdir/zlibbegin.o tmpdir/libgabifoo.so tmpdir/gabiend.o -Wl,--compress-debug-sections=zlib-gabi" "" {main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"} {"Run gabinormal with libfoozlib.so with zlib-gabi compressed debug sections" - "tmpdir/zlibbegin.o tmpdir/libfoozlib.so tmpdir/gabiend.o --compress-debug-sections=zlib-gabi" "" + "tmpdir/zlibbegin.o tmpdir/libfoozlib.so tmpdir/gabiend.o -Wl,--compress-debug-sections=zlib-gabi" "" {main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"} } diff --git a/ld/testsuite/ld-elf/dwarf.exp b/ld/testsuite/ld-elf/dwarf.exp index 86b4896..572c704 100644 --- a/ld/testsuite/ld-elf/dwarf.exp +++ b/ld/testsuite/ld-elf/dwarf.exp @@ -29,11 +29,6 @@ if ![is_elf_format] { return } -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - # Check if compiler works if { [which $CC] == 0 } { return @@ -52,7 +47,7 @@ set build_tests { set run_tests { {"Run with libdwarf1.so first" - "tmpdir/libdwarf1.so" "" + "-Wl,--no-as-needed tmpdir/libdwarf1.so" "" {dwarf1main.c} "dwarf1a" "dwarf1.out" "-g -feliminate-dwarf2-dups"} {"Run with libdwarf1.so last" @@ -73,7 +68,7 @@ proc strip_test {} { set test_name "Strip -s $test" set prog $strip - if ![ld_simple_link $ld tmpdir/$test "-shared tmpdir/dwarf1.o"] { + if ![ld_link $ld tmpdir/$test "-shared tmpdir/dwarf1.o"] { unresolved "$test_name" return } diff --git a/ld/testsuite/ld-elf/eh-group.exp b/ld/testsuite/ld-elf/eh-group.exp index 17dd2f9..59f6092 100644 --- a/ld/testsuite/ld-elf/eh-group.exp +++ b/ld/testsuite/ld-elf/eh-group.exp @@ -65,7 +65,7 @@ set build_tests_ld [list \ run_ld_link_tests $build_tests_ld set testname "Link eh-group.o to eh-group" -if [ld_simple_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] { +if [ld_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] { pass $testname } else { fail $testname diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index e8b2d64..a5244e4 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -221,11 +221,6 @@ if { [istarget *-*-*linux*] set LDFLAGS $old_ldflags -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - if [check_gc_sections_available] { run_cc_link_tests { {"PR ld/13195" "-Wl,--gc-sections" "" @@ -234,23 +229,36 @@ if [check_gc_sections_available] { } set array_tests { - {"preinit array" "" "" {preinit.c} "preinit" "preinit.out"} - {"init array" "" "" {init.c} "init" "init.out"} - {"fini array" "" "" {fini.c} "fini" "fini.out"} - {"init array mixed" "" "" {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} + {"preinit array" "" "" + {preinit.c} "preinit" "preinit.out"} + {"init array" "" "" + {init.c} "init" "init.out"} + {"fini array" "" "" + {fini.c} "fini" "fini.out"} + {"init array mixed" "" "" + {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} } set array_tests_pie { - {"PIE preinit array" "-pie" "" {preinit.c} "preinit" "preinit.out" "-fPIE" } - {"PIE init array" "-pie" "" {init.c} "init" "init.out" "-fPIE"} - {"PIE fini array" "-pie" "" {fini.c} "fini" "fini.out" "-fPIE"} - {"PIE init array mixed" "-pie" "" {init-mixed.c} "init-mixed" "init-mixed.out" "-I. -fPIE"} - {"PIE PR ld/14525" "-pie" "" {pr14525.c} "pr14525" "pr14525.out" "-fPIE"} + {"PIE preinit array" "-pie" "" + {preinit.c} "preinit" "preinit.out" "-fPIE"} + {"PIE init array" "-pie" "" + {init.c} "init" "init.out" "-fPIE"} + {"PIE fini array" "-pie" "" + {fini.c} "fini" "fini.out" "-fPIE"} + {"PIE init array mixed" "-pie" "" + {init-mixed.c} "init-mixed" "init-mixed.out" "-I. -fPIE"} + {"PIE PR ld/14525" "-pie" "" + {pr14525.c} "pr14525" "pr14525.out" "-fPIE"} } set array_tests_static { - {"static preinit array" "-static" "" {preinit.c} "preinit" "preinit.out"} - {"static init array" "-static" "" {init.c} "init" "init.out"} - {"static fini array" "-static" "" {fini.c} "fini" "fini.out"} - {"static init array mixed" "-static" "" {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} + {"static preinit array" "-static" "" + {preinit.c} "preinit" "preinit.out"} + {"static init array" "-static" "" + {init.c} "init" "init.out"} + {"static fini array" "-static" "" + {fini.c} "fini" "fini.out"} + {"static init array mixed" "-static" "" + {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} } # NetBSD ELF systems do not currently support the .*_array sections. diff --git a/ld/testsuite/ld-elf/exclude.exp b/ld/testsuite/ld-elf/exclude.exp index 438fd02..9b6dd2f 100644 --- a/ld/testsuite/ld-elf/exclude.exp +++ b/ld/testsuite/ld-elf/exclude.exp @@ -70,7 +70,7 @@ if {![string match "" $catch_output]} { # Test that the symbol is normally exported. -if { [ld_simple_link $ld tmpdir/exclude.so "--shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } { +if { [ld_link $ld tmpdir/exclude.so "--shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } { pass $test1 } else { if [string match "*shared not supported*" $link_output] { @@ -92,7 +92,7 @@ if ![ld_nm $nm "-D" tmpdir/exclude.so] { # Test --exclude-libs libexclude -if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } { +if { [ld_link $ld tmpdir/exclude.so "--exclude-libs libexclude --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } { pass $test3 } else { fail $test3 @@ -109,7 +109,7 @@ if ![ld_nm $nm "-D" tmpdir/exclude.so] { # Test alternate spellings of --exclude-libs -if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] +if { [ld_link $ld tmpdir/exclude.so "--exclude-libs libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] && [ld_nm $nm "-D" tmpdir/exclude.so] && ! [info exists nm_output(exclude_common)] && ! [info exists nm_output(exclude_sym)] } { @@ -118,7 +118,7 @@ if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude.a --shared fail $test5 } -if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs ALL --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] +if { [ld_link $ld tmpdir/exclude.so "--exclude-libs ALL --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] && [ld_nm $nm "-D" tmpdir/exclude.so] && ! [info exists nm_output(exclude_common)] && ! [info exists nm_output(exclude_sym)] } { @@ -127,7 +127,7 @@ if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs ALL --shared tmpdir/e fail $test6 } -if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] +if { [ld_link $ld tmpdir/exclude.so "--exclude-libs foo:libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] && [ld_nm $nm "-D" tmpdir/exclude.so] && ! [info exists nm_output(exclude_common)] && ! [info exists nm_output(exclude_sym)] } { @@ -136,7 +136,7 @@ if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:libexclude.a --sh fail $test7 } -if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo,libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] +if { [ld_link $ld tmpdir/exclude.so "--exclude-libs foo,libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] && [ld_nm $nm "-D" tmpdir/exclude.so] && ! [info exists nm_output(exclude_common)] && ! [info exists nm_output(exclude_sym)] } { @@ -145,7 +145,7 @@ if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo,libexclude.a --sh fail $test8 } -if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:bar --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] +if { [ld_link $ld tmpdir/exclude.so "--exclude-libs foo:bar --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] && [ld_nm $nm "-D" tmpdir/exclude.so] && [info exists nm_output(exclude_common)] && [info exists nm_output(exclude_sym)] } { diff --git a/ld/testsuite/ld-elf/frame.exp b/ld/testsuite/ld-elf/frame.exp index 3363568..0ddd77e 100644 --- a/ld/testsuite/ld-elf/frame.exp +++ b/ld/testsuite/ld-elf/frame.exp @@ -64,7 +64,7 @@ if { ![ld_assemble_flags $as $as_opt $srcdir/$subdir/tbss.s tmpdir/tbss.o ] return } -if { [ld_simple_link $ld tmpdir/frame.so "--shared tmpdir/frame.o tmpdir/tbss.o"] } { +if { [ld_link $ld tmpdir/frame.so "--shared tmpdir/frame.o tmpdir/tbss.o"] } { pass "$test1" } else { if [string match "*shared not supported*" $link_output] { @@ -79,7 +79,7 @@ if ![ld_assemble_flags $as $as_opt $srcdir/$subdir/table.s tmpdir/table.o ] { return } -if { [ld_simple_link $ld tmpdir/table.so "--shared tmpdir/table.o tmpdir/tbss.o"] } { +if { [ld_link $ld tmpdir/table.so "--shared tmpdir/table.o tmpdir/tbss.o"] } { pass "$test2" } else { if [string match "*shared not supported*" $link_output] { diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp index a650505..5c5382c 100644 --- a/ld/testsuite/ld-elf/indirect.exp +++ b/ld/testsuite/ld-elf/indirect.exp @@ -126,59 +126,54 @@ set testname "Indirect symbol 2" set cmd "$ld -shared -o tmpdir/indirect2.so tmpdir/indirect2.o" check_link_message "$cmd" [list $string2 $string] "$testname" -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - set run_tests { {"Run with libindirect3c.so 1" - "tmpdir/indirect3a.o tmpdir/indirect3b.o tmpdir/libindirect3c.so" "" + "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/indirect3b.o tmpdir/libindirect3c.so" "" {dummy.c} "indirect3a" "indirect3.out"} {"Run with libindirect3c.so 2" - "tmpdir/indirect3a.o tmpdir/libindirect3c.so tmpdir/indirect3b.o" "" + "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/libindirect3c.so tmpdir/indirect3b.o" "" {dummy.c} "indirect3b" "indirect3.out"} {"Run with libindirect3c.so 3" - "tmpdir/indirect3b.o tmpdir/libindirect3c.so tmpdir/indirect3a.o" "" + "-Wl,--no-as-needed tmpdir/indirect3b.o tmpdir/libindirect3c.so tmpdir/indirect3a.o" "" {dummy.c} "indirect3c" "indirect3.out"} {"Run with libindirect3c.so 4" - "tmpdir/libindirect3c.so tmpdir/indirect3b.o tmpdir/indirect3a.o" "" + "-Wl,--no-as-needed tmpdir/libindirect3c.so tmpdir/indirect3b.o tmpdir/indirect3a.o" "" {dummy.c} "indirect3d" "indirect3.out"} {"Run with libindirect4c.so 1" - "tmpdir/indirect4a.o tmpdir/indirect4b.o tmpdir/libindirect4c.so" "" + "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/indirect4b.o tmpdir/libindirect4c.so" "" {dummy.c} "indirect4a" "indirect4.out"} {"Run with libindirect4c.so 2" - "tmpdir/indirect4a.o tmpdir/libindirect4c.so tmpdir/indirect4b.o" "" + "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/libindirect4c.so tmpdir/indirect4b.o" "" {dummy.c} "indirect4b" "indirect4.out"} {"Run with libindirect4c.so 3" - "tmpdir/indirect4b.o tmpdir/libindirect4c.so tmpdir/indirect4a.o" "" + "-Wl,--no-as-needed tmpdir/indirect4b.o tmpdir/libindirect4c.so tmpdir/indirect4a.o" "" {dummy.c} "indirect4c" "indirect4.out"} {"Run with libindirect4c.so 4" - "tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" + "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" {dummy.c} "indirect4d" "indirect4.out"} {"Run with libpr18720c.so 1" - "tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" "" + "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" "" {check-ptr-eq.c} "pr18720a" "pr18720.out"} {"Run with libpr18720c.so 2" - "tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" "" + "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" "" {check-ptr-eq.c} "pr18720b" "pr18720.out"} {"Run with libpr18720c.so 3" - "tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" "" + "-Wl,--no-as-needed tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" "" {check-ptr-eq.c} "pr18720c" "pr18720.out"} {"Run with libpr18720c.so 4" - "tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" "" + "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" "" {check-ptr-eq.c} "pr18720d" "pr18720.out"} {"Run with libpr18720c.so 5" - "tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" "" + "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" "" {check-ptr-eq.c} "pr18720d" "pr18720.out"} {"Run with libpr19553b.so" - "tmpdir/libpr19553b.so tmpdir/libpr19553d.so -rpath-link ." "" + "-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." "" {pr19553a.c} "pr19553b" "pr19553b.out"} {"Run with libpr19553c.so" - "tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" + "-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" {pr19553a.c} "pr19553c" "pr19553c.out"} {"Run with libpr19553d.so" - "tmpdir/libpr19553d.so tmpdir/libpr19553b.so -rpath-link ." "" + "-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." "" {pr19553a.c} "pr19553d" "pr19553d.out"} } diff --git a/ld/testsuite/ld-elf/sec-to-seg.exp b/ld/testsuite/ld-elf/sec-to-seg.exp index 05da6ef..5d86a32 100644 --- a/ld/testsuite/ld-elf/sec-to-seg.exp +++ b/ld/testsuite/ld-elf/sec-to-seg.exp @@ -40,7 +40,7 @@ proc sec_to_seg_test { testname scriptname same_seg } { global exec_output global READELF - if {! [ld_simple_link $ld tmpdir/sec-to-seg "-T $srcdir/$subdir/$scriptname tmpdir/sec-to-seg1.o tmpdir/sec-to-seg2.o"] } then { + if {! [ld_link $ld tmpdir/sec-to-seg "-T $srcdir/$subdir/$scriptname tmpdir/sec-to-seg1.o tmpdir/sec-to-seg2.o"] } then { fail $testname return 0 } diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 3cdac45..52baadd 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -21,13 +21,6 @@ # Exclude non-ELF targets. -# The following tests require running the executable generated by ld, -# or enough of a build environment to create a fully linked executable. -# This is not commonly available when testing a cross-built linker. -if ![isnative] { - return -} - if ![is_elf_format] { return } @@ -38,6 +31,7 @@ if { [which $CC] == 0 } { } # Add -ldl to extralibs if needed +set extralibs "" if { ![istarget *-*-freebsd*]} { set extralibs "-ldl" } @@ -55,7 +49,7 @@ set build_tests { {"Build warn libbar.so" "-shared" "-fPIC" {beginwarn.c end.c} {{readelf {-S --wide} libbarw.rd}} "libbarw.so" - "C" "^.*\\\): warning: function foo is deprecated$"} + "c" {^.*\): warning: function foo is deprecated$} } {"Build hidden libbar.so" "-shared" "-fPIC" {begin.c endhidden.c} {} "libbarh.so"} @@ -283,156 +277,156 @@ set build_tests { run_cc_link_tests $build_tests -set run_tests { - {"Run normal with libfoo.so" - "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" - {main.c} "normal" "normal.out"} - {"Run protected with libfoo.so" - "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" "" - {main.c} "protected" "normal.out"} - {"Run hidden with libfoo.so" - "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" "" - {main.c} "hidden" "hidden.out"} - {"Run normal with versioned libfoo.so" - "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" "" - {main.c} "normalv" "normal.out"} - {"Run warn with versioned libfoo.so" - "tmpdir/beginwarn.o tmpdir/libfoov.so" "" - {main.c} "warn" "warn.out" - "" "" "^.*\\\): warning: function foo is deprecated$"} - {"Run protected with versioned libfoo.so" - "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" - {main.c} "protected" "normal.out"} - {"Run hidden with versioned libfoo.so" - "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" "" - {main.c} "hiddenv" "hidden.out"} - {"Run normal libbar.so with libfoo.so" - "tmpdir/libbarfoo.so tmpdir/libfoo.so" "" - {main.c} "normal" "normal.out"} - {"Run protected libbar.so with libfoo.so" - "tmpdir/libbarpfoo.so tmpdir/libfoo.so" "" - {main.c} "protected" "normal.out"} - {"Run hidden libbar.so with libfoo.so" - "tmpdir/libbarhfoo.so tmpdir/libfoo.so" "" - {main.c} "hidden" "hidden.out"} - {"Run normal libbar.so with versioned libfoo.so" - "tmpdir/libbarfoov.so tmpdir/libfoov.so" "" - {main.c} "normal" "normal.out"} - {"Run protected libbar.so with versioned libfoo.so" - "tmpdir/libbarpfoov.so tmpdir/libfoov.so" "" - {main.c} "protected" "normal.out"} - {"Run hidden libbar.so with versioned libfoo.so" - "tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" - {main.c} "hidden" "hidden.out"} - {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" - "--dynamic-list=dl1.list $extralibs" "" - {dl1main.c} "dl1a" "dl1.out"} - {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so" - "--dynamic-list-data $extralibs" "" - {dl1main.c} "dl1b" "dl1.out"} - {"Run with libdl2a.so" - "tmpdir/libdl2a.so" "" - {dl2main.c} "dl2a" "dl2a.out"} - {"Run with libdl2b.so" - "tmpdir/libdl2b.so" "" - {dl2main.c} "dl2b" "dl2b.out"} - {"Run with libdl2c.so" - "tmpdir/libdl2c.so" "" - {dl2main.c} "dl2c" "dl2b.out"} - {"Run with libdl4a.so" - "tmpdir/libdl4a.so" "" - {dl4main.c} "dl4a" "dl4a.out"} - {"Run with libdl4b.so" - "tmpdir/libdl4b.so" "" - {dl4main.c} "dl4b" "dl4a.out"} - {"Run with libdl4c.so" - "tmpdir/libdl4c.so" "" - {dl4main.c} "dl4c" "dl4b.out"} - {"Run with libdl4d.so" - "tmpdir/libdl4d.so" "" - {dl4main.c} "dl4d" "dl4b.out"} - {"Run with libdl4e.so" - "tmpdir/libdl4e.so" "" - {dl4main.c} "dl4e" "dl4a.out"} - {"Run with libdl4f.so" - "tmpdir/libdl4f.so" "" - {dl4main.c} "dl4f" "dl4a.out"} - {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" - "--dynamic-list-data $extralibs" "" - {dl6amain.c} "dl6a1" "dl6a.out"} - {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" - "-Bsymbolic-functions $extralibs" "" - {dl6amain.c} "dl6a2" "dl6b.out"} - {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" - "-Bsymbolic $extralibs" "" - {dl6amain.c} "dl6a3" "dl6b.out"} - {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" - "-Bsymbolic --dynamic-list-data $extralibs" "" - {dl6amain.c} "dl6a4" "dl6a.out"} - {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" - "-Bsymbolic-functions --dynamic-list-cpp-new $extralibs" "" - {dl6amain.c} "dl6a5" "dl6b.out"} - {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" - "--dynamic-list-cpp-new -Bsymbolic-functions $extralibs" "" - {dl6amain.c} "dl6a6" "dl6b.out"} - {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" - "--dynamic-list-data -Bsymbolic $extralibs" "" - {dl6amain.c} "dl6a7" "dl6a.out"} - {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" - "--dynamic-list-data $extralibs" "" - {dl6bmain.c} "dl6b1" "dl6a.out"} - {"Run dl6b2 with dlopen on libdl6b.so" - "$extralibs" "" - {dl6bmain.c} "dl6b2" "dl6b.out"} - {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" - "--dynamic-list-data $extralibs" "" - {dl6cmain.c} "dl6c1" "dl6b.out"} - {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" - "--dynamic-list-data $extralibs" "" - {dl6dmain.c} "dl6d1" "dl6b.out"} - {"Run with libdata1.so" - "tmpdir/libdata1.so" "" - {dynbss1.c} "dynbss1" "pass.out"} - {"Run with libdata2.so" - "tmpdir/libdata2.so" "" - {weakdef1.c} "weakdef1" "pass.out"} - {"Run with libfunc1.so comm1.o" - "tmpdir/libfunc1.so tmpdir/comm1.o" "" - {dummy.c} "comm1" "pass.out"} - {"Run with comm1.o libfunc1.so" - "tmpdir/comm1.o tmpdir/libfunc1.so" "" - {dummy.c} "comm1" "pass.out"} - {"Run with pr11138-2.c libpr11138-1.so" - "--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" "" - {dummy.c} "pr11138a" "pr11138.out"} - {"Run with libpr11138-1.so pr11138-2.c" - "--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" - {dummy.c} "pr11138b" "pr11138.out"} - {"Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" - "--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "" - {dummy.c} "pr13250" "pass.out"} - {"Run with pr14323-1.c pr14323-2.so" - "tmpdir/libpr14323-2.so" "" - {pr14323-1.c} "pr14323" "pass.out"} - {"Run with pr14862-1.c libpr14862.so" - "--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" "" - {dummy.c} "pr14862" "pr14862.out"} - {"Link with --add-needed" - "tmpdir/libneeded1c.o --add-needed -rpath=tmpdir -Ltmpdir -lneeded1a" "" - {dummy.c} "needed1a" "needed1.out"} - {"Link with --copy-dt-needed-entries" - "tmpdir/libneeded1c.o --copy-dt-needed-entries -rpath=tmpdir -Ltmpdir -lneeded1a" "" - {dummy.c} "needed1b" "needed1.out"} - {"Run relmain" - "--no-as-needed -rpath=tmpdir -Ltmpdir -lrel" "" - {relmain.c} "relmain" "relmain.out"} - {"Run pr2404" - "tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" - {dummy.c} "pr2404" "pr2404.out"} - {"Run pr18458" - "tmpdir/libpr18458a.so tmpdir/libpr18458b.so -z now" "" - {pr18458c.c} "pr18458" "pass.out"} -} +set run_tests [list \ + [list "Run normal with libfoo.so" \ + "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" \ + {main.c} "normal" "normal.out" ] \ + [list "Run protected with libfoo.so" \ + "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" "" \ + {main.c} "protected" "normal.out" ] \ + [list "Run hidden with libfoo.so" \ + "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" "" \ + {main.c} "hidden" "hidden.out" ] \ + [list "Run normal with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" "" \ + {main.c} "normalv" "normal.out" ] \ + [list "Run warn with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/beginwarn.o tmpdir/libfoov.so" "" \ + {main.c} "warn" "warn.out" \ + "" "c" {^.*\): warning: function foo is deprecated$} ] \ + [list "Run protected with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" \ + {main.c} "protected" "normal.out" ] \ + [list "Run hidden with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" "" \ + {main.c} "hiddenv" "hidden.out" ] \ + [list "Run normal libbar.so with libfoo.so" \ + "-Wl,--no-as-needed tmpdir/libbarfoo.so tmpdir/libfoo.so" "" \ + {main.c} "normal" "normal.out" ] \ + [list "Run protected libbar.so with libfoo.so" \ + "-Wl,--no-as-needed tmpdir/libbarpfoo.so tmpdir/libfoo.so" "" \ + {main.c} "protected" "normal.out" ] \ + [list "Run hidden libbar.so with libfoo.so" \ + "-Wl,--no-as-needed tmpdir/libbarhfoo.so tmpdir/libfoo.so" "" \ + {main.c} "hidden" "hidden.out" ] \ + [list "Run normal libbar.so with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/libbarfoov.so tmpdir/libfoov.so" "" \ + {main.c} "normal" "normal.out" ] \ + [list "Run protected libbar.so with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/libbarpfoov.so tmpdir/libfoov.so" "" \ + {main.c} "protected" "normal.out" ] \ + [list "Run hidden libbar.so with versioned libfoo.so" \ + "-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \ + {main.c} "hidden" "hidden.out" ] \ + [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \ + "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \ + {dl1main.c} "dl1a" "dl1.out" ] \ + [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \ + "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ + {dl1main.c} "dl1b" "dl1.out" ] \ + [list "Run with libdl2a.so" \ + "-Wl,--no-as-needed tmpdir/libdl2a.so" "" \ + {dl2main.c} "dl2a" "dl2a.out" ] \ + [list "Run with libdl2b.so" \ + "-Wl,--no-as-needed tmpdir/libdl2b.so" "" \ + {dl2main.c} "dl2b" "dl2b.out" ] \ + [list "Run with libdl2c.so" \ + "-Wl,--no-as-needed tmpdir/libdl2c.so" "" \ + {dl2main.c} "dl2c" "dl2b.out" ] \ + [list "Run with libdl4a.so" \ + "-Wl,--no-as-needed tmpdir/libdl4a.so" "" \ + {dl4main.c} "dl4a" "dl4a.out" ] \ + [list "Run with libdl4b.so" \ + "-Wl,--no-as-needed tmpdir/libdl4b.so" "" \ + {dl4main.c} "dl4b" "dl4a.out" ] \ + [list "Run with libdl4c.so" \ + "-Wl,--no-as-needed tmpdir/libdl4c.so" "" \ + {dl4main.c} "dl4c" "dl4b.out" ] \ + [list "Run with libdl4d.so" \ + "-Wl,--no-as-needed tmpdir/libdl4d.so" "" \ + {dl4main.c} "dl4d" "dl4b.out" ] \ + [list "Run with libdl4e.so" \ + "-Wl,--no-as-needed tmpdir/libdl4e.so" "" \ + {dl4main.c} "dl4e" "dl4a.out" ] \ + [list "Run with libdl4f.so" \ + "-Wl,--no-as-needed tmpdir/libdl4f.so" "" \ + {dl4main.c} "dl4f" "dl4a.out" ] \ + [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ + {dl6amain.c} "dl6a1" "dl6a.out" ] \ + [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \ + {dl6amain.c} "dl6a2" "dl6b.out" ] \ + [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \ + {dl6amain.c} "dl6a3" "dl6b.out" ] \ + [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \ + {dl6amain.c} "dl6a4" "dl6a.out" ] \ + [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \ + {dl6amain.c} "dl6a5" "dl6b.out" ] \ + [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \ + {dl6amain.c} "dl6a6" "dl6b.out" ] \ + [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \ + "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \ + {dl6amain.c} "dl6a7" "dl6a.out" ] \ + [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \ + "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ + {dl6bmain.c} "dl6b1" "dl6a.out" ] \ + [list "Run dl6b2 with dlopen on libdl6b.so" \ + "-Wl,--no-as-needed $extralibs" "" \ + {dl6bmain.c} "dl6b2" "dl6b.out" ] \ + [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \ + "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ + {dl6cmain.c} "dl6c1" "dl6b.out" ] \ + [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \ + "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ + {dl6dmain.c} "dl6d1" "dl6b.out" ] \ + [list "Run with libdata1.so" \ + "-Wl,--no-as-needed tmpdir/libdata1.so" "" \ + {dynbss1.c} "dynbss1" "pass.out" ] \ + [list "Run with libdata2.so" \ + "-Wl,--no-as-needed tmpdir/libdata2.so" "" \ + {weakdef1.c} "weakdef1" "pass.out" ] \ + [list "Run with libfunc1.so comm1.o" \ + "-Wl,--no-as-needed tmpdir/libfunc1.so tmpdir/comm1.o" "" \ + {dummy.c} "comm1" "pass.out" ] \ + [list "Run with comm1.o libfunc1.so" \ + "-Wl,--no-as-needed tmpdir/comm1.o tmpdir/libfunc1.so" "" \ + {dummy.c} "comm1" "pass.out" ] \ + [list "Run with pr11138-2.c libpr11138-1.so" \ + "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" "" \ + {dummy.c} "pr11138a" "pr11138.out" ] \ + [list "Run with libpr11138-1.so pr11138-2.c" \ + "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" \ + {dummy.c} "pr11138b" "pr11138.out" ] \ + [list "Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" \ + "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "" \ + {dummy.c} "pr13250" "pass.out" ] \ + [list "Run with pr14323-1.c pr14323-2.so" \ + "-Wl,--no-as-needed tmpdir/libpr14323-2.so" "" \ + {pr14323-1.c} "pr14323" "pass.out" ] \ + [list "Run with pr14862-1.c libpr14862.so" \ + "-Wl,--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" "" \ + {dummy.c} "pr14862" "pr14862.out" ] \ + [list "Link with --add-needed" \ + "tmpdir/libneeded1c.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir -Ltmpdir -lneeded1a" "" \ + {dummy.c} "needed1a" "needed1.out" ] \ + [list "Link with --copy-dt-needed-entries" \ + "tmpdir/libneeded1c.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir -Ltmpdir -lneeded1a" "" \ + {dummy.c} "needed1b" "needed1.out" ] \ + [list "Run relmain" \ + "-Wl,--no-as-needed,-rpath=tmpdir -Ltmpdir -lrel" "" \ + {relmain.c} "relmain" "relmain.out" ] \ + [list "Run pr2404" \ + "-Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" \ + {dummy.c} "pr2404" "pr2404.out" ] \ + [list "Run pr18458" \ + "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \ + {pr18458c.c} "pr18458" "pass.out" ] \ +] # NetBSD ELF systems do not currently support the .*_array sections. run_ld_link_exec_tests $run_tests "*-*-netbsdelf*" @@ -502,10 +496,10 @@ set run_cxx_tests { "-Wl,--no-as-needed tmpdir/libdl3c.so" "" {dl3main.cc} "dl3c" "dl3a.out" "" "c++"} {"Run with libnew1a.so" - "tmpdir/libnew1a.so" "" + "-Wl,--no-as-needed tmpdir/libnew1a.so" "" {dl5.cc} "dl5a" "dl5.out" "" "c++"} {"Run with libnew1b.so" - "tmpdir/libnew1b.so" "" + "-Wl,--no-as-needed tmpdir/libnew1b.so" "" {dl5.cc} "dl5b" "dl5.out" "" "c++"} } @@ -543,7 +537,7 @@ if { [istarget *-*-linux*] run_ld_link_exec_tests [list \ [list \ "Run pr2404 with PIE" \ - "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ + "-pie -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ "" \ { dummy.c } \ "pr2404pie" \ @@ -597,7 +591,7 @@ if { [istarget *-*-linux*] ] \ [list \ "Run pr19579" \ - "-pie -z text tmpdir/pr19579a.o tmpdir/libpr19579.so" \ + "-pie -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \ "" \ {dummy.c} \ "pr19579" \ @@ -641,7 +635,7 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} { run_ld_link_exec_tests [list \ [list \ "Run $exe fun defined" \ - "$ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so -rpath tmpdir" \ + "-Wl,--no-as-needed,-rpath,tmpdir $ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so" \ "" \ { pr19719a.c pr19719c.c } \ $exe \ @@ -657,6 +651,11 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} { setup_xfail $targ } + if ![isnative] { + unsupported "Run $exe fun undefined" + return + } + set exec_output [run_host_cmd "tmpdir/$exe" ""] if {![string match "PASS" $exec_output]} { fail "Run $exe fun undefined" diff --git a/ld/testsuite/ld-elf/tls_common.exp b/ld/testsuite/ld-elf/tls_common.exp index 7ebe016..b900312 100644 --- a/ld/testsuite/ld-elf/tls_common.exp +++ b/ld/testsuite/ld-elf/tls_common.exp @@ -47,13 +47,13 @@ if { ![ld_assemble $as "--elf-stt-common=no $srcdir/$subdir/tls_common.s" tmpdir return } -if { ![ld_simple_link $ld tmpdir/tls_common1a.o "-r tmpdir/tls_commona.o"] - || ![ld_simple_link $ld tmpdir/tls_common1b.o "-r tmpdir/tls_commona.o"] } { +if { ![ld_link $ld tmpdir/tls_common1a.o "-r tmpdir/tls_commona.o"] + || ![ld_link $ld tmpdir/tls_common1b.o "-r tmpdir/tls_commona.o"] } { fail "tls_common" return } -if { ![ld_simple_link $ld tmpdir/tls_commona "tmpdir/tls_common1a.o"] } { +if { ![ld_link $ld tmpdir/tls_commona "tmpdir/tls_common1a.o"] } { if { [string match "*not supported*" $link_output] || [string match "*unrecognized option*" $link_output] } { unsupported "$ld_options is not supported by this target" @@ -65,7 +65,7 @@ if { ![ld_simple_link $ld tmpdir/tls_commona "tmpdir/tls_common1a.o"] } { return } -if { ![ld_simple_link $ld tmpdir/tls_commonb "tmpdir/tls_common1b.o"] } { +if { ![ld_link $ld tmpdir/tls_commonb "tmpdir/tls_common1b.o"] } { if { [string match "*not supported*" $link_output] || [string match "*unrecognized option*" $link_output] } { unsupported "$ld_options is not supported by this target" diff --git a/ld/testsuite/ld-elf/wrap.exp b/ld/testsuite/ld-elf/wrap.exp index be88ef6..4bf8faa 100644 --- a/ld/testsuite/ld-elf/wrap.exp +++ b/ld/testsuite/ld-elf/wrap.exp @@ -25,11 +25,6 @@ if ![is_elf_format] { return } -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - # Check if compiler works if { [which $CC] == 0 } { return @@ -46,10 +41,10 @@ set build_tests { set run_tests { {"Run with libwrap1a.so and libwrap1b.so" - "--wrap par tmpdir/libwrap1a.so tmpdir/libwrap1b.so" "" + "-Wl,--no-as-needed,--wrap,par tmpdir/libwrap1a.so tmpdir/libwrap1b.so" "" {wrap1.c} "wrap1" "wrap1.out"} {"Run with libwrap1b.so and libwrap1a.so" - "--wrap par tmpdir/libwrap1b.so tmpdir/libwrap1a.so" "" + "-Wl,--no-as-needed,--wrap,par tmpdir/libwrap1b.so tmpdir/libwrap1a.so" "" {wrap1.c} "wrap1" "wrap1.out"} } diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp index 860ce98..da33768 100644 --- a/ld/testsuite/ld-elfcomm/elfcomm.exp +++ b/ld/testsuite/ld-elfcomm/elfcomm.exp @@ -58,7 +58,7 @@ proc test_sort_common {} { return 0 } - if { ![ld_simple_link $ld tmpdir/sort-common.dx "--sort-common=descending tmpdir/sort-common.o"] } { + if { ![ld_link $ld tmpdir/sort-common.dx "--sort-common=descending tmpdir/sort-common.o"] } { fail "$test" return 0 } @@ -82,7 +82,7 @@ proc test_sort_common {} { verbose "Check to see that --sort-common=ascending sorts in ascending alignment" - if { ![ld_simple_link $ld tmpdir/sort-common.ax "--sort-common=ascending tmpdir/sort-common.o"] } { + if { ![ld_link $ld tmpdir/sort-common.ax "--sort-common=ascending tmpdir/sort-common.o"] } { fail "$test" return 0 } @@ -146,7 +146,7 @@ proc stt_common_test { options testname } { set options "$options tmpdir/common1c.o" - if { ! [ld_simple_link $ld tmpdir/common.exe $options] } { + if { ! [ld_link $ld tmpdir/common.exe $options] } { unresolved $testname return 0 } @@ -191,7 +191,7 @@ if [istarget sh64*-*-*] { } } -if { [ld_simple_link $ld tmpdir/common1.o $options] } { +if { [ld_link $ld tmpdir/common1.o $options] } { unresolved $test1w1 return } @@ -228,7 +228,7 @@ if [istarget sh64*-*-*] { } } -if { [ld_simple_link $ld tmpdir/common1.o $options] } { +if { [ld_link $ld tmpdir/common1.o $options] } { unresolved $test1w2 return } diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index 90f204f..bd35ae2 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -22,8 +22,10 @@ # -# This test can only be run if ld generates native executables. -if ![isnative] then {return} +# Check to see if the C compiler works +if { [which $CC] == 0 } { + return +} # This test can only be run on a couple of ELF platforms. # Square bracket expressions seem to confuse istarget. @@ -544,7 +546,7 @@ proc build_binary { shared pic test source libname other mapfile verexp versymex set script_arg "$script $srcdir/$subdir/$mapfile" } - if {![ld_simple_link $ld $tmpdir/$libname.so "$shared $tmpdir/$libname.o $other_lib $script_arg $ldargs"]} { + if {![ld_link $ld $tmpdir/$libname.so "$shared $tmpdir/$libname.o $other_lib $script_arg $ldargs"]} { fail "$test" return } @@ -635,7 +637,7 @@ proc test_ldfail { test flag source execname other mapfile whyfail } { set script_arg "-Wl,$script $srcdir/$subdir/$mapfile" } - if {![ld_simple_link $CC $tmpdir/$execname "$tmpdir/$execname.o $other_lib $script_arg"]} { + if {![ld_link $CC $tmpdir/$execname "$tmpdir/$execname.o $other_lib $script_arg"]} { pass "$test" return } @@ -733,7 +735,7 @@ proc build_exec { test source execname flags solibname verexp versymexp symexp } set solibname_lib $tmpdir/$solibname } - if {![ld_simple_link $CC $tmpdir/$execname "$flags $tmpdir/$execname.o $solibname_lib"]} { + if {![ld_link $CC $tmpdir/$execname "$flags $tmpdir/$execname.o $solibname_lib"]} { fail "$test" return } diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index 5331ad5..9d590c74 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -24,6 +24,11 @@ # Make sure that ld can generate ELF shared libraries with visibility. +# Check to see if the C compiler works +if { [which $CC] == 0 } { + return +} + # This test can only be run on a couple of ELF platforms. # Square bracket expressions seem to confuse istarget. if { ![istarget hppa*64*-*-hpux*] \ @@ -56,9 +61,6 @@ foreach t $test_list { run_dump_test [file rootname $t] } -# The remaining tests can only be run if ld generates native executables. -if ![isnative] then {return} - set tmpdir tmpdir set SHCFLAG "" set shared_needs_pic "no" @@ -121,7 +123,7 @@ if { [istarget *-*-linux*] || [istarget *-*-nacl*] || [istarget *-*-gnu*] } { if [ld_compile "$CC -g $CFLAGS -DPROTECTED_CHECK" $srcdir/$subdir/main.c $tmpdir/main.o] { - if [ld_simple_link $CC $tmpdir/main "$tmpdir/main.o"] { + if [ld_link $CC $tmpdir/main "$tmpdir/main.o"] { catch "exec $tmpdir/main" support_protected } } @@ -145,7 +147,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { set shared "-bM:SRE -bE:$tmpdir/xcoff.exp" } - if {![ld_simple_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} { + if {![ld_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} { if { [ string match $visibility "hidden_undef" ] && [regexp "undefined reference to \`\.?visibility\'" $link_output] && [regexp "undefined reference to \`visibility_var\'" $link_output] } { @@ -168,7 +170,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { set rpath /lib:$tmpdir } - if ![ld_simple_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] { + if ![ld_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] { if { [ string match $visibility "hidden" ] && [regexp "undefined reference to \`\.?visibility\'" $link_output] && [regexp "undefined reference to \`visibility_var\'" $link_output] } { @@ -191,6 +193,11 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } { fail "$testname" } + if ![isnative] { + unsupported "$testname" + return + } + # Run the resulting program send_log "$tmpdir/$progname >$tmpdir/$progname.out\n" verbose "$tmpdir/$progname >$tmpdir/$progname.out" @@ -502,7 +509,7 @@ visibility_run normal if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } { unresolved "common hidden symbol" } else { - if ![ld_simple_link $ld tmpdir/common "tmpdir/common.o"] { + if ![ld_link $ld tmpdir/common "tmpdir/common.o"] { fail "common hidden symbol" } else { pass "common hidden symbol" @@ -515,15 +522,15 @@ if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } { if { ![ld_compile "$CC -g $CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } { unresolved "weak hidden symbol" } else { - if ![ld_simple_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] { + if ![ld_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] { fail "weak hidden symbol" } else { - if ![ld_simple_link $ld tmpdir/weak "tmpdir/test.o tmpdir/sh3.o"] { + if ![ld_link $ld tmpdir/weak "tmpdir/test.o tmpdir/sh3.o"] { fail "weak hidden symbol DSO last" } else { pass "weak hidden symbol DSO last" } - if ![ld_simple_link $ld tmpdir/weak "tmpdir/sh3.so tmpdir/test.o"] { + if ![ld_link $ld tmpdir/weak "tmpdir/sh3.so tmpdir/test.o"] { fail "weak hidden symbol DSO first" } else { pass "weak hidden symbol DSO first" diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp index 88df180..e62291e 100644 --- a/ld/testsuite/ld-elfweak/elfweak.exp +++ b/ld/testsuite/ld-elfweak/elfweak.exp @@ -22,8 +22,10 @@ # Eric Youngdale (eric@andante.jic.com) # -# This test can only be run if ld generates native executables. -if ![isnative] then {return} +# Check to see if the C compiler works +if { [which $CC] == 0 } { + return +} # This test can only be run on a couple of ELF platforms. # Square bracket expressions seem to confuse istarget. @@ -290,7 +292,7 @@ proc build_lib {test libname objs dynsymexp} { set files "$files $tmpdir/$obj" } - if {![ld_simple_link $CC $tmpdir/$libname.so "$shared $files"]} { + if {![ld_link $CC $tmpdir/$libname.so "$shared $files"]} { fail $test return } @@ -316,7 +318,7 @@ proc build_exec { test execname objs flags dat dynsymexp symexp} { set files "$files $tmpdir/$obj" } - if {![ld_simple_link $CC $tmpdir/$execname "$flags $files"]} { + if {![ld_link $CC $tmpdir/$execname "$flags $files"]} { fail "$test" return } @@ -335,6 +337,10 @@ proc build_exec { test execname objs flags dat dynsymexp symexp} { } } + if ![isnative] { + unsupported $test + return + } # Run the resulting program send_log "$tmpdir/$execname >$tmpdir/$execname.out\n" verbose "$tmpdir/$execname >$tmpdir/$execname.out" @@ -402,7 +408,7 @@ if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c $tmpdir/main.o] { return } -if {![ld_simple_link $CC $tmpdir/libbar.so "$shared $tmpdir/bar.o"]} { +if {![ld_link $CC $tmpdir/libbar.so "$shared $tmpdir/bar.o"]} { fail "ELF weak" return } @@ -437,17 +443,17 @@ if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/main1.c $tmpdir/main1.o] return } -if {![ld_simple_link $CC $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]} { +if {![ld_link $CC $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]} { fail "ELF weak" return } -if {![ld_simple_link $CC $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]} { +if {![ld_link $CC $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]} { fail "ELF weak" return } -if {![ld_simple_link $CC $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} { +if {![ld_link $CC $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} { fail "ELF weak" return } diff --git a/ld/testsuite/ld-fastcall/fastcall.exp b/ld/testsuite/ld-fastcall/fastcall.exp index d6184fa4..261a668 100644 --- a/ld/testsuite/ld-fastcall/fastcall.exp +++ b/ld/testsuite/ld-fastcall/fastcall.exp @@ -45,7 +45,7 @@ if ![ld_assemble $as $srcdir/$subdir/import.s tmpdir/import.o] { return } -if ![ld_simple_link $ld tmpdir/extern.x "$ldflags tmpdir/export.o tmpdir/import.o"] { +if ![ld_link $ld tmpdir/extern.x "$ldflags tmpdir/export.o tmpdir/import.o"] { fail $testname } else { pass $testname diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp index 0e7b8c0..ba4f70b 100644 --- a/ld/testsuite/ld-gc/gc.exp +++ b/ld/testsuite/ld-gc/gc.exp @@ -54,7 +54,7 @@ proc test_gc { testname filename linker ldflags} { set outfile "tmpdir/$filename" set options "-L$srcdir/$subdir" - append options " " $ldflags " " [ld_simple_link_defsyms] " " $objfile + append options " " $ldflags " " [ld_link_defsyms] " " $objfile # SH64 targets needs an extra ld option for this test. if [istarget sh64*-*-*] { @@ -65,7 +65,7 @@ proc test_gc { testname filename linker ldflags} { } } - if ![ld_simple_link $linker $outfile $options] { + if ![ld_link $linker $outfile $options] { fail $testname return } @@ -112,7 +112,7 @@ if { [is_elf_format] && [check_shared_lib_support] } then { set gasopt "-mpic -mpid=near" } if {![ld_assemble_flags $as $gasopt $srcdir/$subdir/libpersonality.s tmpdir/libpersonality.o] - || ![ld_simple_link $ld tmpdir/libpersonality.so "-shared tmpdir/libpersonality.o"] } then { + || ![ld_link $ld tmpdir/libpersonality.so "-shared tmpdir/libpersonality.o"] } then { fail libpersonality } else { run_dump_test "personality" @@ -125,7 +125,7 @@ if { [is_remote host] || [which $CC] != 0 } { || [istarget "*-*-nacl*"] || [istarget "*-*-gnu*"] } { ld_compile "$CC -fPIC $CFLAGS $cflags" $srcdir/$subdir/pr11218-1.c tmpdir/pr11218-1.o - ld_simple_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o" + ld_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o" ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/pr11218-2.c tmpdir/pr11218-2.o run_dump_test "pr11218" } diff --git a/ld/testsuite/ld-ifunc/binutils.exp b/ld/testsuite/ld-ifunc/binutils.exp index 0567c20..a02b71f 100644 --- a/ld/testsuite/ld-ifunc/binutils.exp +++ b/ld/testsuite/ld-ifunc/binutils.exp @@ -54,7 +54,7 @@ proc binutils_test { prog_name ld_options test } { return } - if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } { + if { ![ld_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } { if { [string match "*not supported*" $link_output] || [string match "*unrecognized option*" $link_output] } { unsupported "$ld_options is not supported by this target" diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp index 0b488d0..d7519b5 100644 --- a/ld/testsuite/ld-ifunc/ifunc.exp +++ b/ld/testsuite/ld-ifunc/ifunc.exp @@ -41,15 +41,6 @@ if {!(([istarget "i?86-*-*"] return } -# We need a native system. FIXME: Strictly speaking this -# is not true, we just need to know how to create a fully -# linked executable, including the C and Z libraries, using -# the linker that is under test. -if ![isnative] { - verbose "IFUNC tests not run - not a native toolchain" - return -} - # We need a working compiler. (Strictly speaking this is # not true, we could use target specific assembler files). if { [which $CC] == 0 } { @@ -200,7 +191,7 @@ if { $fails != 0 } { return } -if ![ld_simple_link $ld "tmpdir/libshared_ifunc.so" "-shared tmpdir/shared_ifunc.o"] { +if ![ld_link $ld "tmpdir/libshared_ifunc.so" "-shared tmpdir/shared_ifunc.o"] { fail "Could not create a shared library containing an IFUNC symbol" set fails [expr $fails + 1] } @@ -213,27 +204,27 @@ if { $fails != 0 } { return } -if ![default_ld_link $ld "tmpdir/dynamic_prog" "-Ltmpdir tmpdir/shared_prog.o -Bdynamic -lshared_ifunc -rpath ./tmpdir"] { +if ![ld_link $CC "tmpdir/dynamic_prog" "-Wl,--no-as-needed,-rpath=./tmpdir,-Bdynamic -Ltmpdir tmpdir/shared_prog.o -lshared_ifunc"] { fail "Could not link a dynamic executable" set fails [expr $fails + 1] } -if ![default_ld_link $ld "tmpdir/local_prog" "-Ltmpdir tmpdir/static_prog.o -lifunc"] { +if ![ld_link $CC "tmpdir/local_prog" "-Wl,--no-as-needed,-rpath=./tmpdir -Ltmpdir tmpdir/static_prog.o -lifunc"] { fail "Could not link a dynamic executable using local ifunc" set fails [expr $fails + 1] } -if ![default_ld_link $ld "tmpdir/static_prog" "-static -Ltmpdir tmpdir/static_prog.o -lifunc"] { +if ![ld_link $CC "tmpdir/static_prog" "-static -Ltmpdir tmpdir/static_prog.o -lifunc"] { fail "Could not link a static executable" set fails [expr $fails + 1] } -if ![ld_simple_link $ld "tmpdir/static_nonifunc_prog" "-static tmpdir/empty.o"] { +if ![ld_link $ld "tmpdir/static_nonifunc_prog" "-static tmpdir/empty.o"] { fail "Could not link a non-ifunc using static executable" set fails [expr $fails + 1] } -if ![default_ld_link $ld "tmpdir/test-1" "tmpdir/test-1.o tmpdir/libshared_ifunc.so"] { +if ![ld_link $CC "tmpdir/test-1" "-Wl,--no-as-needed,-rpath=./tmpdir tmpdir/test-1.o tmpdir/libshared_ifunc.so"] { fail "Could not link test-1" set fails [expr $fails + 1] } -if ![ld_simple_link $ld "tmpdir/libtest-2.so" "-shared tmpdir/test-2.o"] { +if ![ld_link $ld "tmpdir/libtest-2.so" "-shared tmpdir/test-2.o"] { fail "Could not link libtest-2.so" set fails [expr $fails + 1] } @@ -251,6 +242,11 @@ if { $fails == 0 } { # ifunc should have an OSABI field of GNU. The linked non-ifunc using # executable should have an OSABI field of NONE (aka System V). +case $target_triplet in { + { hppa*-*-linux* } { set expected_none {UNIX - GNU} } + default { set expected_none {UNIX - System V} } +} + if {! [check_osabi tmpdir/libshared_ifunc.so {UNIX - GNU}]} { fail "Shared libraries containing ifunc does not have an OS/ABI field of GNU" set fails [expr $fails + 1] @@ -263,12 +259,12 @@ if {! [check_osabi tmpdir/static_prog {UNIX - GNU}]} { fail "Static ifunc-using executable does not have an OS/ABI field of GNU" set fails [expr $fails + 1] } -if {! [check_osabi tmpdir/dynamic_prog {UNIX - System V}]} { - fail "Dynamic ifunc-using executable does not have an OS/ABI field of System V" +if {! [check_osabi tmpdir/dynamic_prog $expected_none]} { + fail "Dynamic ifunc-using executable does not have an OS/ABI field of $expected_none" set fails [expr $fails + 1] } -if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} { - fail "Static non-ifunc-using executable does not have an OS/ABI field of System V" +if {! [check_osabi tmpdir/static_nonifunc_prog $expected_none]} { + fail "Static non-ifunc-using executable does not have an OS/ABI field of $expected_none" set fails [expr $fails + 1] } @@ -335,21 +331,6 @@ if { $fails == 0 } { pass "Checking ifunc binaries" } -# Clean up, unless we are being verbose, in which case we leave the files available. -if { $verbose < 1 } { - remote_file host delete "tmpdir/shared_prog.o" - remote_file host delete "tmpdir/static_prog.o" - remote_file host delete "tmpdir/shared_ifunc.o" - remote_file host delete "tmpdir/static_ifunc.o" - remote_file host delete "tmpdir/static_noifunc.o" - remote_file host delete "tmpdir/libshared_ifunc.so" - remote_file host delete "tmpdir/libifunc.a" - remote_file host delete "tmpdir/dynamic_prog" - remote_file host delete "tmpdir/local_prog" - remote_file host delete "tmpdir/static_prog" - remote_file host delete "tmpdir/static_nonifunc_prog" -} - run_cc_link_tests [list \ [list \ "Build libpr16467a.so" \ @@ -433,7 +414,7 @@ run_cc_link_tests [list \ run_ld_link_exec_tests [list \ [list \ "Run pr16467" \ - "tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \ + "-Wl,--no-as-needed tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \ "" \ { dummy.c } \ "pr16467" \ @@ -442,7 +423,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run ifunc-main" \ - "tmpdir/libifunc-lib.so" \ + "-Wl,--no-as-needed tmpdir/libifunc-lib.so" \ "" \ { ifunc-main.c } \ "ifunc-main" \ @@ -450,7 +431,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run ifunc-main with -fpic" \ - "tmpdir/libifunc-lib.so" \ + "-Wl,--no-as-needed tmpdir/libifunc-lib.so" \ "" \ { ifunc-main.c } \ "ifunc-main" \ @@ -510,7 +491,7 @@ run_cc_link_tests [list \ run_ld_link_exec_tests [list \ [list \ "Run pr18808" \ - "tmpdir/pr18808a.o tmpdir/libpr18808.so" \ + "-Wl,--no-as-needed tmpdir/pr18808a.o tmpdir/libpr18808.so" \ "" \ { dummy.c } \ "pr18808" \ @@ -518,7 +499,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run pr18841 with libpr18841b.so" \ - "tmpdir/pr18841a.o tmpdir/libpr18841b.so" \ + "-Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841b.so" \ "" \ { dummy.c } \ "pr18841b" \ @@ -526,7 +507,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run pr18841 with libpr18841c.so" \ - "--as-needed tmpdir/pr18841a.o tmpdir/libpr18841c.so" \ + "-Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841c.so" \ "" \ { dummy.c } \ "pr18841c" \ diff --git a/ld/testsuite/ld-mep/mep.exp b/ld/testsuite/ld-mep/mep.exp index 4b8e3a9..d6df072 100644 --- a/ld/testsuite/ld-mep/mep.exp +++ b/ld/testsuite/ld-mep/mep.exp @@ -31,7 +31,7 @@ set testbsrweak "MeP bsr to undefined weak function" if ![ld_assemble $as "$srcdir/$subdir/mep1.s" tmpdir/mep1.o] { unresolved $testbsrweak -} else { if ![ld_simple_link $ld tmpdir/mep1 "-T$srcdir/$subdir/mep1.ld tmpdir/mep1.o"] { +} else { if ![ld_link $ld tmpdir/mep1 "-T$srcdir/$subdir/mep1.ld tmpdir/mep1.o"] { fail $testbsrweak } else { pass $testbsrweak diff --git a/ld/testsuite/ld-mips-elf/mips-elf-flags.exp b/ld/testsuite/ld-mips-elf/mips-elf-flags.exp index 80f218f..dd84c9c 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf-flags.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf-flags.exp @@ -67,7 +67,7 @@ proc good_combination {arglist flags} { if {$objs == ""} { unresolved $testname - } elseif {![ld_simple_link "$ld $ldemul" $finalobj "-r $objs"]} { + } elseif {![ld_link "$ld $ldemul" $finalobj "-r $objs"]} { fail $testname } else { catch "exec $READELF --headers $finalobj" output @@ -106,7 +106,7 @@ proc bad_combination {arglist message} { if {$objs == ""} { unresolved $testname - } elseif {[ld_simple_link "$ld $ldemul" $finalobj "-r $objs"] + } elseif {[ld_link "$ld $ldemul" $finalobj "-r $objs"] || [string first $message $link_output] < 0} { fail $testname } else { diff --git a/ld/testsuite/ld-mn10300/mn10300.exp b/ld/testsuite/ld-mn10300/mn10300.exp index 98c77cd..503dd77 100644 --- a/ld/testsuite/ld-mn10300/mn10300.exp +++ b/ld/testsuite/ld-mn10300/mn10300.exp @@ -147,12 +147,12 @@ proc i126256-test { } { return } - if { ![ld_simple_link $ld $tmpdir/i126256-1.so "-shared $tmpdir/i126256-1.o -e 0"]} { + if { ![ld_link $ld $tmpdir/i126256-1.so "-shared $tmpdir/i126256-1.o -e 0"]} { unresolved $testname return } - if { ![ld_simple_link $ld $tmpdir/i126256-2.so "--relax -shared $tmpdir/i126256-2.o $tmpdir/i126256-1.so -e 0"]} { + if { ![ld_link $ld $tmpdir/i126256-2.so "--relax -shared $tmpdir/i126256-2.o $tmpdir/i126256-1.so -e 0"]} { fail $testname return } diff --git a/ld/testsuite/ld-nios2/nios2.exp b/ld/testsuite/ld-nios2/nios2.exp index b8ffd49..b712e9e 100644 --- a/ld/testsuite/ld-nios2/nios2.exp +++ b/ld/testsuite/ld-nios2/nios2.exp @@ -22,7 +22,7 @@ if ![ld_assemble $as "-march=r2 $srcdir/$subdir/${test}b.s" tmpdir/${test}b.o] { return } -if { ![ld_simple_link $ld tmpdir/$test "tmpdir/${test}a.o tmpdir/${test}b.o"] } { +if { ![ld_link $ld tmpdir/$test "tmpdir/${test}a.o tmpdir/${test}b.o"] } { if [string match "*architecture * is incompatible*" $link_output] { pass "$test_name" } { diff --git a/ld/testsuite/ld-pe/pe-compile.exp b/ld/testsuite/ld-pe/pe-compile.exp index 67a63e2..f29e5cf 100644 --- a/ld/testsuite/ld-pe/pe-compile.exp +++ b/ld/testsuite/ld-pe/pe-compile.exp @@ -52,7 +52,7 @@ proc run_basefile_test { testname } { global subdir global verbose - if ![ld_simple_link "$LD -e start \ + if ![ld_link "$LD -e start \ --base-file=tmpdir/$testname.base \ --export-all-symbols" tmpdir/$testname.dll \ "tmpdir/basefile1.o"] { @@ -92,7 +92,7 @@ proc run_ver_script_test { testname } { global subdir global verbose - if ![ld_simple_link "$CC -shared \ + if ![ld_link "$CC -shared \ -Wl,--version-script,$srcdir/$subdir/$testname.ver \ -Wl,--output-def,tmpdir/$testname.def" tmpdir/$testname.dll \ "tmpdir/vers-script-dll.o"] { diff --git a/ld/testsuite/ld-pe/pe-run.exp b/ld/testsuite/ld-pe/pe-run.exp index 3fda17c..9fa6848 100644 --- a/ld/testsuite/ld-pe/pe-run.exp +++ b/ld/testsuite/ld-pe/pe-run.exp @@ -71,9 +71,9 @@ proc test_direct_link_dll {} { # Compile the dll. if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct_dll.c $tmpdir/direct_dll.o ] { fail "compiling shared lib" - } elseif ![ld_simple_link "$CC -shared" $tmpdir/direct_dll.dll "$tmpdir/direct_dll.o" ] { + } elseif ![ld_link "$CC -shared" $tmpdir/direct_dll.dll "$tmpdir/direct_dll.o" ] { fail "linking shared lib (.dll)" - } elseif ![ld_simple_link "$CC -shared" $tmpdir/direct_dll.sl "$tmpdir/direct_dll.o" ] { + } elseif ![ld_link "$CC -shared" $tmpdir/direct_dll.sl "$tmpdir/direct_dll.o" ] { fail "linking shared lib (.sl)" } else { # Compile and link the client program. @@ -82,7 +82,7 @@ proc test_direct_link_dll {} { } else { # Check linking directly to direct_dll.dll. set msg "linking client (.dll)" - if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_dll.exe \ + if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_dll.exe \ "$tmpdir/direct_client.o $tmpdir/direct_dll.dll" ] { pass $msg } else { @@ -91,7 +91,7 @@ proc test_direct_link_dll {} { # Check linking directly to direct_dll.sl. set msg "linking client (.sl)" - if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_sl.exe \ + if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_sl.exe \ "$tmpdir/direct_client.o $tmpdir/direct_dll.sl" ] { pass $msg } else { @@ -102,7 +102,7 @@ proc test_direct_link_dll {} { # Create symbolic link. catch "exec ln -fs direct_dll.dll $tmpdir/libdirect_dll.dll.a" ln_catch set msg "linking client (symlink -> .dll)" - if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_dll.exe \ + if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_dll.exe \ "$tmpdir/direct_client.o $tmpdir/libdirect_dll.dll.a" ] { pass $msg } else { @@ -113,7 +113,7 @@ proc test_direct_link_dll {} { # Create symbolic link. catch "exec ln -fs direct_dll.sl $tmpdir/libdirect_sl.dll.a" ln_catch set msg "linking client (symlink -> .sl)" - if [ld_simple_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_sl.exe \ + if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_sl.exe \ "$tmpdir/direct_client.o $tmpdir/libdirect_sl.dll.a" ] { pass $msg } else { diff --git a/ld/testsuite/ld-pe/pe-run2.exp b/ld/testsuite/ld-pe/pe-run2.exp index 9e0a60b..5c8c48f 100644 --- a/ld/testsuite/ld-pe/pe-run2.exp +++ b/ld/testsuite/ld-pe/pe-run2.exp @@ -73,9 +73,9 @@ proc test_direct2_link_dll {} { # Compile the dll. if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] { fail "compiling shared lib fastcall/stdcall" - } elseif ![ld_simple_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o" ] { + } elseif ![ld_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o" ] { fail "linking shared lib (.dll) fastcall/stdcall" - } elseif ![ld_simple_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o" ] { + } elseif ![ld_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o" ] { fail "linking shared lib (.sl) fastcall/stdcall" } else { # Compile and link the client program. @@ -84,7 +84,7 @@ proc test_direct2_link_dll {} { } else { # Check linking directly to direct2_dll.dll. set msg "linking client (.dll) fastcall/stdcall" - if [ld_simple_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \ + if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \ "$tmpdir/direct2_client.o $tmpdir/direct2_dll.dll" ] { pass $msg } else { @@ -93,7 +93,7 @@ proc test_direct2_link_dll {} { # Check linking directly to direct2_dll.sl. set msg "linking client (.sl) fastcall/stdcall" - if [ld_simple_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \ + if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \ "$tmpdir/direct2_client.o $tmpdir/direct2_dll.sl" ] { pass $msg } else { @@ -104,7 +104,7 @@ proc test_direct2_link_dll {} { # Create symbolic link. catch "exec ln -fs direct2_dll.dll $tmpdir/libdirect2_dll.dll.a" ln_catch set msg "linking client (symlink -> .dll) fastcall/stdcall" - if [ld_simple_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \ + if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \ "$tmpdir/direct2_client.o $tmpdir/libdirect2_dll.dll.a" ] { pass $msg } else { @@ -115,7 +115,7 @@ proc test_direct2_link_dll {} { # Create symbolic link. catch "exec ln -fs direct2_dll.sl $tmpdir/libdirect2_sl.dll.a" ln_catch set msg "linking client (symlink -> .sl) fastcall/stdcall" - if [ld_simple_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \ + if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \ "$tmpdir/direct2_client.o $tmpdir/libdirect2_sl.dll.a" ] { pass $msg } else { diff --git a/ld/testsuite/ld-pie/pie.exp b/ld/testsuite/ld-pie/pie.exp index aaac450..e9d1162 100644 --- a/ld/testsuite/ld-pie/pie.exp +++ b/ld/testsuite/ld-pie/pie.exp @@ -19,9 +19,6 @@ # MA 02110-1301, USA. # -# This test can only be run if ld generates native executables. -if ![isnative] then {return} - if { ![istarget *-*-linux*] && ![istarget *-*-nacl*] && ![istarget *-*-gnu*] } { @@ -37,8 +34,10 @@ if { ![string match "" $exec_output] } { } set array_tests { - {"weak undefined" "-pie" "" {weakundef.c} "weakundef" "weakundef.out" "-fPIC"} - {"weak undefined data" "-pie" "" {weakundef-data.c} "weakundef-data" "weakundef.out" "-fPIC"} + {"weak undefined" "-pie" "" + {weakundef.c} "weakundef" "weakundef.out" "-fPIC"} + {"weak undefined data" "-pie" "" + {weakundef-data.c} "weakundef-data" "weakundef.out" "-fPIC"} } run_ld_link_exec_tests $array_tests diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index d1ef17e..bfc1b1cfd 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -476,11 +476,6 @@ run_ld_link_tests [list \ {dummy.s} {} "pr19317-r.o"] \ ] -# The following tests require running the executable generated by ld. -if ![isnative] { - return -} - run_ld_link_exec_tests $lto_run_tests if { [is_elf_format] } { diff --git a/ld/testsuite/ld-plugin/plugin.exp b/ld/testsuite/ld-plugin/plugin.exp index 1323a09..ba32818 100644 --- a/ld/testsuite/ld-plugin/plugin.exp +++ b/ld/testsuite/ld-plugin/plugin.exp @@ -124,7 +124,7 @@ set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o" set testsrcfiles_notext "tmpdir/main.o $srcdir/$subdir/func.c" # Rather than having libs we just define dummy values for anything # we may need to link a target exe; we aren't going to run it anyway. -set libs "[ld_simple_link_defsyms] --defsym ${_}printf=${_}main --defsym ${_}puts=${_}main" +set libs "[ld_link_defsyms] --defsym ${_}printf=${_}main --defsym ${_}puts=${_}main" if { $dotsym } { append libs " --defsym .printf=.main --defsym .puts=.main" } diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp index 302efa2..297aa13 100644 --- a/ld/testsuite/ld-scripts/align.exp +++ b/ld/testsuite/ld-scripts/align.exp @@ -38,7 +38,7 @@ if [istarget "x86_64-*-mingw*"] then { set LDFLAGS "$LDFLAGS --image-base 0" } -if ![ld_simple_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align.o"] { +if ![ld_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align.o"] { fail $testname } else { pass $testname diff --git a/ld/testsuite/ld-scripts/alignof.exp b/ld/testsuite/ld-scripts/alignof.exp index e5d1ea9..91f05e1 100644 --- a/ld/testsuite/ld-scripts/alignof.exp +++ b/ld/testsuite/ld-scripts/alignof.exp @@ -32,7 +32,7 @@ if ![ld_assemble $as $srcdir/$subdir/alignof.s tmpdir/alignof.o] { return } -if ![ld_simple_link $ld tmpdir/alignof "-T $srcdir/$subdir/alignof.t tmpdir/alignof.o"] { +if ![ld_link $ld tmpdir/alignof "-T $srcdir/$subdir/alignof.t tmpdir/alignof.o"] { fail $testname return } diff --git a/ld/testsuite/ld-scripts/assert.exp b/ld/testsuite/ld-scripts/assert.exp index c0d9e84..1ea0b02 100644 --- a/ld/testsuite/ld-scripts/assert.exp +++ b/ld/testsuite/ld-scripts/assert.exp @@ -26,7 +26,7 @@ if ![ld_assemble $as $srcdir/$subdir/assert.s tmpdir/assert.o] { return } -if ![ld_simple_link $ld tmpdir/assert "-T $srcdir/$subdir/assert.t tmpdir/assert.o"] { +if ![ld_link $ld tmpdir/assert "-T $srcdir/$subdir/assert.t tmpdir/assert.o"] { fail $testname } else { pass $testname diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp index 79c4e45..215e7b6 100644 --- a/ld/testsuite/ld-scripts/defined.exp +++ b/ld/testsuite/ld-scripts/defined.exp @@ -33,7 +33,7 @@ if [istarget "x86_64-*-mingw*"] then { set LDFLAGS "$LDFLAGS --image-base 0" } -if ![ld_simple_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] { +if ![ld_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] { fail $testname } else { if ![ld_nm $nm "" tmpdir/def] { diff --git a/ld/testsuite/ld-scripts/extern.exp b/ld/testsuite/ld-scripts/extern.exp index f6048c4..b8d2b2d 100644 --- a/ld/testsuite/ld-scripts/extern.exp +++ b/ld/testsuite/ld-scripts/extern.exp @@ -26,7 +26,7 @@ if ![ld_assemble $as $srcdir/$subdir/extern.s tmpdir/extern.o] { return } -if ![ld_simple_link $ld tmpdir/extern "-T $srcdir/$subdir/extern.t tmpdir/extern.o"] { +if ![ld_link $ld tmpdir/extern "-T $srcdir/$subdir/extern.t tmpdir/extern.o"] { fail $testname } diff --git a/ld/testsuite/ld-scripts/log2.exp b/ld/testsuite/ld-scripts/log2.exp index 9654a4d..48b2688 100644 --- a/ld/testsuite/ld-scripts/log2.exp +++ b/ld/testsuite/ld-scripts/log2.exp @@ -26,7 +26,7 @@ if {![ld_assemble $as $srcdir/$subdir/log2.s tmpdir/log2.o]} { return } -if {![ld_simple_link $ld tmpdir/log2 "-T $srcdir/$subdir/log2.t tmpdir/log2.o"]} { +if {![ld_link $ld tmpdir/log2 "-T $srcdir/$subdir/log2.t tmpdir/log2.o"]} { fail $testname } else { pass $testname diff --git a/ld/testsuite/ld-scripts/map-address.exp b/ld/testsuite/ld-scripts/map-address.exp index 72df317..7a5cccb 100644 --- a/ld/testsuite/ld-scripts/map-address.exp +++ b/ld/testsuite/ld-scripts/map-address.exp @@ -26,7 +26,7 @@ if {![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/map-address.o]} { return } -if {![ld_simple_link $ld tmpdir/map-address \ +if {![ld_link $ld tmpdir/map-address \ "-T $srcdir/$subdir/map-address.t \ tmpdir/map-address.o \ -Map tmpdir/map-address.map"]} { diff --git a/ld/testsuite/ld-scripts/phdrs.exp b/ld/testsuite/ld-scripts/phdrs.exp index 4c268bc..5d9f6d4 100644 --- a/ld/testsuite/ld-scripts/phdrs.exp +++ b/ld/testsuite/ld-scripts/phdrs.exp @@ -48,7 +48,7 @@ if [is_elf64 tmpdir/phdrs.o] { } set ldopt "$ldopt -T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o" -if ![ld_simple_link $ld tmpdir/phdrs $ldopt] { +if ![ld_link $ld tmpdir/phdrs $ldopt] { fail $testname } else { if {![is_remote host] && [which $objdump] == 0} { diff --git a/ld/testsuite/ld-scripts/phdrs2.exp b/ld/testsuite/ld-scripts/phdrs2.exp index 5ab8b89..625b07a 100644 --- a/ld/testsuite/ld-scripts/phdrs2.exp +++ b/ld/testsuite/ld-scripts/phdrs2.exp @@ -55,7 +55,7 @@ set phdrs_regexp \ ".*Program Header:.*LOAD *off *0x00\[0-9a-f\]* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]*.*LOAD *off *0x00\[0-9a-f\]* *vaddr *0x00*800004 *paddr *0x00*800004.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags rw.*" set ldopt "$ldopt -T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o" -if ![ld_simple_link $ld tmpdir/phdrs2 $ldopt] { +if ![ld_link $ld tmpdir/phdrs2 $ldopt] { fail $testname } else { if {![is_remote host] && [which $objdump] == 0} { diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp index 7a04480..bb2c7b6 100644 --- a/ld/testsuite/ld-scripts/script.exp +++ b/ld/testsuite/ld-scripts/script.exp @@ -192,7 +192,7 @@ if {[istarget "*-*-pe*"] \ set flags "--image-base 0" } -if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] { +if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] { fail $testname } else { check_script @@ -200,7 +200,7 @@ if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir set testname "MRI script" -if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] { +if ![ld_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] { fail $testname } else { check_script @@ -208,14 +208,14 @@ if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] { set testname "MEMORY" -if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/memory.t tmpdir/script.o"] { +if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/memory.t tmpdir/script.o"] { fail $testname } else { check_script } set testname "MEMORY with symbols" -if ![ld_simple_link $ld tmpdir/script "$flags -defsym DATA_ORIGIN=0x1000 -defsym DATA_LENGTH=0x10000 -T $srcdir/$subdir/memory_sym.t tmpdir/script.o"] { +if ![ld_link $ld tmpdir/script "$flags -defsym DATA_ORIGIN=0x1000 -defsym DATA_LENGTH=0x10000 -T $srcdir/$subdir/memory_sym.t tmpdir/script.o"] { fail $testname untested "extract symbols" } else { diff --git a/ld/testsuite/ld-scripts/section-flags.exp b/ld/testsuite/ld-scripts/section-flags.exp index 417db4a..550ae79 100644 --- a/ld/testsuite/ld-scripts/section-flags.exp +++ b/ld/testsuite/ld-scripts/section-flags.exp @@ -33,7 +33,7 @@ foreach test {"section-flags-1" "section-flags-2"} { if ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o] { unresolved $test } else { - if ![ld_simple_link $ldcmd tmpdir/$test \ + if ![ld_link $ldcmd tmpdir/$test \ "-T $srcdir/$subdir/$test.t tmpdir/$test.o"] { fail $test } else { diff --git a/ld/testsuite/ld-scripts/sizeof.exp b/ld/testsuite/ld-scripts/sizeof.exp index f9dc9ee..5324ea4 100644 --- a/ld/testsuite/ld-scripts/sizeof.exp +++ b/ld/testsuite/ld-scripts/sizeof.exp @@ -27,7 +27,7 @@ if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] { return } -if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] { +if ![ld_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] { fail $testname return } diff --git a/ld/testsuite/ld-scripts/sysroot-prefix.exp b/ld/testsuite/ld-scripts/sysroot-prefix.exp index 2f41bd4..2bb67e4 100644 --- a/ld/testsuite/ld-scripts/sysroot-prefix.exp +++ b/ld/testsuite/ld-scripts/sysroot-prefix.exp @@ -141,7 +141,7 @@ proc single_sysroot_prefix_test { type xtestname finalscript ldopt errstr } { close $ofd verbose -log "script: $finalscript" - set res [ld_simple_link $ld tmpdir/output "$ldopt tmpdir/main.o -Ltmpdir -lsysroottest"] + set res [ld_link $ld tmpdir/output "$ldopt tmpdir/main.o -Ltmpdir -lsysroottest"] set ld_output "$exec_output" set expect_success [expr [string length $errstr] == 0] diff --git a/ld/testsuite/ld-scripts/weak.exp b/ld/testsuite/ld-scripts/weak.exp index 04b19aa..1affef6 100644 --- a/ld/testsuite/ld-scripts/weak.exp +++ b/ld/testsuite/ld-scripts/weak.exp @@ -55,7 +55,7 @@ set weak_regexp_big \ set weak_regexp_little \ ".*Contents of section .text:.*1000 08100000 0c200000 12121212 34343434.*Contents of section .data:.*2000 08100000 0c200000 56565656 78787878.*" -if {! [ld_simple_link $ld tmpdir/weak "$flags -T $srcdir/$subdir/weak.t tmpdir/weak1.o tmpdir/weak2.o"] } then { +if {! [ld_link $ld tmpdir/weak "$flags -T $srcdir/$subdir/weak.t tmpdir/weak1.o tmpdir/weak2.o"] } then { fail $testname } else { if {![is_remote host] && [which $objdump] == 0} then { diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp index ac456e4..8d58c16 100644 --- a/ld/testsuite/ld-selective/selective.exp +++ b/ld/testsuite/ld-selective/selective.exp @@ -151,7 +151,7 @@ foreach testitem $seltests { set objfile "$objfile --defsym _.d2=0" } - if ![ld_simple_link $ld $ldfile "$ldflags [join $ldargs] $objfile"] { + if ![ld_link $ld $ldfile "$ldflags [join $ldargs] $objfile"] { fail $testname continue } diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp index ce9dad4..f87911b 100644 --- a/ld/testsuite/ld-sh/sh.exp +++ b/ld/testsuite/ld-sh/sh.exp @@ -37,7 +37,7 @@ set testsimple "SH simple relaxing" if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] { unresolved $testsimple -} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] { +} else { if ![ld_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] { fail $testsimple } else { if ![ld_nm $nm "" tmpdir/sh1] { @@ -73,7 +73,7 @@ if { [istarget sh*-linux-*] || [istarget sh-*-vxworks] } { } else { set srec_relax_arg "-relax --oformat srec tmpdir/sh1.o" } -if ![ld_simple_link $ld tmpdir/sh1.s1 $srec_relax_arg ] { +if ![ld_link $ld tmpdir/sh1.s1 $srec_relax_arg ] { fail $testsrec } else { # The file name is embedded in the S-records, so create both @@ -114,7 +114,7 @@ set testadjsw8 "SH switch8 adjustment after relax" if ![ld_assemble $as "-relax $srcdir/$subdir/adjsw8.s" tmpdir/adjsw8.o] { unresolved $testadjsw8 } else { - if ![ld_simple_link $ld tmpdir/adjsw8 "-relax tmpdir/adjsw8.o"] { + if ![ld_link $ld tmpdir/adjsw8 "-relax tmpdir/adjsw8.o"] { fail $testadjsw8 } else { send_log "exec $objdump -s tmpdir/adjsw8\n" @@ -156,7 +156,7 @@ if {![ld_assemble $as "-relax tmpdir/start.s" tmpdir/start.o] \ return } -if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] { +if ![ld_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] { fail $testlink unresolved $testjsr unresolved $testrun diff --git a/ld/testsuite/ld-sh/sh64/relax.exp b/ld/testsuite/ld-sh/sh64/relax.exp index c862c5e..fbde450 100644 --- a/ld/testsuite/ld-sh/sh64/relax.exp +++ b/ld/testsuite/ld-sh/sh64/relax.exp @@ -114,7 +114,7 @@ proc run_sh64relaxtest {sh64relaxtests} { # disabled. Hence the lax checking here. file delete $binfile - set result [ld_simple_link $ld $binfile " --no-warn-mismatch $ld_options $objfiles"] + set result [ld_link $ld $binfile " --no-warn-mismatch $ld_options $objfiles"] if ![file exists $binfile] { if {$expect_relaxed == -1} { diff --git a/ld/testsuite/ld-sh/sh64/relfail.exp b/ld/testsuite/ld-sh/sh64/relfail.exp index fdfce76..427e8d3 100644 --- a/ld/testsuite/ld-sh/sh64/relfail.exp +++ b/ld/testsuite/ld-sh/sh64/relfail.exp @@ -180,7 +180,7 @@ proc run_sh64relfailtests {sh64relfailtests} { file delete $binfile set objects "tmpdir/relfail-$testindex.o $baseobj" - set result [ld_simple_link $ld $binfile "--no-warn-mismatch $ld_options $objects"] + set result [ld_link $ld $binfile "--no-warn-mismatch $ld_options $objects"] set exists [file exists $binfile] if {$exists && $expect_fail == ""} { diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index 748a93b..93181dc 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -25,8 +25,10 @@ # Note that linking against ELF shared libraries is tested by the # bootstrap test. -# This test can only be run if ld generates native executables. -if ![isnative] then {return} +# Check to see if the C compiler works +if { [which $CC] == 0 } { + return +} # This test can only be run on a couple of ELF platforms. # Square bracket expressions seem to confuse istarget. @@ -137,7 +139,7 @@ proc shared_test { progname testname main sh1 sh2 dat args } { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { set shared "-bM:SRE -bE:$tmpdir/xcoff.exp" } - if {![ld_simple_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} { + if {![ld_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} { fail "$testname" return } @@ -150,11 +152,16 @@ proc shared_test { progname testname main sh1 sh2 dat args } { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { set rpath /lib:$tmpdir } - if ![ld_simple_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] { + if ![ld_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] { fail "$testname" return } + if ![isnative] { + unsupported $testname + return + } + # Run the resulting program send_log "$tmpdir/$progname >$tmpdir/$progname.out\n" verbose "$tmpdir/$progname >$tmpdir/$progname.out" diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp index 53ae96b..d4c3b8f 100644 --- a/ld/testsuite/ld-size/size.exp +++ b/ld/testsuite/ld-size/size.exp @@ -49,12 +49,6 @@ foreach t $test_list { run_dump_test [file rootname $t] } -# We need a native system. -if ![isnative] { - verbose "Native size relocation tests not run - not a native toolchain" - return -} - # We need a working compiler. if { [which $CC] == 0 } { verbose "Native size relocation tests not run - no compiler available" @@ -179,7 +173,7 @@ if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/size-7.out" ] } then { run_ld_link_exec_tests [list \ [list \ "Run size-1" \ - "tmpdir/libsize-1.so" \ + "-Wl,--no-as-needed tmpdir/libsize-1.so" \ "" \ {size-1.c} \ "size-1" \ @@ -187,7 +181,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-2" \ - "tmpdir/libsize-2.so" \ + "-Wl,--no-as-needed tmpdir/libsize-2.so" \ "" \ {size-2.c} \ "size-2" \ @@ -203,7 +197,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-3b" \ - "tmpdir/libsize-3a.so" \ + "-Wl,--no-as-needed tmpdir/libsize-3a.so" \ "" \ {size-3.c} \ "size-3b" \ @@ -219,7 +213,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-3d (1)" \ - "tmpdir/libsize-3b.so" \ + "-Wl,--no-as-needed tmpdir/libsize-3b.so" \ "" \ {size-3.c} \ "size-3d1" \ @@ -235,7 +229,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ {"Run size-3e" - "tmpdir/libsize-3c.so" "" + "-Wl,--no-as-needed tmpdir/libsize-3c.so" "" {size-3.c} "size-3e" "size-3.out"} ] \ [list \ @@ -276,7 +270,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-6" \ - "tmpdir/libsize-6b.so" \ + "-Wl,--no-as-needed tmpdir/libsize-6b.so" \ "" \ {size-6a.c} \ "size-6" \ @@ -285,7 +279,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-8" \ - "tmpdir/libsize-8.so --hash-styl=gnu" \ + "-Wl,--no-as-needed,--hash-styl=gnu tmpdir/libsize-8.so" \ "" \ {size-8a.c} \ "size-8" \ @@ -294,7 +288,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-9" \ - "tmpdir/libsize-9.so" \ + "-Wl,--no-as-needed tmpdir/libsize-9.so" \ "" \ {size-9a.c} \ "size-9" \ @@ -302,7 +296,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-10" \ - "tmpdir/libsize-10.so" \ + "-Wl,--no-as-needed tmpdir/libsize-10.so" \ "" \ {size-10a.c} \ "size-10" \ diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp index eb68d83..2720043 100644 --- a/ld/testsuite/ld-srec/srec.exp +++ b/ld/testsuite/ld-srec/srec.exp @@ -230,7 +230,7 @@ proc run_srec_test { test objs } { # 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] + 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 @@ -305,8 +305,8 @@ proc run_srec_test { test objs } { 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 } diff --git a/ld/testsuite/ld-tic6x/tic6x.exp b/ld/testsuite/ld-tic6x/tic6x.exp index 3129b02..c1b0608 100644 --- a/ld/testsuite/ld-tic6x/tic6x.exp +++ b/ld/testsuite/ld-tic6x/tic6x.exp @@ -148,12 +148,12 @@ if { ![ld_assemble_flags $as "-mpic -mpid=near" $srcdir/$subdir/shlib-1.s tmpdir || ![ld_assemble_flags $as "-mpic -mpid=near -mbig-endian" $srcdir/$subdir/shlib-1.s tmpdir/shlib-1b.o] || ![ld_assemble_flags $as "-mpic -mpid=near -mbig-endian" $srcdir/$subdir/shlib-2.s tmpdir/shlib-2b.o] || ![ld_assemble_flags $as -mbig-endian $srcdir/$subdir/shlib-app-1.s tmpdir/shlib-app-1b.o] - || ![ld_simple_link $ld tmpdir/libtest.so "-shared tmpdir/shlib-1.o tmpdir/shlib-2.o"] - || ![ld_simple_link $ld tmpdir/libtestb.so "-shared -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"] - || ![ld_simple_link $ld tmpdir/shlib.o "-r tmpdir/shlib-1.o tmpdir/shlib-2.o"] - || ![ld_simple_link $ld tmpdir/shlibb.o "-r -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"] - || ![ld_simple_link $ld tmpdir/dynapp-1 "tmpdir/libtest.so tmpdir/shlib-app-1.o"] - || ![ld_simple_link $ld tmpdir/dynapp-1b "-EB tmpdir/libtestb.so tmpdir/shlib-app-1b.o"] } { + || ![ld_link $ld tmpdir/libtest.so "-shared tmpdir/shlib-1.o tmpdir/shlib-2.o"] + || ![ld_link $ld tmpdir/libtestb.so "-shared -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"] + || ![ld_link $ld tmpdir/shlib.o "-r tmpdir/shlib-1.o tmpdir/shlib-2.o"] + || ![ld_link $ld tmpdir/shlibb.o "-r -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"] + || ![ld_link $ld tmpdir/dynapp-1 "tmpdir/libtest.so tmpdir/shlib-app-1.o"] + || ![ld_link $ld tmpdir/dynapp-1b "-EB tmpdir/libtestb.so tmpdir/shlib-app-1b.o"] } { unresolved "TIC6X OSABI tests" return } diff --git a/ld/testsuite/ld-undefined/weak-undef.exp b/ld/testsuite/ld-undefined/weak-undef.exp index 9109a22..eb28c2c 100644 --- a/ld/testsuite/ld-undefined/weak-undef.exp +++ b/ld/testsuite/ld-undefined/weak-undef.exp @@ -29,7 +29,7 @@ if { ![is_elf_format] && ![is_pecoff_format] } then { tmpdir/weak-undef.o]} then { # It's OK if .weak doesn't work on this target. unresolved $testname -} elseif {![ld_simple_link $ld tmpdir/weak-undef \ +} elseif {![ld_link $ld tmpdir/weak-undef \ "tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"]} then { # Weak symbols are broken for non-i386 PE targets. if {! [istarget i?86-*-*]} { @@ -71,7 +71,7 @@ if { $asflags == "" || ![is_elf_format] || ![check_shared_lib_support]} then { } elseif {![ld_assemble $as "$asflags $srcdir/$subdir/weak-fundef.s" \ tmpdir/weak-fundef.o]} then { fail $testname -} elseif {![ld_simple_link $ld tmpdir/weak-fundef.so \ +} elseif {![ld_link $ld tmpdir/weak-fundef.so \ "--shared tmpdir/weak-fundef.o"]} then { fail $testname } elseif {![is_remote host] && [which $nm] == 0} then { @@ -92,7 +92,7 @@ if { $asflags == "" || ![is_elf_format] || ![check_shared_lib_support]} then { # When linking a dynamic executable, weak undefined symbols become dynamic. set testname "weak undefined function symbols in dynamic exe" - if {![ld_simple_link $ld tmpdir/weak-fundef \ + if {![ld_link $ld tmpdir/weak-fundef \ "--no-as-needed tmpdir/weak-fundef.o tmpdir/weak-fundef.so"]} then { fail $testname } else { diff --git a/ld/testsuite/ld-unique/unique.exp b/ld/testsuite/ld-unique/unique.exp index 3a4ce22..668ac95 100644 --- a/ld/testsuite/ld-unique/unique.exp +++ b/ld/testsuite/ld-unique/unique.exp @@ -37,15 +37,6 @@ if { ![supports_gnu_unique] } { run_dump_test "unique" -# We need a native system. FIXME: Strictly speaking this -# is not true, we just need to know how to create a fully -# linked executable, including the C and Z libraries, using -# the linker that is under test. -if ![isnative] { - verbose "UNIQUE compiled tests not run - not a native toolchain" - return -} - # We need a working compiler. (Strictly speaking this is # not true, we could use target specific assembler files). if { [which $CC] == 0 } { @@ -124,25 +115,25 @@ if ![ld_compile "$CC -c -fPIC" "$srcdir/$subdir/unique_shared.s" "tmpdir/unique_ } # Create executable containing unique symbol. -if ![default_ld_link $ld "tmpdir/unique_prog" "tmpdir/unique.o"] { +if ![ld_link $CC "tmpdir/unique_prog" "tmpdir/unique.o"] { fail "Could not link a unique executable" set fails [expr $fails + 1] } # Create shared library containing unique symbol. -if ![ld_simple_link $ld "tmpdir/libunique_shared.so" "-shared tmpdir/unique_shared.o"] { +if ![ld_link $ld "tmpdir/libunique_shared.so" "-shared tmpdir/unique_shared.o"] { fail "Could not create a shared library containing an unique symbol" set fails [expr $fails + 1] } # Create executable NOT containing unique symbol linked against library. -if ![default_ld_link $ld "tmpdir/unique_shared_prog" "-Ltmpdir tmpdir/unique_empty.o -Bdynamic -lunique_shared -rpath ./tmpdir"] { +if ![ld_link $CC "tmpdir/unique_shared_prog" "-Ltmpdir tmpdir/unique_empty.o -Wl,-Bdynamic,-rpath=./tmpdir -lunique_shared"] { fail "Could not link a dynamic executable" set fails [expr $fails + 1] } # Create shared library containing unique symbol with reference. -if ![ld_simple_link $ld "tmpdir/libunique_shared_ref.so" "-shared tmpdir/unique_shared.o tmpdir/unique_empty.o"] { +if ![ld_link $ld "tmpdir/libunique_shared_ref.so" "-shared tmpdir/unique_shared.o tmpdir/unique_empty.o"] { fail "Could not create a shared library containing an unique symbol with reference" set fails [expr $fails + 1] } @@ -182,8 +173,12 @@ if { $fails == 0 } { } # Check the empty object file. -if {! [check_osabi tmpdir/unique_empty.o {UNIX - System V}]} { - fail "Object NOT containing unique does not have an OS/ABI field of System V" +case $target_triplet in { + { hppa*-*-linux* } { set expected_none {UNIX - GNU} } + default { set expected_none {UNIX - System V} } +} +if {! [check_osabi tmpdir/unique_empty.o $expected_none]} { + fail "Object NOT containing unique does not have an OS/ABI field of $expected_none" set fails [expr $fails + 1] } @@ -238,8 +233,8 @@ if { $fails == 0 } { } # Check the empty executable linked against unique shared library. -if {! [check_osabi tmpdir/unique_shared_prog {UNIX - System V}]} { - fail "Executable NOT containing unique does not have an OS/ABI field of System V" +if {! [check_osabi tmpdir/unique_shared_prog $expected_none]} { + fail "Executable NOT containing unique does not have an OS/ABI field of $expected_none" set fails [expr $fails + 1] } @@ -251,14 +246,3 @@ if {[contains_unique_symbol tmpdir/unique_shared_prog] == 1} { if { $fails == 0 } { pass "Checking shared empty executable" } - -# Clean up, unless we are being verbose, in which case we leave the files available. -if { $verbose < 1 } { - remote_file host delete "tmpdir/unique_empty.o" - remote_file host delete "tmpdir/unique.o" - remote_file host delete "tmpdir/unique_shared.o" - remote_file host delete "tmpdir/libunique_shared.so" - remote_file host delete "tmpdir/libunique_shared_ref.so" - remote_file host delete "tmpdir/unique_prog" - remote_file host delete "tmpdir/unique_shared_prog" -} diff --git a/ld/testsuite/ld-versados/versados.exp b/ld/testsuite/ld-versados/versados.exp index 9584b0c..55612e3 100644 --- a/ld/testsuite/ld-versados/versados.exp +++ b/ld/testsuite/ld-versados/versados.exp @@ -75,7 +75,7 @@ proc inspect { whichone } { return 1 } -if ![ld_simple_link $ld tmpdir/t1.out \ +if ![ld_link $ld tmpdir/t1.out \ " -T $srcdir/$subdir/t1.ld $srcdir/$subdir/t1-1.ro $srcdir/$subdir/t1-2.ro"] { fail $testname return @@ -87,7 +87,7 @@ if ![ld_simple_link $ld tmpdir/t1.out \ } -if ![ld_simple_link $ld tmpdir/t2.out \ +if ![ld_link $ld tmpdir/t2.out \ " -T $srcdir/$subdir/t2.ld $srcdir/$subdir/t2-2.ro \ $srcdir/$subdir/t2-1.ro $srcdir/$subdir/t2-3.ro"] { fail $testname diff --git a/ld/testsuite/ld-x86-64/dwarfreloc.exp b/ld/testsuite/ld-x86-64/dwarfreloc.exp index c96ffd0..7e2486b 100644 --- a/ld/testsuite/ld-x86-64/dwarfreloc.exp +++ b/ld/testsuite/ld-x86-64/dwarfreloc.exp @@ -58,14 +58,14 @@ set build_tests_ld { run_ld_link_tests $build_tests_ld set testname "Link dwarfreloc1xa.o and dwarfreloc2xa.o to dwarfreloca.o" -if [ld_simple_link $ld "tmpdir/dwarfreloca.o" "-r tmpdir/dwarfreloc1xa.o tmpdir/dwarfreloc2xa.o"] { +if [ld_link $ld "tmpdir/dwarfreloca.o" "-r tmpdir/dwarfreloc1xa.o tmpdir/dwarfreloc2xa.o"] { pass $testname } else { fail $testname } set testname "Link dwarfreloc1xb.o and dwarfreloc2xb.o to dwarfrelocb.o" -if [ld_simple_link $ld "tmpdir/dwarfrelocb.o" "-r tmpdir/dwarfreloc1xb.o tmpdir/dwarfreloc2xb.o"] { +if [ld_link $ld "tmpdir/dwarfrelocb.o" "-r tmpdir/dwarfreloc1xb.o tmpdir/dwarfreloc2xb.o"] { pass $testname } else { fail $testname diff --git a/ld/testsuite/ld-x86-64/tls.exp b/ld/testsuite/ld-x86-64/tls.exp index 2eddc31..7061320 100644 --- a/ld/testsuite/ld-x86-64/tls.exp +++ b/ld/testsuite/ld-x86-64/tls.exp @@ -97,8 +97,8 @@ run_ld_link_exec_tests [list \ ] \ [list \ "TLS GD/LD -> IE transition without PLT" \ - "tmpdir/tls-main1.o tmpdir/tls-gd1.o tmpdir/tls-ld1.o \ - tmpdir/libtls-1a.so -R tmpdir" \ + "-Wl,--no-as-needed,-R,tmpdir tmpdir/tls-main1.o \ + tmpdir/tls-gd1.o tmpdir/tls-ld1.o tmpdir/libtls-1a.so" \ "" \ { dummy.s } \ "tls-1d" \ @@ -106,8 +106,8 @@ run_ld_link_exec_tests [list \ ] \ [list \ "TLS without PLT (1)" \ - "tmpdir/tls-main1.o \ - tmpdir/libtls-1a.so tmpdir/libtls-1b.so -R tmpdir" \ + "-Wl,--no-as-needed,-R,tmpdir tmpdir/tls-main1.o \ + tmpdir/libtls-1a.so tmpdir/libtls-1b.so" \ "" \ { dummy.s } \ "tls-1e" \ @@ -115,8 +115,8 @@ run_ld_link_exec_tests [list \ ] \ [list \ "TLS without PLT (2)" \ - "tmpdir/tls-main1.o tmpdir/tls-def1.o \ - tmpdir/libtls-1b.so -R tmpdir" \ + "-Wl,--no-as-needed,-R,tmpdir tmpdir/tls-main1.o \ + tmpdir/tls-def1.o tmpdir/libtls-1b.so" \ "" \ { dummy.s } \ "tls-1f" \ diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index ac63a1d..26d739e 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -247,7 +247,7 @@ global ld set test_name "Mixed x86_64 and i386 input test 1" set test mixed1 -if { ![ld_simple_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } { +if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } { if [string match "*i386* architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64* output*" $link_output] { pass "$test_name" } { @@ -257,7 +257,7 @@ if { ![ld_simple_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test} set test_name "Mixed x86_64 and i386 input test 2" set test mixed2 -if { ![ld_simple_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } { +if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } { if [string match "*i386* architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64* output*" $link_output] { pass "$test_name" } { @@ -538,7 +538,7 @@ proc undefined_weak {cflags ldflags} { } if { [ regexp "\-fPIE" $cflags] - && ![ regexp "\-z nodynamic-undefined-weak" $ldflags] } { + && ![ regexp "nodynamic-undefined-weak" $ldflags] } { set weak_symbol "Weak defined" } else { set weak_symbol "Weak undefined" @@ -568,7 +568,7 @@ proc undefined_weak {cflags ldflags} { run_ld_link_exec_tests [list \ [list \ "Run pr19704" \ - "$ldflags tmpdir/libpr19704.so -R tmpdir" \ + "-Wl,--no-as-needed,-R,tmpdir $ldflags tmpdir/libpr19704.so" \ "" \ { pr19704a.c } \ "pr19704" \ @@ -833,8 +833,8 @@ if { [isnative] && [which $CC] != 0 } { run_ld_link_exec_tests [list \ [list \ "Run plt-main" \ - "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ - tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ + "-Wl,--no-as-needed tmpdir/plt-main1.o tmpdir/plt-main2.o \ + tmpdir/plt-main3.o tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ "" \ { plt-main5.c } \ "plt-main" \ @@ -842,8 +842,8 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run plt-main with PIE" \ - "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ - tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie" \ + "-Wl,--no-as-needed -pie tmpdir/plt-main1.o tmpdir/plt-main2.o \ + tmpdir/plt-main3.o tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ "" \ { plt-main5.c } \ "plt-main-pie" \ @@ -852,7 +852,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run copyreloc-main with PIE without -fPIE" \ - "--as-needed tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \ + "-Wl,--as-needed -pie tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so" \ "" \ { dummy.s } \ "copyreloc-main" \ @@ -860,7 +860,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr17689 with PIE without -fPIE" \ - "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \ + "-Wl,--no-as-needed -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \ "" \ { dummy.s } \ "pr17689" \ @@ -868,7 +868,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr17689 with PIE -z now without -fPIE" \ - "--as-needed tmpdir/pr17689b.o tmpdir/pr17689.so -pie -z now" \ + "-Wl,--as-needed,-z,now -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \ "" \ { dummy.s } \ "pr17689now" \ @@ -876,7 +876,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr18900" \ - "tmpdir/pr18900.o tmpdir/pr18900.so" \ + "-Wl,--no-as-needed tmpdir/pr18900.o tmpdir/pr18900.so" \ "" \ { dummy.s } \ "pr18900" \ @@ -884,7 +884,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr19031" \ - "tmpdir/pr19031.so" \ + "-Wl,--no-as-needed tmpdir/pr19031.so" \ "" \ { pr19031b.S pr19031c.c } \ "pr19031" \ @@ -892,7 +892,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run gotpcrel1" \ - "tmpdir/gotpcrel1d.so" \ + "-Wl,--no-as-needed tmpdir/gotpcrel1d.so" \ "" \ { gotpcrel1a.S gotpcrel1b.c gotpcrel1c.c } \ "gotpcrel1" \ @@ -930,7 +930,7 @@ if { [isnative] && [which $CC] != 0 } { run_ld_link_exec_tests [list \ [list \ "Run pr19784a" \ - "tmpdir/pr19784a.o tmpdir/libpr19784a.so" \ + "-Wl,--no-as-needed tmpdir/pr19784a.o tmpdir/libpr19784a.so" \ "" \ { dummy.s } \ "pr19784a" \ @@ -938,7 +938,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr19784b" \ - "--as-needed tmpdir/pr19784a.o tmpdir/libpr19784b.so" \ + "-Wl,--as-needed tmpdir/pr19784a.o tmpdir/libpr19784b.so" \ "" \ { dummy.s } \ "pr19784b" \ @@ -974,8 +974,9 @@ if { [isnative] && [which $CC] != 0 } { run_ld_link_exec_tests [list \ [list \ "Run plt-main with -z bndplt" \ - "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ - tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt" \ + "-Wl,--no-as-needed,-z,bndplt tmpdir/plt-main1.o \ + tmpdir/plt-main2.o tmpdir/plt-main3.o \ + tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ "" \ { plt-main5.c } \ "plt-main-bnd" \ @@ -983,8 +984,9 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run plt-main with PIE and -z bndplt" \ - "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ - tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -pie" \ + "-Wl,--no-as-needed,-z,bndplt -pie tmpdir/plt-main1.o \ + tmpdir/plt-main2.o tmpdir/plt-main3.o \ + tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ "" \ { plt-main5.c } \ "plt-main-pie-bnd" \ @@ -993,7 +995,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr20800" \ - "-pie -z now" \ + "-Wl,-z,now -pie" \ "" \ { pr20800a.S pr20800b.S } \ "pr20800" \ @@ -1005,8 +1007,8 @@ if { [isnative] && [which $CC] != 0 } { undefined_weak "" "" undefined_weak "-fPIE" "" undefined_weak "-fPIE" "-pie" - undefined_weak "-fPIE" "-z nodynamic-undefined-weak" - undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak" + undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak" + undefined_weak "-fPIE" "-pie -Wl,-z,nodynamic-undefined-weak" } if { ![istarget "x86_64-*-linux*"]} { diff --git a/ld/testsuite/ld-xtensa/coalesce.exp b/ld/testsuite/ld-xtensa/coalesce.exp index 425f865..a61624c 100644 --- a/ld/testsuite/ld-xtensa/coalesce.exp +++ b/ld/testsuite/ld-xtensa/coalesce.exp @@ -69,7 +69,7 @@ if ![ld_assemble $as $srcdir/$subdir/coalesce2.s tmpdir/coalesce2.o] { set object "tmpdir/coalesce" set outputfile "$object.txt" -if ![ld_simple_link $ld $object "-T $srcdir/$subdir/coalesce.t tmpdir/coalesce1.o tmpdir/coalesce2.o"] { +if ![ld_link $ld $object "-T $srcdir/$subdir/coalesce.t tmpdir/coalesce1.o tmpdir/coalesce2.o"] { verbose -log "failure in ld" fail $testname return diff --git a/ld/testsuite/ld-xtensa/diff_overflow.exp b/ld/testsuite/ld-xtensa/diff_overflow.exp index 3d857d4..c130ce7 100644 --- a/ld/testsuite/ld-xtensa/diff_overflow.exp +++ b/ld/testsuite/ld-xtensa/diff_overflow.exp @@ -36,7 +36,7 @@ if ![ld_assemble $as "--text-section-literals $srcdir/$subdir/diff_overflow2.s" set object "tmpdir/diff_overflow" -if ![ld_simple_link $ld $object "tmpdir/diff_overflow1.o tmpdir/diff_overflow2.o"] { +if ![ld_link $ld $object "tmpdir/diff_overflow1.o tmpdir/diff_overflow2.o"] { verbose -log "failure in ld" fail $testname return diff --git a/ld/testsuite/ld-xtensa/lcall.exp b/ld/testsuite/ld-xtensa/lcall.exp index 209079f..895406e 100644 --- a/ld/testsuite/ld-xtensa/lcall.exp +++ b/ld/testsuite/ld-xtensa/lcall.exp @@ -69,7 +69,7 @@ if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] { set object "tmpdir/lcall" set outputfile "$object.txt" -if ![ld_simple_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] { +if ![ld_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] { verbose -log "failure in ld" fail $testname return diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index d3bda4d..f8d5ec6 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -199,41 +199,9 @@ proc big_or_little_endian {} { return $flags } -# Link a program using ld. +# Link a program using ld # proc default_ld_link { ld target objects } { - global HOSTING_EMU - global HOSTING_CRT0 - global HOSTING_SCRT0 - global HOSTING_LIBS - global HOSTING_SLIBS - global LIBS - global host_triplet - global link_output - global exec_output - - if { [ string match "* -pie *" $objects ] } { - set objs "$HOSTING_SCRT0 $objects" - set libs "$LIBS $HOSTING_SLIBS" - } else { - set objs "$HOSTING_CRT0 $objects" - set libs "$LIBS $HOSTING_LIBS" - } - - if [is_endian_output_format $objects] then { - set flags [big_or_little_endian] - } else { - set flags "" - } - - remote_file host delete $target - - return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"] -} - -# Link a program using ld, without including any libraries. -# -proc default_ld_simple_link { ld target objects } { global host_triplet global exec_output @@ -409,7 +377,7 @@ proc default_ld_nm { nm nmflags object } { # Define various symbols needed when not linking against all # target libs. -proc ld_simple_link_defsyms {} { +proc ld_link_defsyms {} { set flags "--defsym __stack_chk_fail=0" @@ -1269,7 +1237,7 @@ proc run_ld_link_tests { ldtests args } { if { ![ar_simple_create $ar $ld_options $binfile "$objfiles $ld_after"] } { set failed 1 } - } elseif { ![ld_simple_link $ld $binfile "$ld_extra_opt -L$srcdir/$subdir $ld_options $objfiles $ld_after"] } { + } elseif { ![ld_link $ld $binfile "$ld_extra_opt -L$srcdir/$subdir $ld_options $objfiles $ld_after"] } { set maybe_failed 1 set ld_output "$exec_output" } @@ -1452,20 +1420,12 @@ proc run_ld_link_exec_tests { ldtests args } { } } - # We have to use $CC to build PIE and shared library. - if { [ string match "c" $lang ] } { - set link_proc ld_simple_link - set link_cmd $CC - } elseif { [ string match "c++" $lang ] } { - set link_proc ld_simple_link + if { [ string match "c++" $lang ] } { + set link_proc ld_link set link_cmd $CXX - } elseif { [ string match "-shared" $ld_options ] \ - || [ string match "-pie" $ld_options ] } { - set link_proc ld_simple_link - set link_cmd $CC } else { set link_proc ld_link - set link_cmd $ld + set link_cmd $CC } if { $binfile eq "tmpdir/" } { @@ -1486,7 +1446,7 @@ proc run_ld_link_exec_tests { ldtests args } { } } - if { $failed == 0 } { + if { $failed == 0 && [isnative] } { send_log "Running: $binfile > $binfile.out\n" verbose "Running: $binfile > $binfile.out" catch "exec $binfile > $binfile.out" exec_output @@ -1511,6 +1471,8 @@ proc run_ld_link_exec_tests { ldtests args } { if { $failed != 0 } { fail $testname + } elseif ![isnative] { + unsupported $testname } else { set errcnt 0 pass $testname @@ -1609,7 +1571,7 @@ proc run_cc_link_tests { ldtests } { set failed 1 } } else { - if { ![ld_simple_link $cc_cmd $binfile "$board_cflags -L$srcdir/$subdir $ldflags $objfiles"] } { + if { ![ld_link $cc_cmd $binfile "$board_cflags -L$srcdir/$subdir $ldflags $objfiles"] } { set failed 1 } -- cgit v1.1