]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/obj-c++.dg/lto/lto.exp
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / obj-c++.dg / lto / lto.exp
1 # Copyright (C) 2010-2021 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
16 #
17 # Based on gcc/testsuite/gcc.dg/lto/lto.exp.
18
19 # Test link-time optimization across multiple files.
20 #
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.
24
25 if $tracelevel then {
26 strace $tracelevel
27 }
28
29 # Load procedures from common libraries.
30 load_lib standard.exp
31 load_lib obj-c++-dg.exp
32
33 # Load the language-independent compabibility support procedures.
34 load_lib lto.exp
35
36 # If LTO has not been enabled, bail.
37 if { ![check_effective_target_lto] } {
38 return
39 }
40
41 global LTO_OPTIONS
42
43 set LTO_OPTIONS [list \
44 {-O0 -flto -fgnu-runtime -Wno-objc-root-class} \
45 {-O2 -flto -fgnu-runtime -Wno-objc-root-class} \
46 {-O0 -flto -flto-partition=none -fgnu-runtime -Wno-objc-root-class} \
47 {-O2 -flto -flto-partition=none -fgnu-runtime -Wno-objc-root-class} \
48 ]
49
50 obj-c++_init
51 lto_init no-mathlib
52
53 # Define an identifier for use with this suite to avoid name conflicts
54 # with other lto tests running at the same time.
55 set sid "obj_cpp_lto"
56 set tests [lsort [glob -nocomplain $srcdir/$subdir/*_0.mm]]
57
58 # Main loop.
59 foreach src $tests {
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 {
62 continue
63 }
64 lto-execute $src $sid
65 }
66
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 -Wno-objc-root-class} \
71 {-O2 -flto -fnext-runtime -Wno-objc-root-class} \
72 {-O0 -flto -flto-partition=none -fnext-runtime -Wno-objc-root-class} \
73 {-O2 -flto -flto-partition=none -fnext-runtime -Wno-objc-root-class} \
74 ]
75 foreach src $tests {
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 {
78 continue
79 }
80 lto-execute $src $sid
81 }
82 }
83
84 lto_finish