diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-11-14 18:26:15 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-14 18:26:15 +0800 |
| commit | e3c76c56997f85df15b472d85a240c5e2b60d76a (patch) | |
| tree | 862ae962dc9ca867893aaf63292cc5bb2eabadae /compiler | |
| parent | 475203f0983a2e25db127079903b00e808aaf7a9 (diff) | |
| parent | 61013f040e6e3e91b012791d2b77a9d3e47e390b (diff) | |
| download | rust-e3c76c56997f85df15b472d85a240c5e2b60d76a.tar.gz rust-e3c76c56997f85df15b472d85a240c5e2b60d76a.zip | |
Rollup merge of #132773 - jakos-sec:fix-asan-win32, r=jieyouxu
PassWrapper: disable UseOdrIndicator for Asan Win32 As described in https://reviews.llvm.org/D137227 UseOdrIndicator should be disabled on Windows since link.exe does not support duplicate weak definitions. Fixes https://github.com/rust-lang/rust/issues/124390. Credits also belong to `@1c3t3a` who worked with me on this. We are currently testing this on a Windows machine.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 1ed702ab4cb..489c911d7ee 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -882,10 +882,12 @@ extern "C" LLVMRustResult LLVMRustOptimize( SanitizerOptions->SanitizeKernelAddress) { OptimizerLastEPCallbacks.push_back( #if LLVM_VERSION_GE(20, 0) - [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level, - ThinOrFullLTOPhase phase) { + [SanitizerOptions, TM](ModulePassManager &MPM, + OptimizationLevel Level, + ThinOrFullLTOPhase phase) { #else - [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { + [SanitizerOptions, TM](ModulePassManager &MPM, + OptimizationLevel Level) { #endif auto CompileKernel = SanitizerOptions->SanitizeKernelAddress; AddressSanitizerOptions opts = AddressSanitizerOptions{ @@ -895,7 +897,12 @@ extern "C" LLVMRustResult LLVMRustOptimize( /*UseAfterScope=*/true, AsanDetectStackUseAfterReturnMode::Runtime, }; - MPM.addPass(AddressSanitizerPass(opts)); + MPM.addPass(AddressSanitizerPass( + opts, + /*UseGlobalGC*/ true, + // UseOdrIndicator should be false on windows machines + // https://reviews.llvm.org/D137227 + !TM->getTargetTriple().isOSWindows())); }); } if (SanitizerOptions->SanitizeHWAddress) { |
