Add flag for telling the linker to strip debuginfo when building without it
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
parent
b4aa80dd73
commit
2f0dd4a8f0
@ -1292,6 +1292,8 @@ fn parse_edition(slot: &mut Edition, v: Option<&str>) -> bool {
|
||||
"format compiler diagnostics in a way that's better suitable for UI testing"),
|
||||
embed_bitcode: bool = (false, parse_bool, [TRACKED],
|
||||
"embed LLVM bitcode in object files"),
|
||||
strip_debuginfo_if_disabled: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"tell the linker to strip debuginfo when building without debuginfo enabled."),
|
||||
}
|
||||
|
||||
pub fn default_lib_output() -> CrateType {
|
||||
|
@ -281,7 +281,18 @@ fn optimize(&mut self) {
|
||||
}
|
||||
|
||||
fn debuginfo(&mut self) {
|
||||
// Don't do anything special here for GNU-style linkers.
|
||||
match self.sess.opts.debuginfo {
|
||||
DebugInfoLevel::NoDebugInfo => {
|
||||
// If we are building without debuginfo enabled and we were called with
|
||||
// `-Zstrip-debuginfo-if-disabled=yes`, tell the linker to strip any debuginfo
|
||||
// found when linking to get rid of symbols from libstd.
|
||||
match self.sess.opts.debugging_opts.strip_debuginfo_if_disabled {
|
||||
Some(true) => { self.linker_arg("-S"); },
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
};
|
||||
}
|
||||
|
||||
fn no_default_libraries(&mut self) {
|
||||
|
Loading…
Reference in New Issue
Block a user