2012-12-07 19:23:50 +00:00
|
|
|
# Expect script for ld-plugin LTO tests
|
2014-03-05 11:46:15 +00:00
|
|
|
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
2012-12-07 19:23:50 +00:00
|
|
|
#
|
|
|
|
# This file is part of the GNU Binutils.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
|
|
|
|
|
|
|
# These tests require plugin and LTO.
|
|
|
|
if { ![check_plugin_api_available]
|
|
|
|
|| ![check_lto_available] } {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
global CFLAGS
|
|
|
|
global CXXFLAGS
|
|
|
|
set saved_CFLAGS "$CFLAGS"
|
|
|
|
set saved_CXXFLAGS "$CXXFLAGS"
|
|
|
|
regsub -all "\\-Wp,-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
|
|
|
|
regsub -all "\\-Wp,-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
|
|
|
|
|
|
|
|
proc restore_notify { } {
|
|
|
|
global saved_CFLAGS
|
|
|
|
global saved_CXXFLAGS
|
|
|
|
set CFLAGS "$saved_CFLAGS"
|
|
|
|
set CXXFLAGS "$saved_CXXFLAGS"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Simple LTO tests and generate input files for complex LTO tests.
|
|
|
|
set lto_link_tests {
|
|
|
|
{"LTO 1"
|
|
|
|
"-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin"
|
|
|
|
{lto-1a.c lto-1b.c} {} "lto-1.exe"}
|
|
|
|
{"Build libdummy.a 2"
|
|
|
|
"" "-O2 -flto -fuse-linker-plugin"
|
|
|
|
{lto-2.c} {} "libdummy.a"}
|
|
|
|
{"LTO 2"
|
|
|
|
"-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" ""
|
|
|
|
{dummy.c} {} "lto-2.exe"}
|
|
|
|
{"Build libdummy.a 3a"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-3a.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 3c"
|
|
|
|
"" "-O2"
|
|
|
|
{lto-3c.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-3.a"
|
2013-11-27 13:43:39 +00:00
|
|
|
"" "-flto -ffat-lto-objects"
|
2012-12-07 19:23:50 +00:00
|
|
|
{lto-3b.c} {} "liblto-3.a"}
|
|
|
|
{"Build libdummy.a 5a"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-5a.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 5b"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-5b.c} {} "libdummy.a"}
|
|
|
|
{"LTO 6"
|
|
|
|
"-O2 -flto -fuse-linker-plugin" ""
|
|
|
|
{lto-6.c} {} "lto-6.exe" "c"}
|
|
|
|
{"Build libdummy.a 9"
|
2013-01-16 08:14:35 +00:00
|
|
|
"" "-O2 -finline -flto"
|
2012-12-07 19:23:50 +00:00
|
|
|
{lto-9.cc} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 11a"
|
|
|
|
"" "-O -flto"
|
|
|
|
{lto-11a.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 11b"
|
|
|
|
"" "-O -flto"
|
|
|
|
{lto-11b.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 11c"
|
|
|
|
"" "-O"
|
|
|
|
{lto-11c.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-12.a"
|
|
|
|
"" "-O2 -flto"
|
|
|
|
{lto-12c.c} {} "liblto-12.a"}
|
|
|
|
{"Build libdummy.a 12"
|
|
|
|
"" "-O2 -flto"
|
|
|
|
{lto-12a.c lto-12b.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 13"
|
|
|
|
"" "-O2 -flto"
|
|
|
|
{lto-13a.c lto-13b.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-13.a"
|
|
|
|
"" "-O2"
|
|
|
|
{lto-13c.c} {} "liblto-13.a"}
|
|
|
|
{"Build libdummy.a 14a"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-14a.c lto-14b.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-14.a"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-14c.c} {} "liblto-14.a"}
|
|
|
|
{"Build libdummy.a 15a"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-15a.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-15.a"
|
|
|
|
"" "-flto"
|
|
|
|
{lto-15b.c} {} "liblto-15.a"}
|
|
|
|
{"PR ld/12696"
|
|
|
|
"-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto"
|
|
|
|
{pr12696-1.cc} {} "pr12696-1r.o" "c"}
|
|
|
|
{"Build libdummy.a PR ld/12758"
|
|
|
|
"" ""
|
|
|
|
{pr12758a.s} {} "libdummy.a"}
|
|
|
|
{"Build libpr12758.a"
|
2013-11-27 13:43:39 +00:00
|
|
|
"" "-flto -O2 -ffat-lto-objects"
|
2012-12-07 19:23:50 +00:00
|
|
|
{pr12758b.c} {} "libpr12758.a"}
|
|
|
|
{"PR ld/12758"
|
|
|
|
"-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" ""
|
|
|
|
{dummy.c} {} "pr12758.exe"}
|
|
|
|
{"Build libdummy.a PR ld/12760"
|
|
|
|
"" ""
|
|
|
|
{pr12760a.c} {} "libdummy.a"}
|
|
|
|
{"Build libpr12760.a"
|
2013-11-27 13:43:39 +00:00
|
|
|
"" "-flto -O2 -ffat-lto-objects"
|
2012-12-07 19:23:50 +00:00
|
|
|
{pr12760b.c} {} "libpr12760.a"}
|
|
|
|
{"PR ld/12760"
|
|
|
|
"-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" ""
|
|
|
|
{dummy.c} {} "pr12760.exe" "c" "warning: Bad bar"}
|
|
|
|
{"Build libpr13183.a"
|
2013-11-27 13:43:39 +00:00
|
|
|
"-T" "-flto -O2 -ffat-lto-objects"
|
2012-12-07 19:23:50 +00:00
|
|
|
{pr13183a.c} {} "libpr13183.a"}
|
|
|
|
{"Build libdummy.a PR ld/13183"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{pr13183b.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a PR ld/13201"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{pr13201.c} {} "libdummy.a"}
|
|
|
|
{"PR ld/13287"
|
|
|
|
"-flto -fuse-linker-plugin -Wl,--as-needed" "-flto"
|
|
|
|
{pr13287.cc} {} "pr13287.exe" "c++"}
|
2013-03-30 00:38:39 +00:00
|
|
|
{"PR ld/15323"
|
2013-03-30 10:14:15 +00:00
|
|
|
"" "-O2"
|
|
|
|
{pr15323a.c} {} "libdummy.a" "c"}
|
2012-12-07 19:23:50 +00:00
|
|
|
}
|
|
|
|
|
2013-04-29 08:57:48 +00:00
|
|
|
if { [at_least_gcc_version 4 7] } {
|
|
|
|
set lto_link_tests [concat $lto_link_tests {
|
|
|
|
{"Build libdummy.a PR ld/12942 (1)"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{pr12942a.cc pr12942c.cc} {} "libdummy.a" "c++"}
|
|
|
|
{"Build libdummy.a PR ld/12942 (2)"
|
|
|
|
"" "-O0"
|
|
|
|
{pr12942b.cc} {} "libdummy.a" "c++"}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
|
2012-12-07 19:23:50 +00:00
|
|
|
# Generate input files for complex LTO tests for ELF.
|
|
|
|
set lto_link_elf_tests {
|
|
|
|
{"Build libdummy.a 7"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{lto-7a.c lto-7b.c lto-7c.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-7.so"
|
|
|
|
"-shared" "-O2 -fpic"
|
|
|
|
{lto-7d.c} {} "liblto-7.so" "c"}
|
|
|
|
{"Build libdummy.a 8a"
|
|
|
|
"" "-O2"
|
|
|
|
{lto-8a.c} {} "libdummy.a"}
|
|
|
|
{"Build libdummy.a 8b"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{lto-8b.c} {} "libdummy.a"}
|
|
|
|
{"Build liblto-17a.so"
|
|
|
|
"-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto"
|
|
|
|
{lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"}
|
|
|
|
{"Build liblto-17b.so 1"
|
|
|
|
"-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto"
|
|
|
|
{lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"}
|
|
|
|
{"Build liblto-17b.so 2"
|
|
|
|
"-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto"
|
|
|
|
{lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"}
|
|
|
|
{"PR ld/12982"
|
|
|
|
"-O2 -flto -fuse-linker-plugin" "-O2 -flto"
|
|
|
|
{pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"}
|
|
|
|
{"PR ld/12975"
|
|
|
|
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto"
|
|
|
|
{pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"}
|
|
|
|
{"PR ld/13229"
|
2013-01-16 08:14:35 +00:00
|
|
|
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto"
|
2012-12-07 19:23:50 +00:00
|
|
|
{pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"}
|
|
|
|
{"PR ld/13244"
|
|
|
|
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto"
|
|
|
|
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"}
|
2013-02-16 17:54:37 +00:00
|
|
|
{"Build libpr15146a.a"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{pr15146a.c} {} "lib15146a.a"}
|
|
|
|
{"Build pr15146b.so"
|
|
|
|
"-shared" "-O2 -fpic"
|
|
|
|
{pr15146b.c} {} "pr15146b.so" "c"}
|
|
|
|
{"Build pr15146c.so"
|
2013-02-18 09:13:11 +00:00
|
|
|
"-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic"
|
2013-02-16 17:54:37 +00:00
|
|
|
{pr15146c.c} {} "pr15146c.so" "c"}
|
|
|
|
{"PR ld/15146 (1)"
|
2013-02-18 09:13:11 +00:00
|
|
|
"-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" ""
|
2013-02-16 17:54:37 +00:00
|
|
|
{dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"}
|
|
|
|
{"Build libpr15146d.a"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{pr15146d.c} {} "lib15146d.a"}
|
|
|
|
{"Build libpr15146d.a"
|
|
|
|
"" "-flto -O2"
|
|
|
|
{pr15146d.c} {} "lib15146d.a"}
|
2012-12-07 19:23:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Check final symbols in executables.
|
|
|
|
set lto_link_symbol_tests {
|
|
|
|
{"LTO 3 symbol"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" ""
|
|
|
|
{dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"}
|
|
|
|
{"LTO 5 symbol"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" ""
|
|
|
|
{dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"}
|
|
|
|
{"LTO 9 symbol"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" ""
|
|
|
|
{dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"}
|
|
|
|
{"LTO 16a symbol"
|
|
|
|
"-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" "-flto"
|
|
|
|
{lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"}
|
|
|
|
{"LTO 16b symbol"
|
|
|
|
"-O2 -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" "-flto"
|
|
|
|
{lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"}
|
|
|
|
{"PR ld/13183"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" ""
|
|
|
|
{dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"}
|
|
|
|
}
|
|
|
|
|
|
|
|
# LTO run-time tests.
|
|
|
|
set lto_run_tests {
|
|
|
|
{"LTO 3a"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" ""
|
|
|
|
{dummy.c} "lto-3b.exe" "lto-3.out" "" "c"}
|
|
|
|
{"LTO 3b"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/lto-3.o" ""
|
|
|
|
{dummy.c} "lto-3c.exe" "lto-3.out" "" "c"}
|
|
|
|
{"LTO 3c"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" ""
|
|
|
|
{dummy.c} "lto-3d.exe" "lto-3.out" "" "c"}
|
|
|
|
{"LTO 5"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" ""
|
|
|
|
{dummy.c} "lto-5.exe" "lto-5.out" "" "c"}
|
|
|
|
{"LTO 11"
|
|
|
|
"-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" ""
|
|
|
|
{dummy.c} "lto-11.exe" "lto-11.out" "" "c"}
|
|
|
|
{"LTO 12a"
|
|
|
|
"-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/liblto-12.a tmpdir/lto-12b.o" ""
|
|
|
|
{dummy.c} "lto-12a.exe" "lto-12.out" "" "c"}
|
|
|
|
{"LTO 12b"
|
|
|
|
"-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/lto-12b.o tmpdir/liblto-12.a" ""
|
|
|
|
{dummy.c} "lto-12b.exe" "lto-12.out" "" "c"}
|
|
|
|
{"LTO 13"
|
|
|
|
"-O -flto -fuse-linker-plugin tmpdir/lto-13a.o tmpdir/liblto-13.a tmpdir/lto-13b.o" ""
|
|
|
|
{dummy.c} "lto-13.exe" "lto-13.out" "" "c"}
|
|
|
|
{"LTO 14"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-14a.o -Wl,--whole-archive tmpdir/liblto-14.a -Wl,--no-whole-archive tmpdir/lto-14b.o" ""
|
|
|
|
{dummy.c} "lto-14.exe" "lto-14.out" "" "c"}
|
|
|
|
{"LTO 15"
|
|
|
|
"-O2 -flto -fuse-linker-plugin -Wl,--start-group tmpdir/liblto-15.a tmpdir/lto-15a.o -Wl,--end-group" ""
|
|
|
|
{dummy.c} "lto-15.exe" "lto-15.out" "" "c"}
|
|
|
|
{"PR ld/13066"
|
|
|
|
"-O2 -flto -fuse-linker-plugin" ""
|
|
|
|
{pr13066.cc} "pr13066.exe" "pr13066.out" "" "c++"}
|
|
|
|
{"PR ld/13201"
|
|
|
|
"-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" ""
|
|
|
|
{dummy.c} "pr13201.exe" "pr13201.out" "" "c"}
|
2013-03-30 00:38:39 +00:00
|
|
|
{"PR ld/15323"
|
2013-03-30 10:14:15 +00:00
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" ""
|
2013-03-30 00:38:39 +00:00
|
|
|
{pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"}
|
2012-12-07 19:23:50 +00:00
|
|
|
}
|
|
|
|
|
2013-04-29 08:57:48 +00:00
|
|
|
if { [at_least_gcc_version 4 7] } {
|
|
|
|
set lto_run_tests [concat $lto_run_tests {
|
|
|
|
{"PR ld/12942 (1)"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942b.o" ""
|
|
|
|
{dummy.c} "pr12942a.exe" "pr12942.out" "" "c++"}
|
|
|
|
{"PR ld/12942 (2)"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942c.o" ""
|
|
|
|
{dummy.c} "pr12942c.exe" "pr12942.out" "" "c++"}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
|
2012-12-07 19:23:50 +00:00
|
|
|
# LTO run-time tests for ELF
|
|
|
|
set lto_run_elf_tests {
|
|
|
|
{"LTO 7"
|
2013-02-18 09:13:11 +00:00
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-7b.o tmpdir/lto-7c.o tmpdir/lto-7a.o -Wl,--no-as-needed tmpdir/liblto-7.so" ""
|
2012-12-07 19:23:50 +00:00
|
|
|
{dummy.c} "lto-7.exe" "lto-7.out" "" "c"}
|
|
|
|
{"LTO 8"
|
|
|
|
"-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" ""
|
|
|
|
{dummy.c} "lto-8.exe" "lto-8.out" "" "c"}
|
|
|
|
{"LTO TLS IE"
|
|
|
|
"-O2 -flto -fuse-linker-plugin" ""
|
|
|
|
{run-ie.c} "run-ie.exe" "run-ie.out" "" "c"}
|
|
|
|
}
|
|
|
|
|
|
|
|
run_cc_link_tests $lto_link_tests
|
|
|
|
|
2013-02-06 23:22:26 +00:00
|
|
|
# Restrict these to ELF targets that support shared libs and PIC.
|
2014-01-09 17:01:53 +00:00
|
|
|
if { [is_elf_format] && [check_lto_shared_available] } {
|
2012-12-07 19:23:50 +00:00
|
|
|
run_cc_link_tests $lto_link_elf_tests
|
2013-02-16 17:54:37 +00:00
|
|
|
set testname "PR ld/15146 (2)"
|
2013-02-18 09:13:11 +00:00
|
|
|
set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
|
2013-04-03 11:44:41 +00:00
|
|
|
if { [ regexp "undefined reference to symbol 'xxx'" $exec_output ] } {
|
2013-02-16 17:54:37 +00:00
|
|
|
pass $testname
|
|
|
|
} {
|
|
|
|
fail $testname
|
|
|
|
}
|
2012-12-07 19:23:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set testname "Build liblto-11.a"
|
|
|
|
remote_file host delete "tmpdir/liblto-11.a"
|
|
|
|
set catch_output [run_host_cmd "$ar" "rc tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
|
|
|
|
if {![string match "" $catch_output]} {
|
|
|
|
unresolved $testname
|
|
|
|
restore_notify
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2013-04-29 08:57:48 +00:00
|
|
|
if { [at_least_gcc_version 4 7] } {
|
|
|
|
# Check expected LTO linker errors.
|
|
|
|
set testname "PR ld/12942 (3)"
|
|
|
|
set exec_output [run_host_cmd "$CXX" "$gcc_gas_flag $gcc_ld_flag -O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"]
|
|
|
|
if { [ regexp "undefined reference to `link_error\\(\\)'" $exec_output ] } {
|
|
|
|
pass $testname
|
|
|
|
} {
|
|
|
|
fail $testname
|
|
|
|
}
|
2012-12-07 19:23:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Run "ld -r" to generate inputs for complex LTO tests.
|
|
|
|
run_dump_test "lto-3r"
|
|
|
|
remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
|
|
|
|
run_dump_test "lto-5r"
|
|
|
|
remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
|
|
|
|
|
|
|
|
run_cc_link_tests $lto_link_symbol_tests
|
|
|
|
|
2013-02-06 23:22:26 +00:00
|
|
|
# The following tests require running the executable generated by ld.
|
|
|
|
if ![isnative] {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2012-12-07 19:23:50 +00:00
|
|
|
run_ld_link_exec_tests [] $lto_run_tests
|
|
|
|
|
|
|
|
if { [is_elf_format] } {
|
|
|
|
run_ld_link_exec_tests [] $lto_run_elf_tests
|
|
|
|
}
|
|
|
|
|
|
|
|
restore_notify
|