diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 8ec9c7f0109f3..31915b1169198 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -199,6 +199,10 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) { if !build.unstable_features { cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1"); } + // Flag that rust llvm is in use + if build.config.target_config.get(target).is_none() { + cargo.env("LLVM_RUSTLLVM", "1"); + } cargo.env("LLVM_CONFIG", build.llvm_config(target)); if build.config.llvm_static_stdcpp { cargo.env("LLVM_STATIC_STDCPP", diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index a2c808cbcb6b6..96b419d647ee3 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -112,6 +112,10 @@ fn main() { cfg.flag(&flag); } + if env::var_os("LLVM_RUSTLLVM").is_some() { + cfg.flag("-DLLVM_RUSTLLVM"); + } + cfg.file("../rustllvm/ExecutionEngineWrapper.cpp") .file("../rustllvm/PassWrapper.cpp") .file("../rustllvm/RustWrapper.cpp")