Skip to content

Commit c467e60

Browse files
authored
Check if LLD is built when checking if lto_supported (#92752)
Otherwise, older copies of LLD may not understand the latest bitcode versions (for example, if we increase `ModuleSummaryIndex::BitCodeSummaryVersion`) Related to #90692 (comment)
1 parent b59567b commit c467e60

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler-rt/test/lit.common.cfg.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,13 @@ def is_binutils_lto_supported():
744744
return True
745745

746746

747+
def is_lld_lto_supported():
748+
# LLD does support LTO, but we require it to be built with the latest
749+
# changes to claim support. Otherwise older copies of LLD may not
750+
# understand new bitcode versions.
751+
return os.path.exists(os.path.join(config.llvm_tools_dir, "lld"))
752+
753+
747754
def is_windows_lto_supported():
748755
if not target_is_msvc:
749756
return True
@@ -755,7 +762,7 @@ def is_windows_lto_supported():
755762
config.lto_flags = ["-Wl,-lto_library," + liblto_path()]
756763
elif config.host_os in ["Linux", "FreeBSD", "NetBSD"]:
757764
config.lto_supported = False
758-
if config.use_lld:
765+
if config.use_lld and is_lld_lto_supported():
759766
config.lto_supported = True
760767
if is_binutils_lto_supported():
761768
config.available_features.add("binutils_lto")

0 commit comments

Comments
 (0)