Skip to content

Commit 91c7dd0

Browse files
committed
Set CLANG_TABLEGEN when cross compiling clang
When cross compiling rustc with `llvm.clang = true`, CLANG_TABLEGEN has to be set to the host clang-tblgen executable to build clang.
1 parent fb00d51 commit 91c7dd0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bootstrap/native.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,18 @@ impl Step for Llvm {
417417
// actually exists most of the time in normal installs of LLVM.
418418
let host_bin = builder.llvm_out(builder.config.build).join("bin");
419419
cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION));
420-
cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION));
421420
cfg.define(
422421
"LLVM_CONFIG_PATH",
423422
host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
424423
);
424+
if builder.config.llvm_clang {
425+
let build_bin = builder.llvm_out(builder.config.build).join("build").join("bin");
426+
let clang_tblgen = build_bin.join("clang-tblgen").with_extension(EXE_EXTENSION);
427+
if !clang_tblgen.exists() {
428+
panic!("unable to find {}", clang_tblgen.display());
429+
}
430+
cfg.define("CLANG_TABLEGEN", clang_tblgen);
431+
}
425432
}
426433

427434
if let Some(ref suffix) = builder.config.llvm_version_suffix {

0 commit comments

Comments
 (0)