Skip to content

Commit

Permalink
Merge pull request rust-lang#118 from bjorn3/function_sections
Browse files Browse the repository at this point in the history
Support -Zfunction-sections
  • Loading branch information
antoyo authored Jan 26, 2022
2 parents 5dc660b + 99941cd commit b7bfb21
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> (Modul
context.add_command_line_option("-fno-semantic-interposition");
// NOTE: Rust relies on LLVM not doing TBAA (https://github.com/rust-lang/unsafe-code-guidelines/issues/292).
context.add_command_line_option("-fno-strict-aliasing");

if tcx.sess.opts.debugging_opts.function_sections.unwrap_or(tcx.sess.target.function_sections) {
context.add_command_line_option("-ffunction-sections");
context.add_command_line_option("-fdata-sections");
}

if env::var("CG_GCCJIT_DUMP_CODE").as_deref() == Ok("1") {
context.set_dump_code_on_compile(true);
}
Expand Down

0 comments on commit b7bfb21

Please sign in to comment.