Skip to content

Commit 5648a66

Browse files
committed
prevent common llvm.strip-debuginfo config errors
1 parent 388d0eb commit 5648a66

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/bootstrap/config.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,25 @@ impl Config {
15651565
// the link step) with each stage.
15661566
config.llvm_link_shared.set(Some(true));
15671567
}
1568+
1569+
// Stripping LLVM's debuginfo is only accepted when:
1570+
// - using a shared library
1571+
// - not explicitly requesting debuginfo
1572+
if config.llvm_strip_debuginfo {
1573+
if config.llvm_release_debuginfo {
1574+
panic!(
1575+
"enabling `llvm.strip-debuginfo` is incompatible \
1576+
with setting `llvm.release-debuginfo`"
1577+
);
1578+
}
1579+
let llvm_link_shared = config.llvm_link_shared.get().unwrap_or(false);
1580+
if !llvm_link_shared {
1581+
panic!(
1582+
"enabling `llvm.strip-debuginfo` is incompatible \
1583+
with statically linking LLVM"
1584+
);
1585+
}
1586+
}
15681587
} else {
15691588
config.llvm_from_ci =
15701589
config.channel == "dev" && crate::llvm::is_ci_llvm_available(&config, false);

0 commit comments

Comments
 (0)