Skip to content

Commit

Permalink
Use -ffunction-sections by default again
Browse files Browse the repository at this point in the history
Cranelift now uses the same section name for all subsections which
reduces the size overhead of -ffunction-sections.
  • Loading branch information
bjorn3 committed Dec 28, 2024
1 parent 7f98f34 commit 4cc1c90
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,9 @@ fn make_module(sess: &Session, name: String) -> UnwindModule<ObjectModule> {

let mut builder =
ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();
// Unlike cg_llvm, cg_clif defaults to disabling -Zfunction-sections. For cg_llvm binary size
// is important, while cg_clif cares more about compilation times. Enabling -Zfunction-sections
// can easily double the amount of time necessary to perform linking.
builder.per_function_section(sess.opts.unstable_opts.function_sections.unwrap_or(false));
builder.per_function_section(
sess.opts.unstable_opts.function_sections.unwrap_or(sess.target.function_sections),
);
UnwindModule::new(ObjectModule::new(builder), true)
}

Expand Down

0 comments on commit 4cc1c90

Please sign in to comment.