From 3865699325e945f3e1212c01e4b35444f28f2125 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 13 Jun 2017 11:17:45 -0700 Subject: [PATCH] Add config option for experimental LLVM targets NVPTX and Hexagon LLVM targets are no longer built by default. Instead, the developer has to opt in to building them by listing them in the new experimental-targets option. --- src/bootstrap/config.rs | 3 +++ src/bootstrap/config.toml.example | 7 ++++++- src/bootstrap/native.rs | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index abad216d89be4..edbd61d8eb21e 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -59,6 +59,7 @@ pub struct Config { pub llvm_static_stdcpp: bool, pub llvm_link_shared: bool, pub llvm_targets: Option, + pub llvm_experimental_targets: Option, pub llvm_link_jobs: Option, pub llvm_clean_rebuild: bool, @@ -187,6 +188,7 @@ struct Llvm { version_check: Option, static_libstdcpp: Option, targets: Option, + experimental_targets: Option, link_jobs: Option, clean_rebuild: Option, } @@ -347,6 +349,7 @@ impl Config { set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp); set(&mut config.llvm_clean_rebuild, llvm.clean_rebuild); config.llvm_targets = llvm.targets.clone(); + config.llvm_experimental_targets = llvm.experimental_targets.clone(); config.llvm_link_jobs = llvm.link_jobs; } diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example index 0eb6c4c82c4dd..536c5129b3986 100644 --- a/src/bootstrap/config.toml.example +++ b/src/bootstrap/config.toml.example @@ -51,7 +51,12 @@ # support. You'll need to write a target specification at least, and most # likely, teach rustc about the C ABI of the target. Get in touch with the # Rust team and file an issue if you need assistance in porting! -#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon" +#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc" + +# Experimental LLVM targets to build supoort for. These are specified in the +# same format as the normal targets, but are different in that they need be +# opted into. The available targets are NVPTX and Hexagon. +#experimental-targets = "" # Cap the number of parallel linker invocations when compiling LLVM. # This can be useful when building LLVM with debug info, which significantly diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 6b9a6347d2272..0c28308136f5b 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -83,7 +83,12 @@ pub fn llvm(build: &Build, target: &str) { // NOTE: remember to also update `config.toml.example` when changing the defaults! let llvm_targets = match build.config.llvm_targets { Some(ref s) => s, - None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon", + None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc", + }; + + let llvm_exp_targets = match build.config.llvm_experimental_targets { + Some(ref s) => s, + None => "", }; let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"}; @@ -94,6 +99,7 @@ pub fn llvm(build: &Build, target: &str) { .profile(profile) .define("LLVM_ENABLE_ASSERTIONS", assertions) .define("LLVM_TARGETS_TO_BUILD", llvm_targets) + .define("LLVM_EXPERIMENTAL_TARGETS_TO_BUILD", llvm_exp_targets) .define("LLVM_INCLUDE_EXAMPLES", "OFF") .define("LLVM_INCLUDE_TESTS", "OFF") .define("LLVM_INCLUDE_DOCS", "OFF")