Skip to content

Commit 02e8839

Browse files
authored
Rollup merge of #94621 - ridwanabdillahi:lld-rel-dbg, r=Mark-Simulacrum
rustbuild: support RelWithDebInfo for lld r? ``@alexcrichton`` LLVM has flags that control the level of debuginfo generated when building via rustbuild. Since LLD is built separately, it currently has no way of generating any debuginfo. This change re-uses the same flags as LLVM for LLD to ensure it has the same level of debuginfo generated as LLVM.
2 parents d85e4b1 + 6a50572 commit 02e8839

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bootstrap/native.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,16 @@ impl Step for Lld {
650650
// there's probably a lot of reasons you can't do that other than this.
651651
let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper");
652652

653+
// Re-use the same flags as llvm to control the level of debug information
654+
// generated for lld.
655+
let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
656+
(false, _) => "Debug",
657+
(true, false) => "Release",
658+
(true, true) => "RelWithDebInfo",
659+
};
660+
653661
cfg.out_dir(&out_dir)
654-
.profile("Release")
662+
.profile(profile)
655663
.env("LLVM_CONFIG_REAL", &llvm_config)
656664
.define("LLVM_CONFIG_PATH", llvm_config_shim)
657665
.define("LLVM_INCLUDE_TESTS", "OFF");

0 commit comments

Comments
 (0)