1 # Copyright (C) 2010-2016 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # Based on gcc/testsuite/gcc.dg/lto/lto.exp.
19 # Test link-time optimization across multiple files.
21 # Programs are broken into multiple files. Each one is compiled
22 # separately with LTO information. The final executable is generated
23 # by collecting all the generated object files using regular LTO or WHOPR.
29 # Load procedures from common libraries.
31 load_lib obj-c++-dg.exp
33 # Load the language-independent compabibility support procedures.
36 # If LTO has not been enabled, bail.
37 if { ![check_effective_target_lto] } {
43 set LTO_OPTIONS [list \
44 {-O0 -flto -fgnu-runtime} \
45 {-O2 -flto -fgnu-runtime} \
46 {-O0 -flto -flto-partition=none -fgnu-runtime} \
47 {-O2 -flto -flto-partition=none -fgnu-runtime} \
53 # Define an identifier for use with this suite to avoid name conflicts
54 # with other lto tests running at the same time.
56 set tests [lsort [glob -nocomplain $srcdir/$subdir/*_0.mm]]
60 # If we're only testing specific files and this isn't one of them, skip it.
61 if ![runtest_file_p $runtests $src] then {
67 # darwin targets can also run code with the NeXT runtime.
68 if [istarget "*-*-darwin*" ] {
69 set LTO_OPTIONS [list \
70 {-O0 -flto -fnext-runtime} \
71 {-O2 -flto -fnext-runtime} \
72 {-O0 -flto -flto-partition=none -fnext-runtime} \
73 {-O2 -flto -flto-partition=none -fnext-runtime} \
76 # If we're only testing specific files and this isn't one of them, skip it.
77 if ![runtest_file_p $runtests $src] then {