From 0974099e30bc2a30f75c41d53b3d5eba2945bea6 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:42:17 +0000 Subject: [PATCH] Revert "Switch to -ffunction-sections by default" This reverts commit 65c5c7f8cf366868b47483c94e41440143c73eae. It unfortunately regresses the size of the target dir by a non-trivial amount. It could be re-enabled again once each subsection doesn't get a unique name anymore. --- src/driver/aot.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 89c5c7e19fb..5bbcfc2cda7 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -333,7 +333,10 @@ fn make_module(sess: &Session, name: String) -> UnwindModule { let mut builder = ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap(); - builder.per_function_section(sess.opts.unstable_opts.function_sections.unwrap_or(true)); + // 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)); UnwindModule::new(ObjectModule::new(builder), true) }