diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-07-31 07:40:27 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-07-31 07:57:04 -0700 |
commit | e6a6c7676a7df49cfbbffda26eadd2032dbc2bbe (patch) | |
tree | 7399b145a808662b9c4b49959ba9c14a381f0c0c /ld/testsuite/ld-elfvers | |
parent | a896df97b952d4f3feed8068eaa70147d12e0e28 (diff) | |
download | binutils-e6a6c7676a7df49cfbbffda26eadd2032dbc2bbe.zip binutils-e6a6c7676a7df49cfbbffda26eadd2032dbc2bbe.tar.gz binutils-e6a6c7676a7df49cfbbffda26eadd2032dbc2bbe.tar.bz2 |
ld: Add -fno-lto to linker tests
LTO can be used to build binutils with
$ CC="gcc -flto -ffat-lto-objects -Wl,--as-needed" CXX="g++ -flto -ffat-lto-objects -Wl,--as-needed" .../configure
But not all linker tests are compatible with LTO. Pass -fno-lto to CC
to disable LTO on linker tests by default. -flto is passed explicitly
to CC in linker LTO tests.
* testsuite/ld-elf/indirect.exp: Append -fno-lto to CC.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-plugin/lto.exp (no_lto): New.
Add $no_lto to build pr15146c.so.
* testsuite/lib/ld-lib.exp (at_least_gcc_version): Filter out
-Wl,xxx options.
(check_gcc_plugin_enabled): Likewise.
(run_ld_link_exec_tests): Prepend -fno-lto to $cflags.
(run_cc_link_tests): Likewise.
Diffstat (limited to 'ld/testsuite/ld-elfvers')
-rw-r--r-- | ld/testsuite/ld-elfvers/vers.exp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index 82b79ad..299cdaa 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -708,7 +708,14 @@ proc build_exec { test source execname flags solibname verexp versymexp symexp } set shared "--shared --no-undefined-version" set script --version-script - if ![ld_compile "$CC -S $CFLAGS" $srcdir/$subdir/$source $tmpdir/$execname.s] { + + # Disable LTO for these tests. + set cc_cmd "$CC -S $CFLAGS" + if {[check_lto_available]} { + append cc_cmd " -fno-lto" + } + + if ![ld_compile $cc_cmd $srcdir/$subdir/$source $tmpdir/$execname.s] { unresolved "$test" return } |