From 964d3af793eeebbe4aa1289ffdffeca6e3d56664 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:58:55 +0000 Subject: [PATCH] Move a special case for rust_eh_personality from reachable_non_generics to cg_llvm This is a workaround for an LLVM bug, so put it in cg_llvm. --- compiler/rustc_codegen_llvm/src/back/lto.rs | 3 +++ compiler/rustc_codegen_ssa/src/back/symbol_export.rs | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 5ac3a87c158e..02b50fa8a697 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -77,6 +77,9 @@ fn prepare_lto( // should have default visibility. symbols_below_threshold.push(c"__llvm_profile_counter_bias".to_owned()); + // LTO seems to discard this otherwise under certain circumstances. + symbols_below_threshold.push(c"rust_eh_personality".to_owned()); + // If we're performing LTO for the entire crate graph, then for each of our // upstream dependencies, find the corresponding rlib and load the bitcode // from the archive. diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 5bc18e2d7f8b..8a1f20826a94 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -104,10 +104,6 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap, _: LocalCrate) -> DefIdMap