From ce8b784a741079c5466c1ed43e8443180d3c5ea7 Mon Sep 17 00:00:00 2001 From: helldawg <116204326+helldawg@users.noreply.github.com> Date: Sun, 14 Sep 2025 02:40:54 +0300 Subject: [PATCH] Force lto to 'fat' with autodiff enabled Messes with code I have no business dealing with. --- compiler/rustc_interface/src/interface.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index b52c5b4cd663b..78cec5a58448e 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -482,6 +482,10 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se config.using_internal_features, config.expanded_args, ); + // Forces lto="fat" if autodiff is enabled. + if sess.opts.unstable_opts.autodiff.contains(&config::AutoDiff::Enable) { + sess.opts.cg.lto = config::LtoCli::Fat; + } codegen_backend.init(&sess);