From fc210a8994174d48965453fa6cbeafc8902bd399 Mon Sep 17 00:00:00 2001 From: Cameron Hart Date: Fri, 29 Jul 2016 23:09:32 +1000 Subject: [PATCH] Make rust build pass LLVM_RUSTLLVM to C++ compiler --- src/bootstrap/compile.rs | 4 ++++ src/librustc_llvm/build.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 8ec9c7f0109f..31915b116919 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 a2c808cbcb6b..96b419d647ee 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")