Skip to content

Commit ebea2ea

Browse files
committed
Merge branch 'rustbuild-llvm-targets' of https://github.com/xen0n/rust into rollup
2 parents 334af88 + 0f8e931 commit ebea2ea

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub struct Config {
5555
pub llvm_version_check: bool,
5656
pub llvm_static_stdcpp: bool,
5757
pub llvm_link_shared: bool,
58+
pub llvm_targets: Option<String>,
5859

5960
// rust codegen options
6061
pub rust_optimize: bool,
@@ -154,6 +155,7 @@ struct Llvm {
154155
release_debuginfo: Option<bool>,
155156
version_check: Option<bool>,
156157
static_libstdcpp: Option<bool>,
158+
targets: Option<String>,
157159
}
158160

159161
#[derive(RustcDecodable)]
@@ -288,6 +290,7 @@ impl Config {
288290
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
289291
set(&mut config.llvm_version_check, llvm.version_check);
290292
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
293+
config.llvm_targets = llvm.targets.clone();
291294
}
292295

293296
if let Some(ref rust) = toml.rust {

src/bootstrap/config.toml.example

+11
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@
4242
# example.
4343
#ninja = false
4444

45+
# LLVM targets to build support for.
46+
# Note: this is NOT related to Rust compilation targets. However, as Rust is
47+
# dependent on LLVM for code generation, turning targets off here WILL lead to
48+
# the resulting rustc being unable to compile for the disabled architectures.
49+
# Also worth pointing out is that, in case support for new targets are added to
50+
# LLVM, enabling them here doesn't mean Rust is automatically gaining said
51+
# support. You'll need to write a target specification at least, and most
52+
# likely, teach rustc about the C ABI of the target. Get in touch with the
53+
# Rust team and file an issue if you need assistance in porting!
54+
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc"
55+
4556
# =============================================================================
4657
# General build configuration options
4758
# =============================================================================

src/bootstrap/native.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,18 @@ pub fn llvm(build: &Build, target: &str) {
7575
(true, true) => "RelWithDebInfo",
7676
};
7777

78+
// NOTE: remember to also update `config.toml.example` when changing the defaults!
79+
let llvm_targets = match build.config.llvm_targets {
80+
Some(ref s) => s,
81+
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX",
82+
};
83+
7884
cfg.target(target)
7985
.host(&build.config.build)
8086
.out_dir(&dst)
8187
.profile(profile)
8288
.define("LLVM_ENABLE_ASSERTIONS", assertions)
83-
.define("LLVM_TARGETS_TO_BUILD",
84-
"X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX")
89+
.define("LLVM_TARGETS_TO_BUILD", llvm_targets)
8590
.define("LLVM_INCLUDE_EXAMPLES", "OFF")
8691
.define("LLVM_INCLUDE_TESTS", "OFF")
8792
.define("LLVM_INCLUDE_DOCS", "OFF")

0 commit comments

Comments
 (0)