Skip to content

Commit e9509d7

Browse files
committed
Disable debug sections when optimization flags is set for LLD.
1 parent 54628c8 commit e9509d7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/librustc_codegen_llvm/back/linker.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,18 @@ impl<'a> Linker for WasmLd<'a> {
10061006
OptLevel::Size => "-O2",
10071007
OptLevel::SizeMin => "-O2"
10081008
});
1009+
match self.sess.opts.optimize {
1010+
OptLevel::No => (),
1011+
OptLevel::Less |
1012+
OptLevel::Default |
1013+
OptLevel::Aggressive |
1014+
OptLevel::Size |
1015+
OptLevel::SizeMin => {
1016+
// LLD generates incorrect debugging information when
1017+
// optimization is applied: strip debug sections.
1018+
self.cmd.arg("--strip-debug");
1019+
}
1020+
}
10091021
}
10101022

10111023
fn pgo_gen(&mut self) {

0 commit comments

Comments
 (0)