| 1 | # Expect script for ld-plugin LTO tests |
| 2 | # Copyright (C) 2011-2020 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 | # Check to see if the C and C++ compilers work |
| 22 | if { ![check_compiler_available] || [which $CXX] == 0 } { |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | # These tests require plugin and LTO. |
| 27 | if { ![check_plugin_api_available] |
| 28 | || ![check_lto_available] } { |
| 29 | return |
| 30 | } |
| 31 | |
| 32 | global INT128_CFLAGS |
| 33 | |
| 34 | global CFLAGS |
| 35 | global CXXFLAGS |
| 36 | set saved_CFLAGS "$CFLAGS" |
| 37 | set saved_CXXFLAGS "$CXXFLAGS" |
| 38 | regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS |
| 39 | regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS |
| 40 | |
| 41 | global NOSANTIZE_CFLAGS |
| 42 | |
| 43 | proc restore_notify { } { |
| 44 | global saved_CFLAGS |
| 45 | global saved_CXXFLAGS |
| 46 | set CFLAGS "$saved_CFLAGS" |
| 47 | set CXXFLAGS "$saved_CXXFLAGS" |
| 48 | } |
| 49 | |
| 50 | set plugin_names { |
| 51 | liblto_plugin.so |
| 52 | liblto_plugin-0.dll |
| 53 | cyglto_plugin-0.dll |
| 54 | } |
| 55 | set plug_opt "" |
| 56 | foreach plug $plugin_names { |
| 57 | set plug_so [run_host_cmd $CC "--print-prog-name $plug"] |
| 58 | if { $plug_so eq $plug } then { |
| 59 | set plug_so [run_host_cmd $CC "--print-file-name $plug"] |
| 60 | } |
| 61 | if { $plug_so ne $plug } then { |
| 62 | set plug_opt "--plugin $plug_so" |
| 63 | break |
| 64 | } |
| 65 | } |
| 66 | set lto_fat "" |
| 67 | set lto_no_fat "" |
| 68 | if { [check_lto_fat_available] } { |
| 69 | set lto_fat "-ffat-lto-objects" |
| 70 | set lto_no_fat "-fno-fat-lto-objects" |
| 71 | } |
| 72 | |
| 73 | # Simple LTO tests and generate input files for complex LTO tests. |
| 74 | set lto_link_tests [list \ |
| 75 | [list "LTO 1" \ |
| 76 | "-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin" \ |
| 77 | {lto-1a.c lto-1b.c} {} "lto-1.exe"] \ |
| 78 | [list "Compile 2" \ |
| 79 | "" "-O2 -flto -fuse-linker-plugin $NOSANTIZE_CFLAGS" \ |
| 80 | {lto-2.c} {} ""] \ |
| 81 | [list "LTO 2" \ |
| 82 | "-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" \ |
| 83 | "$NOSANTIZE_CFLAGS" \ |
| 84 | {dummy.c} {} "lto-2.exe"] \ |
| 85 | [list "Compile 3a" \ |
| 86 | "" "-flto" \ |
| 87 | {lto-3a.c} {} ""] \ |
| 88 | [list "Compile 3c" \ |
| 89 | "" "-O2" \ |
| 90 | {lto-3c.c} {} ""] \ |
| 91 | [list "Build liblto-3.a" \ |
| 92 | "" "-flto $lto_fat" \ |
| 93 | {lto-3b.c} {} "liblto-3.a"] \ |
| 94 | [list "Compile 5a" \ |
| 95 | "" "-flto $lto_fat" \ |
| 96 | {lto-5a.c} {} ""] \ |
| 97 | [list "Compile 5b" \ |
| 98 | "" "-flto $lto_fat" \ |
| 99 | {lto-5b.c} {} ""] \ |
| 100 | [list "LTO 6" \ |
| 101 | "-O2 -flto -fuse-linker-plugin" "" \ |
| 102 | {lto-6.c} {} "lto-6.exe" "c"] \ |
| 103 | [list "Compile PR ld/12365" \ |
| 104 | "" "-flto -O2 $lto_fat" \ |
| 105 | {pr12365a.c pr12365b.c pr12365c.c} {} ""] \ |
| 106 | [list "Compile 9" \ |
| 107 | "" "-O2 -finline -flto" \ |
| 108 | {lto-9.cc} {} "" "c++"] \ |
| 109 | [list "Compile 11a" \ |
| 110 | "" "-O -flto" \ |
| 111 | {lto-11a.c} {} ""] \ |
| 112 | [list "Compile 11b" \ |
| 113 | "" "-O -flto" \ |
| 114 | {lto-11b.c} {} ""] \ |
| 115 | [list "Compile 11c" \ |
| 116 | "" "-O" \ |
| 117 | {lto-11c.c} {} ""] \ |
| 118 | [list "Build liblto-12.a" \ |
| 119 | "$plug_opt" "-O2 -flto" \ |
| 120 | {lto-12c.c} {} "liblto-12.a"] \ |
| 121 | [list "Compile 12" \ |
| 122 | "" "-O2 -flto" \ |
| 123 | {lto-12a.c lto-12b.c} {} ""] \ |
| 124 | [list "Compile 13" \ |
| 125 | "" "-O2 -flto" \ |
| 126 | {lto-13a.c lto-13b.c} {} ""] \ |
| 127 | [list "Build liblto-13.a" \ |
| 128 | "" "-O2" \ |
| 129 | {lto-13c.c} {} "liblto-13.a"] \ |
| 130 | [list "Compile 14a" \ |
| 131 | "" "-flto" \ |
| 132 | {lto-14a.c lto-14b.c} {} ""] \ |
| 133 | [list "Build liblto-14.a" \ |
| 134 | "$plug_opt" "-flto" \ |
| 135 | {lto-14c.c} {} "liblto-14.a"] \ |
| 136 | [list "Compile 15a" \ |
| 137 | "" "-flto" \ |
| 138 | {lto-15a.c} {} ""] \ |
| 139 | [list "Build liblto-15.a" \ |
| 140 | "$plug_opt" "-flto" \ |
| 141 | {lto-15b.c} {} "liblto-15.a"] \ |
| 142 | [list "PR ld/12696" \ |
| 143 | "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" \ |
| 144 | {pr12696-1.cc} {} "pr12696-1r.o" "c++"] \ |
| 145 | [list "Compile PR ld/12758" \ |
| 146 | "" "" \ |
| 147 | {pr12758a.s} {} ""] \ |
| 148 | [list "Build libpr12758.a" \ |
| 149 | "" "-flto -O2 $lto_fat $NOSANTIZE_CFLAGS" \ |
| 150 | {pr12758b.c} {} "libpr12758.a"] \ |
| 151 | [list "PR ld/12758" \ |
| 152 | "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" \ |
| 153 | "$NOSANTIZE_CFLAGS" \ |
| 154 | {dummy.c} {} "pr12758.exe"] \ |
| 155 | [list "Compile PR ld/12760" \ |
| 156 | "" "-g -O0" \ |
| 157 | {pr12760a.c} {} ""] \ |
| 158 | [list "Build libpr12760.a" \ |
| 159 | "" "-flto -O2 $lto_fat" \ |
| 160 | {pr12760b.c} {} "libpr12760.a"] \ |
| 161 | [list "PR ld/12760" \ |
| 162 | "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \ |
| 163 | {dummy.c} {{warning "pr12760a.c:6: warning: Bad \\.?bar"}} \ |
| 164 | "pr12760.exe" "c"] \ |
| 165 | [list "Build libpr13183.a" \ |
| 166 | "-T" "-flto -O2 $lto_fat" \ |
| 167 | {pr13183a.c} {} "libpr13183.a"] \ |
| 168 | [list "Compile PR ld/13183" \ |
| 169 | "" "-flto -O2" \ |
| 170 | {pr13183b.c} {} ""] \ |
| 171 | [list "Compile PR ld/13201" \ |
| 172 | "" "-flto -O2" \ |
| 173 | {pr13201.c} {} ""] \ |
| 174 | [list "PR ld/13287" \ |
| 175 | "-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" \ |
| 176 | {pr13287.cc} {} "pr13287.exe" "c++"] \ |
| 177 | [list "PR ld/15323 (1)" \ |
| 178 | "" "-O2" \ |
| 179 | {pr15323a.c} {} "" "c"] \ |
| 180 | [list "PR ld/15323 (2)" \ |
| 181 | "-O2 -flto -r -nostdlib" "-O2 -flto" \ |
| 182 | {pr15323a.c} {} "pr15323a-r.o" "c"] \ |
| 183 | [list "Compile(1) PR ld/pr16846" \ |
| 184 | "" "-flto" \ |
| 185 | {pr16846a.c pr16846b.c} {} ""] \ |
| 186 | [list "Compile(2) PR ld/pr16846" \ |
| 187 | "" "" \ |
| 188 | {pr16846c.c} {} ""] \ |
| 189 | [list "PR ld/pr16846(1)" \ |
| 190 | "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846b.o tmpdir/pr16846c.o" "" \ |
| 191 | {dummy.c} {} "pr16846a.exe"] \ |
| 192 | [list "PR ld/pr16846(2)" \ |
| 193 | "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846c.o tmpdir/pr16846b.o" "" \ |
| 194 | {dummy.c} {} "pr16846b.exe"] \ |
| 195 | [list "PR ld/19317 (1)" \ |
| 196 | "$plug_opt" "-flto $lto_no_fat" \ |
| 197 | {pr19317.c} {} "libpr19317.a"] \ |
| 198 | [list "Build pr20276a.o" \ |
| 199 | "" "-fno-lto -fcommon" \ |
| 200 | {pr20276a.c}] \ |
| 201 | [list "Build pr20276b.o" \ |
| 202 | "$plug_opt" "-flto $lto_no_fat -fcommon" \ |
| 203 | {pr20276b.c}] \ |
| 204 | [list "Build pr20267a.o" \ |
| 205 | "" "-fcommon" \ |
| 206 | {pr20267a.c}] \ |
| 207 | [list "Build libpr20267a.a" \ |
| 208 | "$plug_opt" "-flto $lto_fat -fcommon" \ |
| 209 | {pr20267b.c} {} "libpr20267a.a"] \ |
| 210 | [list "Build libpr20267b.a" \ |
| 211 | "$plug_opt" "-flto $lto_no_fat -fcommon" \ |
| 212 | {pr20267b.c} {} "libpr20267b.a"] \ |
| 213 | [list "Build pr20321" \ |
| 214 | "-flto -Wl,-plugin,$plug_so" "-flto" \ |
| 215 | {pr20321.c} {{warning ".*: duplicated plugin"}} \ |
| 216 | "pr20321" "c"] \ |
| 217 | [list "Build pr22502a.o" \ |
| 218 | "" "" \ |
| 219 | {pr22502a.c}] \ |
| 220 | [list "Build pr22502b.o" \ |
| 221 | "$plug_opt" "-flto $lto_no_fat" \ |
| 222 | {pr22502b.c}] \ |
| 223 | [list "Build pr22751.a" \ |
| 224 | "$plug_opt" "-flto $lto_no_fat $INT128_CFLAGS" \ |
| 225 | {pr22751.c} {} "pr22751.a"] \ |
| 226 | [list "Build libpr23818.so" \ |
| 227 | "-shared -flto -g -Wl,-version-script,pr23818.t" \ |
| 228 | "-g -flto $lto_fat" \ |
| 229 | {pr23818a.c pr23818b.c} \ |
| 230 | {{"readelf" {-s --wide} "pr23818.d"}} \ |
| 231 | "libpr23818.so"] \ |
| 232 | [list "Build libpr23958.so" \ |
| 233 | "-shared -flto -Wl,-version-script,pr23958.t" \ |
| 234 | "-g -flto $lto_fat" \ |
| 235 | {pr23958.c} \ |
| 236 | "" \ |
| 237 | "libpr23958.so"] \ |
| 238 | [list "Build pr24406-2b.o" \ |
| 239 | "" "-O2 -fno-lto" \ |
| 240 | {pr24406-2b.c}] \ |
| 241 | ] |
| 242 | |
| 243 | if { [at_least_gcc_version 10 0] } { |
| 244 | set lto_link_tests [concat $lto_link_tests [list \ |
| 245 | [list "pr25355.o" \ |
| 246 | "" \ |
| 247 | "-flto -fno-common $lto_no_fat" \ |
| 248 | {pr25355.c} \ |
| 249 | [list [list "nm" "$plug_opt" "pr25355.d"]]] \ |
| 250 | ]] |
| 251 | } |
| 252 | |
| 253 | if { [at_least_gcc_version 4 7] } { |
| 254 | set lto_link_tests [concat $lto_link_tests [list \ |
| 255 | [list "Compile PR ld/12942 (1)" \ |
| 256 | "" "-flto -O2" \ |
| 257 | {pr12942a.cc pr12942c.cc} {} "" "c++"] \ |
| 258 | [list "Compile PR ld/12942 (2)" \ |
| 259 | "" "-O0" \ |
| 260 | {pr12942b.cc} {} "" "c++"] \ |
| 261 | ]] |
| 262 | } |
| 263 | |
| 264 | set lto_compile_elf_tests [list \ |
| 265 | [list "Compile 7" \ |
| 266 | "" "-flto -O2" \ |
| 267 | {lto-7a.c lto-7b.c lto-7c.c} {} ""] \ |
| 268 | [list "Compile 8a" \ |
| 269 | "" "-O2" \ |
| 270 | {lto-8a.c} {} ""] \ |
| 271 | [list "Compile 8b" \ |
| 272 | "" "-flto -O2" \ |
| 273 | {lto-8b.c} {} ""] \ |
| 274 | [list "PR ld/23309" \ |
| 275 | "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections -Wl,--gc-sections,-u,KeepMe" \ |
| 276 | "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections" \ |
| 277 | {pr23309.c} {{"nm" {} "pr23309.d"}} "pr23309.exe" "c"] \ |
| 278 | ] |
| 279 | |
| 280 | # Generate input files for complex LTO tests for ELF. |
| 281 | set lto_link_elf_tests [list \ |
| 282 | [list "Build liblto-7.so" \ |
| 283 | "-shared" "-O2 -fpic" \ |
| 284 | {lto-7d.c} {} "liblto-7.so" "c"] \ |
| 285 | [list "Build liblto-17a.so" \ |
| 286 | "-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" \ |
| 287 | {lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"] \ |
| 288 | [list "Build liblto-17b.so 1" \ |
| 289 | "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \ |
| 290 | {lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"] \ |
| 291 | [list "Build liblto-17b.so 2" \ |
| 292 | "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \ |
| 293 | {lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"] \ |
| 294 | [list "PR ld/12975" \ |
| 295 | "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" \ |
| 296 | {pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"] \ |
| 297 | [list "PR ld/13229" \ |
| 298 | "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto" \ |
| 299 | {pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"] \ |
| 300 | [list "PR ld/13244" \ |
| 301 | "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \ |
| 302 | {pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \ |
| 303 | [list "Build libpr15146a.a" \ |
| 304 | "$plug_opt" "-flto -O2" \ |
| 305 | {pr15146a.c} {} "lib15146a.a"] \ |
| 306 | [list "Build pr15146b.so" \ |
| 307 | "-shared" "-O2 -fpic" \ |
| 308 | {pr15146b.c} {} "pr15146b.so" "c"] \ |
| 309 | [list "Build pr15146c.so" \ |
| 310 | "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" \ |
| 311 | {pr15146c.c} {} "pr15146c.so" "c"] \ |
| 312 | [list "PR ld/15146 (1)" \ |
| 313 | "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \ |
| 314 | {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \ |
| 315 | [list "Build libpr15146d.a" \ |
| 316 | "$plug_opt" "-flto -O2" \ |
| 317 | {pr15146d.c} {} "lib15146d.a"] \ |
| 318 | [list "Build libpr16746a.a" \ |
| 319 | "" "" \ |
| 320 | {pr16746a.c pr16746b.c} {} "lib15146a.a"] \ |
| 321 | [list "Build libpr16746b.a" \ |
| 322 | "$plug_opt" "-O2 -flto" \ |
| 323 | {pr16746c.c pr16746d.c} {} "lib15146b.a"] \ |
| 324 | [list "PR ld/16746 (1)" \ |
| 325 | "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \ |
| 326 | {dummy.c} {} "pr16746a.exe"] \ |
| 327 | [list "PR ld/16746 (2)" \ |
| 328 | "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \ |
| 329 | {dummy.c} {} "pr16746b.exe"] \ |
| 330 | [list "Build pr21382a.o" \ |
| 331 | "" "-O2 -flto" \ |
| 332 | {pr21382a.c} {} "" "c"] \ |
| 333 | [list "Build pr21382.so" \ |
| 334 | "-shared" "-O2 -fpic" \ |
| 335 | {pr21382b.c} {} "pr21382.so" "c"] \ |
| 336 | [list {Build pr22220lib.so} \ |
| 337 | {-shared -Wl,--version-script=pr22220lib.ver} {-fPIC} \ |
| 338 | {pr22220lib.cc} {} {pr22220lib.so} {c++}] \ |
| 339 | [list {Build pr22220main.o} \ |
| 340 | {} {-flto} \ |
| 341 | {pr22220main.cc} {} {} {c++}] \ |
| 342 | [list "Build pr24486a.o" \ |
| 343 | "$plug_opt" "-flto -O2" \ |
| 344 | {pr24486a.c} {} "" "c"] \ |
| 345 | [list "Build pr24486b.so" \ |
| 346 | "-shared" "-O2 -fpic" \ |
| 347 | {pr24486b.c} {} "pr24486b.so" "c"] \ |
| 348 | [list "Build pr24486c.so" \ |
| 349 | "-shared -Wl,--no-as-needed tmpdir/pr24486b.so" "-O2 -fpic" \ |
| 350 | {pr24486c.c} {} "pr24486c.so" "c"] \ |
| 351 | [list "PR ld/24486" \ |
| 352 | "-O2 -flto tmpdir/pr24486a.o tmpdir/pr24486c.so -Wl,--as-needed tmpdir/pr24486b.so" "" \ |
| 353 | {dummy.c} {} "pr24486.exe"] \ |
| 354 | [list "Build pr25593a-1.o" \ |
| 355 | "$plug_opt" "-flto -O2" \ |
| 356 | {pr25593a-1.c} {} "" "c"] \ |
| 357 | [list "Build pr25593a-2.o" \ |
| 358 | "" "-O2" \ |
| 359 | {pr25593a-2.c} {} "" "c"] \ |
| 360 | [list "Build pr25593b.o" \ |
| 361 | "" "-O2" \ |
| 362 | {pr25593b.c} {} "" "c"] \ |
| 363 | [list "Build pr25593c.so" \ |
| 364 | "-shared" "-O2 -fpic" \ |
| 365 | {pr25593c.c} {} "pr25593c.so" "c"] \ |
| 366 | [list "Build pr25593d.so" \ |
| 367 | "-shared" "-O2 -fpic" \ |
| 368 | {pr25593d.c} {} "pr25593d.so" "c"] \ |
| 369 | [list "Build pr25593e.so" \ |
| 370 | "-shared" "-O2 -fpic" \ |
| 371 | {pr25593e.c} {} "pr25593e.so" "c"] \ |
| 372 | [list "PR ld/r25593 (LTO)" \ |
| 373 | "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-1.o tmpdir/pr25593b.o \ |
| 374 | tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \ |
| 375 | {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593a.exe"] \ |
| 376 | [list "PR ld/r25593" \ |
| 377 | "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-2.o tmpdir/pr25593b.o \ |
| 378 | tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \ |
| 379 | {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593b.exe"] \ |
| 380 | [list "Build pr25618a.o" \ |
| 381 | "$plug_opt" "-O2 -flto -fpic" \ |
| 382 | {pr25618a.cc} {} "" "c++"] \ |
| 383 | [list "Build pr25618.a" \ |
| 384 | "$plug_opt" "-O2 -flto -fpic" \ |
| 385 | {pr25618b.cc} {} "pr25618.a" "c++"] \ |
| 386 | [list "Build pr25618.so" \ |
| 387 | "-shared -Wl,--exclude-libs,ALL tmpdir/pr25618a.o tmpdir/pr25618.a" \ |
| 388 | "-fpic" \ |
| 389 | {dummy.c} {{readelf {--dyn-syms --wide} pr25618.d}} "pr25618.so" "c++"] \ |
| 390 | ] |
| 391 | |
| 392 | # PR 14918 checks that libgcc is not spuriously included in a shared link of |
| 393 | # an empty program. The ARM crt1.o startup code however calls __libc_csu_init |
| 394 | # in /usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs |
| 395 | # __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the |
| 396 | # test fails. Hence this code to skip the test. |
| 397 | if { ! [istarget "arm*-*-*"] } { |
| 398 | set lto_link_elf_tests [concat $lto_link_elf_tests [list \ |
| 399 | [list "PR ld/14918" \ |
| 400 | "-flto" "-flto" \ |
| 401 | {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \ |
| 402 | ]] |
| 403 | } |
| 404 | |
| 405 | # PR 12982 checks that an executable stack is not created by default |
| 406 | # when using the LTO plugin. The HPPA target however requires an |
| 407 | # executable stack for syscall restarts and signal returns, so we |
| 408 | # skip this test for that target. |
| 409 | if { ! [istarget "hppa*-*-*"] } { |
| 410 | set lto_link_elf_tests [concat $lto_link_elf_tests [list \ |
| 411 | [list "PR ld/12982" \ |
| 412 | "-O2 -flto -fuse-linker-plugin" "-O2 -flto" \ |
| 413 | {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"] \ |
| 414 | ]] |
| 415 | } |
| 416 | |
| 417 | # Check final symbols in executables. |
| 418 | set lto_link_symbol_tests [list \ |
| 419 | [list "LTO 3 symbol" \ |
| 420 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \ |
| 421 | {dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"] \ |
| 422 | [list "LTO 5 symbol" \ |
| 423 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \ |
| 424 | {dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"] \ |
| 425 | [list "LTO 9 symbol" \ |
| 426 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" \ |
| 427 | {dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"] \ |
| 428 | [list "LTO 16a symbol" \ |
| 429 | "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" "-flto" \ |
| 430 | {lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"] \ |
| 431 | [list "LTO 16b symbol" \ |
| 432 | "-O2 -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" "-flto" \ |
| 433 | {lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"] \ |
| 434 | [list "PR ld/13183" \ |
| 435 | "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" \ |
| 436 | {dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"] \ |
| 437 | ] |
| 438 | |
| 439 | # LTO run-time tests. |
| 440 | set lto_run_tests [list \ |
| 441 | [list "LTO 3a" \ |
| 442 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \ |
| 443 | {dummy.c} "lto-3b.exe" "lto-3.out" "" "c"] \ |
| 444 | [list "LTO 3b" \ |
| 445 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/lto-3.o" "" \ |
| 446 | {dummy.c} "lto-3c.exe" "lto-3.out" "" "c"] \ |
| 447 | [list "LTO 3c" \ |
| 448 | "-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" "" \ |
| 449 | {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \ |
| 450 | [list "LTO 5" \ |
| 451 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \ |
| 452 | {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \ |
| 453 | [list "LTO 11" \ |
| 454 | "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \ |
| 455 | {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \ |
| 456 | [list "LTO 12a" \ |
| 457 | "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/liblto-12.a tmpdir/lto-12b.o" "" \ |
| 458 | {dummy.c} "lto-12a.exe" "lto-12.out" "" "c"] \ |
| 459 | [list "LTO 12b" \ |
| 460 | "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/lto-12b.o tmpdir/liblto-12.a" "" \ |
| 461 | {dummy.c} "lto-12b.exe" "lto-12.out" "" "c"] \ |
| 462 | [list "LTO 13" \ |
| 463 | "-O -flto -fuse-linker-plugin tmpdir/lto-13a.o tmpdir/liblto-13.a tmpdir/lto-13b.o" "" \ |
| 464 | {dummy.c} "lto-13.exe" "lto-13.out" "" "c"] \ |
| 465 | [list "LTO 14" \ |
| 466 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-14a.o -Wl,--whole-archive tmpdir/liblto-14.a -Wl,--no-whole-archive tmpdir/lto-14b.o" "" \ |
| 467 | {dummy.c} "lto-14.exe" "lto-14.out" "" "c"] \ |
| 468 | [list "LTO 15" \ |
| 469 | "-O2 -flto -fuse-linker-plugin -Wl,--start-group tmpdir/liblto-15.a tmpdir/lto-15a.o -Wl,--end-group" "" \ |
| 470 | {dummy.c} "lto-15.exe" "lto-15.out" "" "c"] \ |
| 471 | [list "PR ld/13066" \ |
| 472 | "-O2 -flto -fuse-linker-plugin" "" \ |
| 473 | {pr13066.cc} "pr13066.exe" "pr13066.out" "" "c++"] \ |
| 474 | [list "PR ld/13201" \ |
| 475 | "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" \ |
| 476 | {dummy.c} "pr13201.exe" "pr13201.out" "" "c"] \ |
| 477 | [list "PR ld/15323 (3)" \ |
| 478 | "-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" \ |
| 479 | {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"] \ |
| 480 | [list "PR ld/15323 (4)" \ |
| 481 | "-O2 -flto tmpdir/pr15323a-r.o" "" \ |
| 482 | {dummy.c} "pr15323a.exe" "pr15323.out" "-flto -O2" "c"] \ |
| 483 | [list "PR ld/19317 (3)" \ |
| 484 | "-O2 -flto tmpdir/pr19317-r.o" "" \ |
| 485 | {dummy.c} "pr19317.exe" "pr19317.out" "-flto -O2" "c"] \ |
| 486 | [list "Run pr20276" \ |
| 487 | "-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \ |
| 488 | {dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \ |
| 489 | [list "Run pr20267a" \ |
| 490 | "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \ |
| 491 | {dummy.c} "pr20267a" "pass.out" "-flto -O2 -fcommon" "c"] \ |
| 492 | [list "Run pr20267b" \ |
| 493 | "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \ |
| 494 | {dummy.c} "pr20267b" "pass.out" "-flto -O2 -fcommon" "c"] \ |
| 495 | [list "Run pr22502" \ |
| 496 | "-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \ |
| 497 | {dummy.c} "pr20267" "pass.out" "-flto -O2 -fcommon" "c"] \ |
| 498 | [list "Run pr22751" \ |
| 499 | "-O2 -flto" "" \ |
| 500 | {dummy.c} "pr22751" "pass.out" "-flto -O2" "c" "" \ |
| 501 | "-Wl,--whole-archive tmpdir/pr22751.a -Wl,--no-whole-archive"] \ |
| 502 | [list "Run pr24406-1" \ |
| 503 | "-O2 -flto" "" \ |
| 504 | {pr24406-1.c} "pr24406-1" "pass.out" "-flto -O2" "c" "" \ |
| 505 | "-Wl,--wrap=read"] \ |
| 506 | [list "Run pr24406-2" \ |
| 507 | "-O2 -flto" "" \ |
| 508 | {pr24406-2a.c} "pr24406-2" "pass.out" \ |
| 509 | "-flto -O2" "c" "" \ |
| 510 | "tmpdir/pr24406-2b.o -Wl,--wrap=cook"] \ |
| 511 | ] |
| 512 | |
| 513 | if { [at_least_gcc_version 4 7] } { |
| 514 | set lto_run_tests [concat $lto_run_tests [list \ |
| 515 | [list "PR ld/12942 (1)" \ |
| 516 | "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942b.o" "" \ |
| 517 | {dummy.c} "pr12942a.exe" "pr12942.out" "" "c++"] \ |
| 518 | [list "PR ld/12942 (2)" \ |
| 519 | "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942c.o" "" \ |
| 520 | {dummy.c} "pr12942c.exe" "pr12942.out" "" "c++"] \ |
| 521 | ]] |
| 522 | } |
| 523 | |
| 524 | # LTO run-time tests for ELF which require shared library support. |
| 525 | set lto_run_elf_shared_tests [list \ |
| 526 | [list "LTO 7" \ |
| 527 | "-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" "" \ |
| 528 | {dummy.c} "lto-7.exe" "lto-7.out" "" "c"] \ |
| 529 | [list "Run pr21382" \ |
| 530 | "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \ |
| 531 | {dummy.c} "pr21382.exe" "pass.out" "" "c"] \ |
| 532 | [list {pr22220a} \ |
| 533 | {-flto -fuse-linker-plugin tmpdir/pr22220main.o tmpdir/pr22220lib.so} {} \ |
| 534 | {dummy.c} {pr22220a.exe} {pass.out} {} {c++}] \ |
| 535 | [list {pr22220b} \ |
| 536 | {-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \ |
| 537 | {dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \ |
| 538 | ] |
| 539 | |
| 540 | # LTO run-time tests for ELF |
| 541 | set lto_run_elf_tests [list \ |
| 542 | [list "LTO 8" \ |
| 543 | "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" \ |
| 544 | {dummy.c} "lto-8.exe" "lto-8.out" "" "c"] \ |
| 545 | [list "LTO TLS IE" \ |
| 546 | "-O2 -flto -fuse-linker-plugin" "" \ |
| 547 | {run-ie.c} "run-ie.exe" "run-ie.out" "" "c"] \ |
| 548 | ] |
| 549 | |
| 550 | run_cc_link_tests $lto_link_tests |
| 551 | |
| 552 | # These compilation tests generate intermediate object files which will be used |
| 553 | # by some elf tests besides shared libs tests. So, always compile them. |
| 554 | run_cc_link_tests $lto_compile_elf_tests |
| 555 | |
| 556 | # Restrict these to ELF targets that support shared libs and PIC. |
| 557 | if { [is_elf_format] && [check_lto_shared_available] } { |
| 558 | run_cc_link_tests $lto_link_elf_tests |
| 559 | set testname "PR ld/15146 (2)" |
| 560 | 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"] |
| 561 | if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } { |
| 562 | pass $testname |
| 563 | } { |
| 564 | fail $testname |
| 565 | } |
| 566 | set testname "PR ld/16746 (3)" |
| 567 | set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"] |
| 568 | if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { |
| 569 | pass $testname |
| 570 | } { |
| 571 | fail $testname |
| 572 | } |
| 573 | set testname "PR ld/16746 (4)" |
| 574 | set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"] |
| 575 | if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { |
| 576 | pass $testname |
| 577 | } { |
| 578 | fail $testname |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | set testname "Build liblto-11.a" |
| 583 | remote_file host delete "tmpdir/liblto-11.a" |
| 584 | 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"] |
| 585 | if {![string match "" $catch_output]} { |
| 586 | unresolved $testname |
| 587 | restore_notify |
| 588 | return |
| 589 | } |
| 590 | |
| 591 | if { [at_least_gcc_version 4 7] } { |
| 592 | # Check expected LTO linker errors. |
| 593 | # Since the asm symbol name hack in pr12365b.c doesn't work on all |
| 594 | # targets, run PR ld/12365 tests only for known targets. |
| 595 | if { ([istarget "i?86-*-elf*"] |
| 596 | || [istarget "i?86-*-linux*"] |
| 597 | || [istarget "i?86-*-gnu*"] |
| 598 | || [istarget "i?86-*-nacl*"] |
| 599 | || [istarget "x86_64-*-nacl*"] |
| 600 | || [istarget "x86_64-*-linux*"] |
| 601 | || [istarget "amd64-*-linux*"]) } { |
| 602 | set testname "PR ld/12365" |
| 603 | 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"] |
| 604 | set exec_output [prune_warnings $exec_output] |
| 605 | if { [ regexp "undefined reference to `my_bcopy'" $exec_output ] } { |
| 606 | # Linker should catch the reference to undefined `my_bcopy' |
| 607 | # error caused by a GCC bug. |
| 608 | pass $testname |
| 609 | } elseif { [ string match "" $exec_output ] } { |
| 610 | global READELF |
| 611 | set exec_output [run_host_cmd "$READELF" "-s -W tmpdir/pr12365"] |
| 612 | if { [ regexp "my_bcopy" $exec_output ] } { |
| 613 | # Verify that there is no `my_bcopy' symbol in executable. |
| 614 | fail $testname |
| 615 | } { |
| 616 | pass $testname |
| 617 | } |
| 618 | } { |
| 619 | fail $testname |
| 620 | } |
| 621 | |
| 622 | run_cc_link_tests [list \ |
| 623 | [list \ |
| 624 | "Build pr22721a.so" \ |
| 625 | "-shared -nostdlib -nostartfiles -Wl,-version-script,pr22721.t" \ |
| 626 | "" \ |
| 627 | {pr22721a.s} \ |
| 628 | {} \ |
| 629 | "pr22721a.so" \ |
| 630 | ] \ |
| 631 | [list \ |
| 632 | "Build pr22721b.o" \ |
| 633 | "$plug_opt" \ |
| 634 | "-O2 -fPIC -flto $lto_no_fat" \ |
| 635 | {pr22721b.c} \ |
| 636 | ] \ |
| 637 | [list \ |
| 638 | "Build PR ld/pr22721" \ |
| 639 | "-O2 -flto -fuse-linker-plugin -nostdlib -nostartfiles \ |
| 640 | -Wl,-e,_start tmpdir/pr22721b.o tmpdir/pr22721a.so" \ |
| 641 | "" \ |
| 642 | {dummy.c} \ |
| 643 | {} \ |
| 644 | "pr22721.exe" |
| 645 | ] \ |
| 646 | ] |
| 647 | } |
| 648 | set testname "PR ld/12942 (3)" |
| 649 | set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"] |
| 650 | if { [ regexp "undefined reference to `\\.?link_error\\(\\)'" $exec_output ] } { |
| 651 | pass $testname |
| 652 | } { |
| 653 | fail $testname |
| 654 | } |
| 655 | |
| 656 | run_cc_link_tests [list \ |
| 657 | [list \ |
| 658 | "Build pr23460*.o" \ |
| 659 | "$plug_opt" \ |
| 660 | "-O2 -fPIC -flto $lto_no_fat" \ |
| 661 | {pr23460a.c pr23460b.c pr23460c.c \ |
| 662 | pr23460d.c pr23460e.c pr23460f.c} \ |
| 663 | ] \ |
| 664 | ] |
| 665 | set exec_output [run_host_cmd "sh" \ |
| 666 | "-c \"ulimit -n 16; \ |
| 667 | $ar -rc $plug_opt \ |
| 668 | tmpdir/libpr23460.a \ |
| 669 | tmpdir/pr23460a.o \ |
| 670 | tmpdir/pr23460b.o \ |
| 671 | tmpdir/pr23460c.o \ |
| 672 | tmpdir/pr23460d.o \ |
| 673 | tmpdir/pr23460e.o \ |
| 674 | tmpdir/pr23460f.o\""] |
| 675 | set exec_output [prune_warnings $exec_output] |
| 676 | if [string match "" $exec_output] then { |
| 677 | pass "PR binutils/23460" |
| 678 | } else { |
| 679 | fail "PR binutils/23460" |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | # Run "ld -r" to generate inputs for complex LTO tests. |
| 684 | run_dump_test "lto-3r" |
| 685 | remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o" |
| 686 | run_dump_test "lto-5r" |
| 687 | remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o" |
| 688 | |
| 689 | run_cc_link_tests $lto_link_symbol_tests |
| 690 | |
| 691 | run_ld_link_tests [list \ |
| 692 | [list "PR ld/19317 (2)" \ |
| 693 | "-r tmpdir/pr19317.o" "" "" \ |
| 694 | {dummy.s} {} "pr19317-r.o"] \ |
| 695 | ] |
| 696 | |
| 697 | run_ld_link_exec_tests $lto_run_tests |
| 698 | |
| 699 | if { [is_elf_format] } { |
| 700 | run_ld_link_exec_tests $lto_run_elf_tests |
| 701 | |
| 702 | # Note - it is not guaranteed that the ordering of symbols in the dynamic |
| 703 | # symbol table will match the ordering of the symbols specified by the |
| 704 | # --dynamic-list command line option. |
| 705 | # |
| 706 | # For PR22983 we want to make sure that all four symbols specified in |
| 707 | # pr222983.t are present in the output, but a simple sequences of regexps |
| 708 | # will not work as we do not know the order of the symbols. (Readelf |
| 709 | # does not have a symbol sorting option and the run_cc_list_tests proc |
| 710 | # does not allow for the output of the dump program to piped into `sort`). |
| 711 | # |
| 712 | # So instead we run readelf four times, each time checking for the |
| 713 | # presence of a specific symbol from the pr22983.t file. |
| 714 | run_cc_link_tests [list \ |
| 715 | [list \ |
| 716 | "Build pr22983" \ |
| 717 | "-Wl,--dynamic-list,pr22983.t" \ |
| 718 | "-flto" \ |
| 719 | {pr22983a.c pr22983b.c} \ |
| 720 | {{readelf {--dyn-syms --wide} pr22983.1.d} \ |
| 721 | {readelf {--dyn-syms --wide} pr22983.2.d} \ |
| 722 | {readelf {--dyn-syms --wide} pr22983.3.d} \ |
| 723 | {readelf {--dyn-syms --wide} pr22983.4.d}} \ |
| 724 | "pr22983" \ |
| 725 | ] \ |
| 726 | ] |
| 727 | } |
| 728 | |
| 729 | if { [is_elf_format] && [check_lto_shared_available] } { |
| 730 | run_ld_link_exec_tests $lto_run_elf_shared_tests |
| 731 | } |
| 732 | |
| 733 | proc pr20103 {cflags libs} { |
| 734 | global CC |
| 735 | |
| 736 | set testname "PR ld/20103 ($cflags $libs)" |
| 737 | set exec_output [run_host_cmd "$CC" "$cflags $libs"] |
| 738 | if { [ regexp "undefined reference to `\\.?dead'" $exec_output ] } { |
| 739 | pass "$testname (1)" |
| 740 | } { |
| 741 | fail "$testname (1)" |
| 742 | } |
| 743 | if { [ regexp "plugin needed to handle lto object" $exec_output ] } { |
| 744 | fail "$testname (2)" |
| 745 | } { |
| 746 | pass "$testname (2)" |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | if { [check_lto_fat_available] } { |
| 751 | run_cc_link_tests [list \ |
| 752 | [list \ |
| 753 | "Build fatpr20103a.a" \ |
| 754 | "$plug_opt" "-flto -ffat-lto-objects" \ |
| 755 | {pr20103a.c} {} "fatpr20103a.a" |
| 756 | ] \ |
| 757 | [list \ |
| 758 | "Build fatpr20103b.a" \ |
| 759 | "$plug_opt" "-flto -ffat-lto-objects" \ |
| 760 | {pr20103b.c} {} "fatpr20103b.a" |
| 761 | ] \ |
| 762 | [list \ |
| 763 | "Build fatpr20103c.a" \ |
| 764 | "$plug_opt" "-flto -ffat-lto-objects" \ |
| 765 | {pr20103c.c} {} "fatpr20103c.a" \ |
| 766 | ] \ |
| 767 | [list \ |
| 768 | "Build thinpr20103a.a" \ |
| 769 | "$plug_opt" "-flto -fno-fat-lto-objects" \ |
| 770 | {pr20103a.c} {} "thinpr20103a.a" |
| 771 | ] \ |
| 772 | [list \ |
| 773 | "Build thinpr20103b.a" \ |
| 774 | "$plug_opt" "-flto -fno-fat-lto-objects" \ |
| 775 | {pr20103b.c} {} "thinpr20103b.a" |
| 776 | ] \ |
| 777 | [list \ |
| 778 | "Build thinpr20103c.a" \ |
| 779 | "$plug_opt" "-flto -fno-fat-lto-objects" \ |
| 780 | {pr20103c.c} {} "thinpr20103c.a" \ |
| 781 | ] \ |
| 782 | [list \ |
| 783 | "Build pr20103a" \ |
| 784 | "-O2 -flto -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \ |
| 785 | "-O2 -flto" \ |
| 786 | {dummy.c} {} "pr20103a" \ |
| 787 | ] \ |
| 788 | [list \ |
| 789 | "Build pr20103b" \ |
| 790 | "-O2 -flto -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \ |
| 791 | "-O2 -flto" \ |
| 792 | {dummy.c} {} "pr20103b" \ |
| 793 | ] \ |
| 794 | [list \ |
| 795 | "Build pr20103c" \ |
| 796 | "-O2 -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \ |
| 797 | "-O2" \ |
| 798 | {dummy.c} {} "pr20103c" \ |
| 799 | ] \ |
| 800 | ] |
| 801 | pr20103 "-O2 -flto" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a" |
| 802 | pr20103 "-O2 -flto" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a" |
| 803 | pr20103 "-O2" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a" |
| 804 | |
| 805 | if { [at_least_gcc_version 4 9] } { |
| 806 | run_cc_link_tests [list \ |
| 807 | [list \ |
| 808 | "Build pr20103d" \ |
| 809 | "-O2 -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \ |
| 810 | "-O2" \ |
| 811 | {dummy.c} {} "pr20103d" \ |
| 812 | ] \ |
| 813 | ] |
| 814 | pr20103 "-O2" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a" |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | restore_notify |