From b592f29a8e7b1f83958f429ca42947f32ec6898c Mon Sep 17 00:00:00 2001 From: DianQK Date: Wed, 18 Oct 2023 22:29:00 +0800 Subject: [PATCH] Treat extern in compiler-builtins as `used` We have to preserve the symbols of the built-in functions during LTO. --- .../src/back/symbol_export.rs | 10 +- .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 104 +----------------- 2 files changed, 8 insertions(+), 106 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 9cd4394108a..0e436f247b0 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -54,8 +54,8 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap = tcx .reachable_set(()) @@ -107,7 +107,11 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMapGUIDPreservedSymbols.insert(GUID); } - for (int i = 0; i < sizeof(PreservedLibcallSymbols) / sizeof(PreservedLibcallSymbols[0]); i++) { - if (auto *PreservedLibcallSymbol = PreservedLibcallSymbols[i]) { - auto GUID = GlobalValue::getGUID(PreservedLibcallSymbol); - Ret->GUIDPreservedSymbols.insert(GUID); - } - } // Collect the import/export lists for all modules from the call-graph in the // combined index