Skip to content

Commit 0254f12

Browse files
committed
rustbuild: support RelWithDebInfo for llvm
1 parent 187d989 commit 0254f12

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/bootstrap/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub struct Config {
5050
// llvm codegen options
5151
pub llvm_assertions: bool,
5252
pub llvm_optimize: bool,
53+
pub llvm_release_debuginfo: bool,
5354
pub llvm_version_check: bool,
5455
pub llvm_static_stdcpp: bool,
5556

@@ -137,6 +138,7 @@ struct Llvm {
137138
ninja: Option<bool>,
138139
assertions: Option<bool>,
139140
optimize: Option<bool>,
141+
release_debuginfo: Option<bool>,
140142
version_check: Option<bool>,
141143
static_libstdcpp: Option<bool>,
142144
}
@@ -243,6 +245,7 @@ impl Config {
243245
set(&mut config.ninja, llvm.ninja);
244246
set(&mut config.llvm_assertions, llvm.assertions);
245247
set(&mut config.llvm_optimize, llvm.optimize);
248+
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
246249
set(&mut config.llvm_version_check, llvm.version_check);
247250
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
248251
}

src/bootstrap/config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# Indicates whether the LLVM build is a Release or Debug build
1818
#optimize = true
1919

20+
# Indicates whether an LLVM Release build should include debug info
21+
#release-debuginfo = false
22+
2023
# Indicates whether the LLVM assertions are enabled or not
2124
#assertions = false
2225

src/bootstrap/native.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,17 @@ pub fn llvm(build: &Build, target: &str) {
6767
if build.config.ninja {
6868
cfg.generator("Ninja");
6969
}
70+
71+
let profile = match (build.config.llvm_optimize, build.config.llvm_release_debuginfo) {
72+
(false, _) => "Debug",
73+
(true, false) => "Release",
74+
(true, true) => "RelWithDebInfo",
75+
};
76+
7077
cfg.target(target)
7178
.host(&build.config.build)
7279
.out_dir(&dst)
73-
.profile(if build.config.llvm_optimize {"Release"} else {"Debug"})
80+
.profile(profile)
7481
.define("LLVM_ENABLE_ASSERTIONS", assertions)
7582
.define("LLVM_TARGETS_TO_BUILD", "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend")
7683
.define("LLVM_INCLUDE_EXAMPLES", "OFF")

0 commit comments

Comments
 (0)