From dc20c8cc25a6d1bc9baaa4cc3a879a9c0f9f6657 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Wed, 30 Jan 2019 13:27:12 +0100 Subject: [PATCH] bootstrap: Expose LLVM_USE_LINKER cmake option to config.toml. --- config.toml.example | 4 ++++ src/bootstrap/config.rs | 3 +++ src/bootstrap/native.rs | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/config.toml.example b/config.toml.example index 23943d34b7c..548aa691633 100644 --- a/config.toml.example +++ b/config.toml.example @@ -96,6 +96,10 @@ # that your host compiler ships with libc++. #use-libcxx = true +# The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake. +#use-linker = "lld" + + # ============================================================================= # General build configuration options # ============================================================================= diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 9421817ae6d..2871db2c9a2 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -77,6 +77,7 @@ pub struct Config { pub llvm_experimental_targets: String, pub llvm_link_jobs: Option, pub llvm_version_suffix: Option, + pub llvm_use_linker: Option, pub lld_enabled: bool, pub lldb_enabled: bool, @@ -255,6 +256,7 @@ struct Llvm { version_suffix: Option, clang_cl: Option, use_libcxx: Option, + use_linker: Option, } #[derive(Deserialize, Default, Clone)] @@ -517,6 +519,7 @@ pub fn parse(args: &[String]) -> Config { config.llvm_version_suffix = llvm.version_suffix.clone(); config.llvm_clang_cl = llvm.clang_cl.clone(); set(&mut config.llvm_use_libcxx, llvm.use_libcxx); + config.llvm_use_linker = llvm.use_linker.clone(); } if let Some(ref rust) = toml.rust { diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index cb9c86df550..e4325179f63 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -231,6 +231,10 @@ fn run(self, builder: &Builder) -> PathBuf { cfg.define("LLVM_VERSION_SUFFIX", suffix); } + if let Some(ref linker) = builder.config.llvm_use_linker { + cfg.define("LLVM_USE_LINKER", linker); + } + if let Some(ref python) = builder.config.python { cfg.define("PYTHON_EXECUTABLE", python); }