about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2020-10-31 10:13:35 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2020-10-31 10:13:35 +0100
commitc067be07c12d107bf85cc6045f50c19dc79f2e3c (patch)
treec8afbaaca8e5300539f16285242faab219576647 /src
parent114be422efbabf6632491cda8a7b3a74249374a9 (diff)
downloadrust-c067be07c12d107bf85cc6045f50c19dc79f2e3c.tar.gz
rust-c067be07c12d107bf85cc6045f50c19dc79f2e3c.zip
Implement -Zfunction-sections
Diffstat (limited to 'src')
-rw-r--r--src/backend.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend.rs b/src/backend.rs
index aac37b376dc..9e32259716f 100644
--- a/src/backend.rs
+++ b/src/backend.rs
@@ -198,8 +198,9 @@ pub(crate) fn make_module(sess: &Session, name: String) -> ObjectModule {
         cranelift_module::default_libcall_names(),
     )
     .unwrap();
-    if std::env::var("CG_CLIF_FUNCTION_SECTIONS").is_ok() {
-        builder.per_function_section(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.debugging_opts.function_sections.unwrap_or(false));
     ObjectModule::new(builder)
 }