Skip to content

Commit

Permalink
Switch to -ffunction-sections by default
Browse files Browse the repository at this point in the history
With lld the perf difference is within noise while producing slightly
(or in exceptional cases significantly) smaller binaries.
  • Loading branch information
bjorn3 committed Dec 5, 2024
1 parent a767a10 commit 65c5c7f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,7 @@ 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(true));
UnwindModule::new(ObjectModule::new(builder), true)
}

Expand Down

0 comments on commit 65c5c7f

Please sign in to comment.