Skip to content

Commit b9c4b61

Browse files
committed
PassWrapper: disable UseOdrIndicator for Asan Win32
As described here UseOdrIndicator should be disabled on Windows since link.exe does not support duplicate weak definitions (https://reviews.llvm.org/D137227).
1 parent 78bb5ee commit b9c4b61

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -883,10 +883,10 @@ extern "C" LLVMRustResult LLVMRustOptimize(
883883
SanitizerOptions->SanitizeKernelAddress) {
884884
OptimizerLastEPCallbacks.push_back(
885885
#if LLVM_VERSION_GE(20, 0)
886-
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level,
886+
[SanitizerOptions,TM](ModulePassManager &MPM, OptimizationLevel Level,
887887
ThinOrFullLTOPhase phase) {
888888
#else
889-
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
889+
[SanitizerOptions,TM](ModulePassManager &MPM, OptimizationLevel Level) {
890890
#endif
891891
auto CompileKernel = SanitizerOptions->SanitizeKernelAddress;
892892
AddressSanitizerOptions opts = AddressSanitizerOptions{
@@ -896,7 +896,12 @@ extern "C" LLVMRustResult LLVMRustOptimize(
896896
/*UseAfterScope=*/true,
897897
AsanDetectStackUseAfterReturnMode::Runtime,
898898
};
899-
MPM.addPass(AddressSanitizerPass(opts));
899+
MPM.addPass(AddressSanitizerPass(
900+
opts,
901+
/*UseGlobalGC*/true,
902+
// UseOdrIndicator should be false on windows machines
903+
// https://reviews.llvm.org/D137227
904+
!TM->getTargetTriple().isOSWindows()));
900905
});
901906
}
902907
if (SanitizerOptions->SanitizeHWAddress) {

0 commit comments

Comments
 (0)