@@ -31,7 +31,7 @@ use crate::{CLang, GitRepo, Kind, trace};
3131pub struct LlvmResult {
3232 /// Path to llvm-config binary.
3333 /// NB: This is always the host llvm-config!
34- pub llvm_config : PathBuf ,
34+ pub host_llvm_config : PathBuf ,
3535 /// Path to LLVM cmake directory for the target.
3636 pub llvm_cmake_dir : PathBuf ,
3737}
@@ -111,14 +111,14 @@ pub fn prebuilt_llvm_config(
111111 && let Some ( ref s) = config. llvm_config
112112 {
113113 check_llvm_version ( builder, s) ;
114- let llvm_config = s. to_path_buf ( ) ;
115- let mut llvm_cmake_dir = llvm_config . clone ( ) ;
114+ let host_llvm_config = s. to_path_buf ( ) ;
115+ let mut llvm_cmake_dir = host_llvm_config . clone ( ) ;
116116 llvm_cmake_dir. pop ( ) ;
117117 llvm_cmake_dir. pop ( ) ;
118118 llvm_cmake_dir. push ( "lib" ) ;
119119 llvm_cmake_dir. push ( "cmake" ) ;
120120 llvm_cmake_dir. push ( "llvm" ) ;
121- return LlvmBuildStatus :: AlreadyBuilt ( LlvmResult { llvm_config , llvm_cmake_dir } ) ;
121+ return LlvmBuildStatus :: AlreadyBuilt ( LlvmResult { host_llvm_config , llvm_cmake_dir } ) ;
122122 }
123123
124124 if handle_submodule_when_needed {
@@ -143,7 +143,7 @@ pub fn prebuilt_llvm_config(
143143 } ;
144144
145145 let llvm_cmake_dir = out_dir. join ( "lib/cmake/llvm" ) ;
146- let res = LlvmResult { llvm_config : build_llvm_config, llvm_cmake_dir } ;
146+ let res = LlvmResult { host_llvm_config : build_llvm_config, llvm_cmake_dir } ;
147147
148148 static STAMP_HASH_MEMO : OnceLock < String > = OnceLock :: new ( ) ;
149149 let smart_stamp_hash = STAMP_HASH_MEMO . get_or_init ( || {
@@ -488,11 +488,11 @@ impl Step for Llvm {
488488
489489 // https://llvm.org/docs/HowToCrossCompileLLVM.html
490490 if !builder. config . is_host_target ( target) {
491- let LlvmResult { llvm_config , .. } =
491+ let LlvmResult { host_llvm_config , .. } =
492492 builder. ensure ( Llvm { target : builder. config . host_target } ) ;
493493 if !builder. config . dry_run ( ) {
494494 let llvm_bindir =
495- command ( & llvm_config ) . arg ( "--bindir" ) . run_capture_stdout ( builder) . stdout ( ) ;
495+ command ( & host_llvm_config ) . arg ( "--bindir" ) . run_capture_stdout ( builder) . stdout ( ) ;
496496 let host_bin = Path :: new ( llvm_bindir. trim ( ) ) ;
497497 cfg. define (
498498 "LLVM_TABLEGEN" ,
@@ -501,7 +501,7 @@ impl Step for Llvm {
501501 // LLVM_NM is required for cross compiling using MSVC
502502 cfg. define ( "LLVM_NM" , host_bin. join ( "llvm-nm" ) . with_extension ( EXE_EXTENSION ) ) ;
503503 }
504- cfg. define ( "LLVM_CONFIG_PATH" , llvm_config ) ;
504+ cfg. define ( "LLVM_CONFIG_PATH" , host_llvm_config ) ;
505505 if builder. config . llvm_clang {
506506 let build_bin =
507507 builder. llvm_out ( builder. config . host_target ) . join ( "build" ) . join ( "bin" ) ;
@@ -543,7 +543,7 @@ impl Step for Llvm {
543543
544544 // Helper to find the name of LLVM's shared library on darwin and linux.
545545 let find_llvm_lib_name = |extension| {
546- let major = get_llvm_version_major ( builder, & res. llvm_config ) ;
546+ let major = get_llvm_version_major ( builder, & res. host_llvm_config ) ;
547547 match & llvm_version_suffix {
548548 Some ( version_suffix) => format ! ( "libLLVM-{major}{version_suffix}.{extension}" ) ,
549549 None => format ! ( "libLLVM-{major}.{extension}" ) ,
@@ -929,7 +929,7 @@ impl Step for Enzyme {
929929 }
930930 let target = self . target ;
931931
932- let LlvmResult { llvm_config , .. } = builder. ensure ( Llvm { target : self . target } ) ;
932+ let LlvmResult { host_llvm_config , .. } = builder. ensure ( Llvm { target : self . target } ) ;
933933
934934 static STAMP_HASH_MEMO : OnceLock < String > = OnceLock :: new ( ) ;
935935 let smart_stamp_hash = STAMP_HASH_MEMO . get_or_init ( || {
@@ -983,7 +983,7 @@ impl Step for Enzyme {
983983
984984 cfg. out_dir ( & out_dir)
985985 . profile ( profile)
986- . env ( "LLVM_CONFIG_REAL" , & llvm_config )
986+ . env ( "LLVM_CONFIG_REAL" , & host_llvm_config )
987987 . define ( "LLVM_ENABLE_ASSERTIONS" , "ON" )
988988 . define ( "ENZYME_EXTERNAL_SHARED_LIB" , "ON" )
989989 . define ( "LLVM_DIR" , builder. llvm_out ( target) ) ;
@@ -1019,13 +1019,13 @@ impl Step for Lld {
10191019 }
10201020 let target = self . target ;
10211021
1022- let LlvmResult { llvm_config , llvm_cmake_dir } = builder. ensure ( Llvm { target } ) ;
1022+ let LlvmResult { host_llvm_config , llvm_cmake_dir } = builder. ensure ( Llvm { target } ) ;
10231023
10241024 // The `dist` step packages LLD next to LLVM's binaries for download-ci-llvm. The root path
10251025 // we usually expect here is `./build/$triple/ci-llvm/`, with the binaries in its `bin`
10261026 // subfolder. We check if that's the case, and if LLD's binary already exists there next to
10271027 // `llvm-config`: if so, we can use it instead of building LLVM/LLD from source.
1028- let ci_llvm_bin = llvm_config . parent ( ) . unwrap ( ) ;
1028+ let ci_llvm_bin = host_llvm_config . parent ( ) . unwrap ( ) ;
10291029 if ci_llvm_bin. is_dir ( ) && ci_llvm_bin. file_name ( ) . unwrap ( ) == "bin" {
10301030 let lld_path = ci_llvm_bin. join ( exe ( "lld" , target) ) ;
10311031 if lld_path. exists ( ) {
@@ -1108,7 +1108,7 @@ impl Step for Lld {
11081108 // Use the host llvm-tblgen binary.
11091109 cfg. define (
11101110 "LLVM_TABLEGEN_EXE" ,
1111- llvm_config . with_file_name ( "llvm-tblgen" ) . with_extension ( EXE_EXTENSION ) ,
1111+ host_llvm_config . with_file_name ( "llvm-tblgen" ) . with_extension ( EXE_EXTENSION ) ,
11121112 ) ;
11131113 }
11141114
@@ -1149,7 +1149,7 @@ impl Step for Sanitizers {
11491149 return runtimes;
11501150 }
11511151
1152- let LlvmResult { llvm_config , .. } =
1152+ let LlvmResult { host_llvm_config , .. } =
11531153 builder. ensure ( Llvm { target : builder. config . host_target } ) ;
11541154
11551155 static STAMP_HASH_MEMO : OnceLock < String > = OnceLock :: new ( ) ;
@@ -1189,7 +1189,7 @@ impl Step for Sanitizers {
11891189 cfg. define ( "COMPILER_RT_BUILD_XRAY" , "OFF" ) ;
11901190 cfg. define ( "COMPILER_RT_DEFAULT_TARGET_ONLY" , "ON" ) ;
11911191 cfg. define ( "COMPILER_RT_USE_LIBCXX" , "OFF" ) ;
1192- cfg. define ( "LLVM_CONFIG_PATH" , & llvm_config ) ;
1192+ cfg. define ( "LLVM_CONFIG_PATH" , & host_llvm_config ) ;
11931193
11941194 if self . target . contains ( "ohos" ) {
11951195 cfg. define ( "COMPILER_RT_USE_BUILTINS_LIBRARY" , "ON" ) ;
0 commit comments