Skip to content

Commit

Permalink
Rollup merge of rust-lang#52887 - yurydelendik:disable-lld-symbols, r…
Browse files Browse the repository at this point in the history
…=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.
  • Loading branch information
cramertj authored Aug 2, 2018
2 parents ec58d48 + e9509d7 commit 542f99c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/librustc_codegen_llvm/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,18 @@ impl<'a> Linker for WasmLd<'a> {
OptLevel::Size => "-O2",
OptLevel::SizeMin => "-O2"
});
match self.sess.opts.optimize {
OptLevel::No => (),
OptLevel::Less |
OptLevel::Default |
OptLevel::Aggressive |
OptLevel::Size |
OptLevel::SizeMin => {
// LLD generates incorrect debugging information when
// optimization is applied: strip debug sections.
self.cmd.arg("--strip-debug");
}
}
}

fn pgo_gen(&mut self) {
Expand Down

0 comments on commit 542f99c

Please sign in to comment.