Skip to content

Commit b7bfb21

Browse files
authored
Merge pull request rust-lang#118 from bjorn3/function_sections
Support -Zfunction-sections
2 parents 5dc660b + 99941cd commit b7bfb21

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/base.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> (Modul
8585
context.add_command_line_option("-fno-semantic-interposition");
8686
// NOTE: Rust relies on LLVM not doing TBAA (https://github.com/rust-lang/unsafe-code-guidelines/issues/292).
8787
context.add_command_line_option("-fno-strict-aliasing");
88+
89+
if tcx.sess.opts.debugging_opts.function_sections.unwrap_or(tcx.sess.target.function_sections) {
90+
context.add_command_line_option("-ffunction-sections");
91+
context.add_command_line_option("-fdata-sections");
92+
}
93+
8894
if env::var("CG_GCCJIT_DUMP_CODE").as_deref() == Ok("1") {
8995
context.set_dump_code_on_compile(true);
9096
}

0 commit comments

Comments
 (0)