[binutils-gdb] ld: Run PR ld/34570 tests only if supported
"H.J. Lu via Binutils-cvs" <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c562e4ffa94c50ee974200a7457e435cec411a43 commit c562e4ffa94c50ee974200a7457e435cec411a43 Author: H.J. Lu <[email protected]> Date: Fri Aug 28 16:02:11 2026 +0800 ld: Run PR ld/34570 tests only if supported Since Clang doesn't support all GCC options, PR ld/34570 tests fail to compile if GCC specific options are used to build binutils. Add llvm_lto_tests to lto.exp and don't run PR ld/34570 tests if Clang fails to compile them. PR ld/34576 PR ld/34570 * testsuite/ld-plugin/lto.exp (llvm_lto_tests): New. Use it. Signed-off-by: H.J. Lu <[email protected]> Diff: --- ld/testsuite/ld-plugin/lto.exp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 00578a63791..41593efc253 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -1452,12 +1452,20 @@ if { [check_lto_fat_available] } { } } -# Skip native x32 and i?86 targets since system LLVMgold.so may not be -# compatible with native x32 and i?86 targets binutils. -if { ![istarget "x86_64-*-linux*-gnux32"] - && ![istarget "i?86-*-*"] - && [info exists CLANG_FOR_TARGET] - && ![string match "" $llvm_plug_opt] } { +proc llvm_lto_tests {} { + global CC_FOR_TARGET + global CLANG_FOR_TARGET + global llvm_plug_opt + + # Skip native x32 and i?86 targets since system LLVMgold.so may not + # be compatible with native x32 and i?86 targets binutils. + if {[istarget "x86_64-*-linux*-gnux32"] + || [istarget "i?86-*-*"] + || ![info exists CLANG_FOR_TARGET] + || [string match "" $llvm_plug_opt] } { + return + } + set CC_FOR_TARGET_saved "$CC_FOR_TARGET" set CC_FOR_TARGET "$CLANG_FOR_TARGET" run_cc_link_tests [list \ @@ -1473,6 +1481,14 @@ if { ![istarget "x86_64-*-linux*-gnux32"] "-flto" \ {pr34572b.c} \ ] \ + ] + + if {![file exists tmpdir/pr34572a.o] + || ![file exists tmpdir/pr34572b.o]} { + return + } + + run_cc_link_tests [list \ [list \ "Build pr34572a.exe" \ "-flto -Wl,--start-lib tmpdir/pr34572a.o -Wl,--end-lib" \ @@ -1509,4 +1525,6 @@ if { ![istarget "x86_64-*-linux*-gnux32"] set CC_FOR_TARGET "$CC_FOR_TARGET_saved" } +llvm_lto_tests + restore_notify