Update PR ld/12365 test for GCC 6
[external/binutils.git] / ld / testsuite / ld-plugin / lto.exp
1 # Expect script for ld-plugin LTO tests
2 #   Copyright (C) 2011-2016 Free Software Foundation, Inc.
3 #
4 # This file is part of the GNU Binutils.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 # MA 02110-1301, USA.
20
21 # These tests require plugin and LTO.
22 if { ![check_plugin_api_available]
23      || ![check_lto_available] } {
24     return
25 }
26
27 global CFLAGS
28 global CXXFLAGS
29 set saved_CFLAGS "$CFLAGS"
30 set saved_CXXFLAGS "$CXXFLAGS"
31 regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
32 regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
33
34 proc restore_notify { } {
35   global saved_CFLAGS
36   global saved_CXXFLAGS
37   set CFLAGS "$saved_CFLAGS"
38   set CXXFLAGS "$saved_CXXFLAGS"
39 }
40
41 set plugin_names {
42     liblto_plugin.so
43     liblto_plugin-0.dll
44     cyglto_plugin-0.dll
45 }
46 set plug_opt ""
47 foreach plug $plugin_names {
48     set plug_so [run_host_cmd $CC "--print-prog-name $plug"]
49     if { $plug_so eq $plug } then {
50         set plug_so [run_host_cmd $CC "--print-file-name $plug"]
51     }
52     if { $plug_so ne $plug } then {
53         set plug_opt "--plugin $plug_so"
54         break
55     }
56 }
57 set lto_fat ""
58 set lto_no_fat ""
59 if { [check_lto_fat_available] } {
60   set lto_fat "-ffat-lto-objects"
61   set lto_no_fat "-fno-fat-lto-objects"
62 }
63
64 # Simple LTO tests and generate input files for complex LTO tests.
65 set lto_link_tests [list \
66   [list "LTO 1" \
67    "-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin" \
68    {lto-1a.c lto-1b.c} {} "lto-1.exe"] \
69   [list "Compile 2" \
70    "" "-O2 -flto -fuse-linker-plugin" \
71    {lto-2.c} {} ""] \
72   [list "LTO 2" \
73    "-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" "" \
74    {dummy.c} {} "lto-2.exe"] \
75   [list "Compile 3a" \
76    "" "-flto" \
77    {lto-3a.c} {} ""] \
78   [list "Compile 3c" \
79    "" "-O2" \
80    {lto-3c.c} {} ""] \
81   [list "Build liblto-3.a" \
82    "" "-flto $lto_fat" \
83    {lto-3b.c} {} "liblto-3.a"] \
84   [list "Compile 5a" \
85    "" "-flto $lto_fat" \
86    {lto-5a.c} {} ""] \
87   [list "Compile 5b" \
88    "" "-flto $lto_fat" \
89    {lto-5b.c} {} ""] \
90   [list "LTO 6" \
91    "-O2 -flto -fuse-linker-plugin" "" \
92    {lto-6.c} {} "lto-6.exe" "c"] \
93   [list "Compile PR ld/12365" \
94    "" "-flto -O2 $lto_fat" \
95    {pr12365a.c pr12365b.c pr12365c.c} {} ""] \
96   [list "Compile 9" \
97    "" "-O2 -finline -flto" \
98    {lto-9.cc} {} "" "c++"] \
99   [list "Compile 11a" \
100    "" "-O -flto" \
101    {lto-11a.c} {} ""] \
102   [list "Compile 11b" \
103    "" "-O -flto" \
104    {lto-11b.c} {} ""] \
105   [list "Compile 11c" \
106    "" "-O" \
107    {lto-11c.c} {} ""] \
108   [list "Build liblto-12.a" \
109    "$plug_opt" "-O2 -flto" \
110    {lto-12c.c} {} "liblto-12.a"] \
111   [list "Compile 12" \
112    "" "-O2 -flto" \
113    {lto-12a.c lto-12b.c} {} ""] \
114   [list "Compile 13" \
115    "" "-O2 -flto" \
116    {lto-13a.c lto-13b.c} {} ""] \
117   [list "Build liblto-13.a" \
118    "" "-O2" \
119    {lto-13c.c} {} "liblto-13.a"] \
120   [list "Compile 14a" \
121    "" "-flto" \
122    {lto-14a.c lto-14b.c} {} ""] \
123   [list "Build liblto-14.a" \
124    "$plug_opt" "-flto" \
125    {lto-14c.c} {} "liblto-14.a"] \
126   [list "Compile 15a" \
127    "" "-flto" \
128    {lto-15a.c} {} ""] \
129   [list "Build liblto-15.a" \
130    "$plug_opt" "-flto" \
131    {lto-15b.c} {} "liblto-15.a"] \
132   [list "PR ld/12696" \
133    "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" \
134    {pr12696-1.cc} {} "pr12696-1r.o" "c++"] \
135   [list "Compile PR ld/12758" \
136    "" "" \
137    {pr12758a.s} {} ""] \
138   [list "Build libpr12758.a" \
139    "" "-flto -O2 $lto_fat" \
140    {pr12758b.c} {} "libpr12758.a"] \
141   [list "PR ld/12758" \
142    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" "" \
143    {dummy.c} {} "pr12758.exe"] \
144   [list "Compile PR ld/12760" \
145    "" "-g -O0" \
146    {pr12760a.c} {} ""] \
147   [list "Build libpr12760.a" \
148    "" "-flto -O2 $lto_fat" \
149    {pr12760b.c} {} "libpr12760.a"] \
150   [list "PR ld/12760" \
151    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \
152    {dummy.c} {} "pr12760.exe" "c" "pr12760a.c:6: warning: Bad bar"] \
153   [list "Build libpr13183.a" \
154    "-T" "-flto -O2 $lto_fat" \
155    {pr13183a.c} {} "libpr13183.a"] \
156   [list "Compile PR ld/13183" \
157    "" "-flto -O2" \
158    {pr13183b.c} {} ""] \
159   [list "Compile PR ld/13201" \
160    "" "-flto -O2" \
161    {pr13201.c} {} ""] \
162   [list "PR ld/13287" \
163    "-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" \
164    {pr13287.cc} {} "pr13287.exe" "c++"] \
165   [list "PR ld/15323 (1)" \
166    "" "-O2" \
167    {pr15323a.c} {} "" "c"] \
168   [list "PR ld/15323 (2)" \
169    "-O2 -flto -r -nostdlib" "-O2 -flto" \
170    {pr15323a.c} {} "pr15323a-r.o" "c"] \
171   [list "Compile(1) PR ld/pr16846" \
172    "" "-flto" \
173    {pr16846a.c pr16846b.c} {} ""] \
174   [list "Compile(2) PR ld/pr16846" \
175    "" "" \
176    {pr16846c.c} {} ""] \
177   [list "PR ld/pr16846(1)" \
178    "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846b.o tmpdir/pr16846c.o" "" \
179    {dummy.c} {} "pr16846a.exe"] \
180   [list "PR ld/pr16846(2)" \
181    "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846c.o tmpdir/pr16846b.o" "" \
182    {dummy.c} {} "pr16846b.exe"] \
183   [list "PR ld/19317 (1)" \
184    "$plug_opt" "-flto $lto_no_fat" \
185    {pr19317.c} {} "libpr19317.a"] \
186 ]
187
188 if { [at_least_gcc_version 4 7] } {
189     set lto_link_tests [concat $lto_link_tests [list \
190       [list "Compile PR ld/12942 (1)" \
191        "" "-flto -O2" \
192        {pr12942a.cc pr12942c.cc} {} "" "c++"] \
193       [list "Compile PR ld/12942 (2)" \
194        "" "-O0" \
195        {pr12942b.cc} {} "" "c++"] \
196     ]]
197 }
198
199 # Generate input files for complex LTO tests for ELF.
200 set lto_link_elf_tests [list \
201   [list "Compile 7" \
202    "" "-flto -O2" \
203    {lto-7a.c lto-7b.c lto-7c.c} {} ""] \
204   [list "Build liblto-7.so" \
205    "-shared" "-O2 -fpic" \
206    {lto-7d.c} {} "liblto-7.so" "c"] \
207   [list "Compile 8a" \
208    "" "-O2" \
209    {lto-8a.c} {} ""] \
210   [list "Compile 8b" \
211    "" "-flto -O2" \
212    {lto-8b.c} {} ""] \
213   [list "Build liblto-17a.so" \
214    "-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" \
215    {lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"] \
216   [list "Build liblto-17b.so 1" \
217    "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
218    {lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"] \
219   [list "Build liblto-17b.so 2" \
220    "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
221    {lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"] \
222   [list "PR ld/12982" \
223    "-O2 -flto -fuse-linker-plugin" "-O2 -flto" \
224    {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"] \
225   [list "PR ld/12975" \
226    "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" \
227    {pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"] \
228   [list "PR ld/13229" \
229    "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto" \
230    {pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"] \
231   [list "PR ld/13244" \
232    "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
233    {pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
234   [list "Build libpr15146a.a" \
235    "$plug_opt" "-flto -O2" \
236    {pr15146a.c} {} "lib15146a.a"] \
237   [list "Build pr15146b.so" \
238    "-shared" "-O2 -fpic" \
239    {pr15146b.c} {} "pr15146b.so" "c"] \
240   [list "Build pr15146c.so" \
241    "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" \
242    {pr15146c.c} {} "pr15146c.so" "c"] \
243   [list "PR ld/15146 (1)" \
244    "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
245    {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
246   [list "Build libpr15146d.a" \
247    "$plug_opt" "-flto -O2" \
248    {pr15146d.c} {} "lib15146d.a"] \
249   [list "Build libpr16746a.a" \
250    "" "" \
251    {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
252   [list "Build libpr16746b.a" \
253    "$plug_opt" "-O2 -flto" \
254    {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
255   [list "PR ld/16746 (1)" \
256    "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
257    {dummy.c} {} "pr16746a.exe"] \
258   [list "PR ld/16746 (2)" \
259    "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
260    {dummy.c} {} "pr16746b.exe"] \
261   [list "PR ld/14918" \
262    "-flto" "-flto" \
263    {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \
264 ]
265
266 # Check final symbols in executables.
267 set lto_link_symbol_tests [list \
268   [list "LTO 3 symbol" \
269    "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
270    {dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"] \
271   [list "LTO 5 symbol" \
272    "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
273    {dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"] \
274   [list "LTO 9 symbol" \
275    "-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" \
276    {dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"] \
277   [list "LTO 16a symbol" \
278    "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" "-flto" \
279    {lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"] \
280   [list "LTO 16b symbol" \
281    "-O2 -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" "-flto" \
282    {lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"] \
283   [list "PR ld/13183" \
284    "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" \
285    {dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"] \
286 ]
287
288 # LTO run-time tests.
289 set lto_run_tests [list \
290   [list "LTO 3a" \
291    "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
292    {dummy.c} "lto-3b.exe" "lto-3.out" "" "c"] \
293   [list "LTO 3b" \
294    "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/lto-3.o" "" \
295    {dummy.c} "lto-3c.exe" "lto-3.out" "" "c"] \
296   [list "LTO 3c" \
297    "-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" "" \
298    {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
299   [list "LTO 5" \
300    "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
301    {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
302   [list "LTO 11" \
303    "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
304    {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
305   [list "LTO 12a" \
306    "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/liblto-12.a tmpdir/lto-12b.o" "" \
307    {dummy.c} "lto-12a.exe" "lto-12.out" "" "c"] \
308   [list "LTO 12b" \
309    "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/lto-12b.o tmpdir/liblto-12.a" "" \
310    {dummy.c} "lto-12b.exe" "lto-12.out" "" "c"] \
311   [list "LTO 13" \
312    "-O -flto -fuse-linker-plugin tmpdir/lto-13a.o tmpdir/liblto-13.a tmpdir/lto-13b.o" "" \
313    {dummy.c} "lto-13.exe" "lto-13.out" "" "c"] \
314   [list "LTO 14" \
315    "-O2 -flto -fuse-linker-plugin tmpdir/lto-14a.o -Wl,--whole-archive tmpdir/liblto-14.a -Wl,--no-whole-archive tmpdir/lto-14b.o" "" \
316    {dummy.c} "lto-14.exe" "lto-14.out" "" "c"] \
317   [list "LTO 15" \
318    "-O2 -flto -fuse-linker-plugin -Wl,--start-group tmpdir/liblto-15.a tmpdir/lto-15a.o -Wl,--end-group" "" \
319    {dummy.c} "lto-15.exe" "lto-15.out" "" "c"] \
320   [list "PR ld/13066" \
321    "-O2 -flto -fuse-linker-plugin" "" \
322    {pr13066.cc} "pr13066.exe" "pr13066.out" "" "c++"] \
323   [list "PR ld/13201" \
324    "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" \
325    {dummy.c} "pr13201.exe" "pr13201.out" "" "c"] \
326   [list "PR ld/15323 (3)" \
327    "-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" \
328    {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"] \
329   [list "PR ld/15323 (4)" \
330    "-O2 -flto tmpdir/pr15323a-r.o" "" \
331    {dummy.c} "pr15323a.exe" "pr15323.out" "-flto -O2" "c"] \
332   [list "PR ld/19317 (3)" \
333    "-O2 -flto tmpdir/pr19317-r.o" "" \
334    {dummy.c} "pr19317.exe" "pr19317.out" "-flto -O2" "c"] \
335 ]
336
337 if { [at_least_gcc_version 4 7] } {
338     set lto_run_tests [concat $lto_run_tests [list \
339       [list "PR ld/12942 (1)" \
340        "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942b.o" "" \
341        {dummy.c} "pr12942a.exe" "pr12942.out" "" "c++"] \
342       [list "PR ld/12942 (2)" \
343        "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942c.o" "" \
344        {dummy.c} "pr12942c.exe" "pr12942.out" "" "c++"] \
345     ]]
346 }
347
348 # LTO run-time tests for ELF
349 set lto_run_elf_tests [list \
350   [list "LTO 7" \
351    "-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" "" \
352    {dummy.c} "lto-7.exe" "lto-7.out" "" "c"] \
353   [list "LTO 8" \
354    "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" \
355    {dummy.c} "lto-8.exe" "lto-8.out" "" "c"] \
356   [list "LTO TLS IE" \
357    "-O2 -flto -fuse-linker-plugin" "" \
358    {run-ie.c} "run-ie.exe" "run-ie.out" "" "c"] \
359 ]
360
361 run_cc_link_tests $lto_link_tests
362
363 # Restrict these to ELF targets that support shared libs and PIC.
364 if { [is_elf_format] && [check_lto_shared_available] } {
365     run_cc_link_tests $lto_link_elf_tests
366     set testname "PR ld/15146 (2)"
367     set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
368     if { [ regexp "undefined reference to symbol 'xxx'" $exec_output ] } {
369         pass $testname
370     } {
371         fail $testname
372     }
373     set testname "PR ld/16746 (3)"
374     set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
375     if { [ regexp "warning: foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
376         pass $testname
377     } {
378         fail $testname
379     }
380     set testname "PR ld/16746 (4)"
381     set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
382     if { [ regexp "warning: foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
383         pass $testname
384     } {
385         fail $testname
386     }
387 }
388
389 set testname "Build liblto-11.a"
390 remote_file host delete "tmpdir/liblto-11.a"
391 set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
392 if {![string match "" $catch_output]} {
393     unresolved $testname
394     restore_notify
395     return
396 }
397
398 if { [at_least_gcc_version 4 7] } {
399     # Check expected LTO linker errors.
400     # Since the asm symbol name hack in pr12365b.c doesn't work on all
401     # targets, run PR ld/12365 tests only for known targets.
402     if { ([istarget "i?86-*-elf*"]
403            || (([istarget "i?86-*-linux*"] || [istarget "i?86-*-gnu*"])
404                 && ![istarget "*-*-*aout*"]
405                 && ![istarget "*-*-*oldld*"])
406            || [istarget "i?86-*-nacl*"]
407            || [istarget "x86_64-*-nacl*"]
408            || [istarget "x86_64-*-linux*"]
409            || [istarget "amd64-*-linux*"]) } {
410         set testname "PR ld/12365"
411         set exec_output [run_host_cmd "$CC" "-O2 -flto -flto-partition=none -fuse-linker-plugin -o tmpdir/pr12365 tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o"]
412         if { [ regexp "undefined reference to `my_bcopy'" $exec_output ] } {
413             # Linker should catch the reference to undefined `my_bcopy'
414             # error caused by a GCC bug.
415             pass $testname
416         } elseif { [ string match "" $exec_output ] } {
417             global READELF
418             set exec_output [run_host_cmd "$READELF" "-s -W tmpdir/pr12365"]
419             if { [ regexp "my_bcopy" $exec_output ] } {
420                 # Verify that there is no `my_bcopy' symbol in executable.
421                 fail $testname
422             } {
423                 pass $testname
424             }
425         } {
426             fail $testname
427         }
428     }
429     set testname "PR ld/12942 (3)"
430     set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"]
431     if { [ regexp "undefined reference to `link_error\\(\\)'" $exec_output ] } {
432         pass $testname
433     } {
434         fail $testname
435     }
436 }
437
438 # Run "ld -r" to generate inputs for complex LTO tests.
439 run_dump_test "lto-3r"
440 remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
441 run_dump_test "lto-5r"
442 remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
443
444 run_cc_link_tests $lto_link_symbol_tests
445
446 run_ld_link_tests [list \
447   [list "PR ld/19317 (2)" \
448    "-r tmpdir/pr19317.o" "" "" \
449    {dummy.s} {} "pr19317-r.o"] \
450 ]
451
452 # The following tests require running the executable generated by ld.
453 if ![isnative] {
454     return
455 }
456
457 run_ld_link_exec_tests [] $lto_run_tests
458
459 if { [is_elf_format] } {
460     run_ld_link_exec_tests [] $lto_run_elf_tests
461 }
462
463 restore_notify