Skip to content

Commit 23e72ab

Browse files
committed
Move ___asan_globals_registered export
All other sanitizer symbols are handled in prepare_lto already.
1 parent d76cff3 commit 23e72ab

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ fn prepare_lto(
7070
symbols_below_threshold.extend(msan_weak_symbols.into_iter().map(|sym| sym.to_owned()));
7171
}
7272

73+
// Preserve LLVM-injected, ASAN-related symbols.
74+
// See also https://github.com/rust-lang/rust/issues/113404.
75+
symbols_below_threshold.push(c"___asan_globals_registered".to_owned());
76+
7377
// __llvm_profile_counter_bias is pulled in at link time by an undefined reference to
7478
// __llvm_profile_runtime, therefore we won't know until link time if this symbol
7579
// should have default visibility.

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,12 +1226,6 @@ extern "C" void LLVMRustPrintPasses() {
12261226
extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols,
12271227
size_t Len) {
12281228
auto PreserveFunctions = [=](const GlobalValue &GV) {
1229-
// Preserve LLVM-injected, ASAN-related symbols.
1230-
// See also https://github.com/rust-lang/rust/issues/113404.
1231-
if (GV.getName() == "___asan_globals_registered") {
1232-
return true;
1233-
}
1234-
12351229
// Preserve symbols exported from Rust modules.
12361230
for (size_t I = 0; I < Len; I++) {
12371231
if (GV.getName() == Symbols[I]) {

0 commit comments

Comments
 (0)