Skip to content

Commit 1d815e5

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 1d815e5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -883,10 +883,12 @@ extern "C" LLVMRustResult LLVMRustOptimize(
883883
SanitizerOptions->SanitizeKernelAddress) {
884884
OptimizerLastEPCallbacks.push_back(
885885
#if LLVM_VERSION_GE(20, 0)
886-
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level,
887-
ThinOrFullLTOPhase phase) {
886+
[SanitizerOptions, TM](ModulePassManager &MPM,
887+
OptimizationLevel Level,
888+
ThinOrFullLTOPhase phase) {
888889
#else
889-
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
890+
[SanitizerOptions, TM](ModulePassManager &MPM,
891+
OptimizationLevel Level) {
890892
#endif
891893
auto CompileKernel = SanitizerOptions->SanitizeKernelAddress;
892894
AddressSanitizerOptions opts = AddressSanitizerOptions{
@@ -896,7 +898,12 @@ extern "C" LLVMRustResult LLVMRustOptimize(
896898
/*UseAfterScope=*/true,
897899
AsanDetectStackUseAfterReturnMode::Runtime,
898900
};
899-
MPM.addPass(AddressSanitizerPass(opts));
901+
MPM.addPass(AddressSanitizerPass(
902+
opts,
903+
/*UseGlobalGC*/ true,
904+
// UseOdrIndicator should be false on windows machines
905+
// https://reviews.llvm.org/D137227
906+
!TM->getTargetTriple().isOSWindows()));
900907
});
901908
}
902909
if (SanitizerOptions->SanitizeHWAddress) {

0 commit comments

Comments
 (0)