Skip to content

Commit 88e0ff1

Browse files
committed
Auto merge of #52887 - yurydelendik:disable-lld-symbols, r=alexcrichton
Disable debug sections when optimization flags is set for LLD. Currently LLD does not error when optimization is set and debugging information sections are present. (See discussion at https://reviews.llvm.org/D47901) Using `--strip-debug` along with the `-O` option.
2 parents e415b5e + e9509d7 commit 88e0ff1

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)