diff options
| author | antoyo <antoyo@users.noreply.github.com> | 2022-01-26 10:22:06 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-26 10:22:06 -0500 |
| commit | b7bfb21242bec640826f33a73e0ad4365ab9a841 (patch) | |
| tree | fc6e9bfa178720283fa27aa8d18d664171d2cf98 | |
| parent | 5dc660b10647823842dfe3d8865b4802c7ab90f9 (diff) | |
| parent | 99941cd9d26c3ef2d53ecdb4f7563367d66ca3c1 (diff) | |
| download | rust-b7bfb21242bec640826f33a73e0ad4365ab9a841.tar.gz rust-b7bfb21242bec640826f33a73e0ad4365ab9a841.zip | |
Merge pull request #118 from bjorn3/function_sections
Support -Zfunction-sections
| -rw-r--r-- | src/base.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/base.rs b/src/base.rs index 8b23e96066e..45e791a99d6 100644 --- a/src/base.rs +++ b/src/base.rs @@ -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); } |
