From 65c5c7f8cf366868b47483c94e41440143c73eae Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:03:58 +0000 Subject: [PATCH] Switch to -ffunction-sections by default With lld the perf difference is within noise while producing slightly (or in exceptional cases significantly) smaller binaries. --- src/driver/aot.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/driver/aot.rs b/src/driver/aot.rs index e046d0fe..b2a1d999 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -333,10 +333,7 @@ fn make_module(sess: &Session, name: String) -> UnwindModule { 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) }