aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorChris Apple <cja-private@pm.me>2024-12-06 11:29:11 -0800
committerGitHub <noreply@github.com>2024-12-06 11:29:11 -0800
commitca3180ad6e39304177deac112bd78739d85fe32b (patch)
tree569ab65ba3f944ee4ff8793097de90f4618b0980 /clang/lib/CodeGen/BackendUtil.cpp
parent3c83054bec3326ccf338eeda56e67e8cd83a3b2a (diff)
downloadllvm-ca3180ad6e39304177deac112bd78739d85fe32b.zip
llvm-ca3180ad6e39304177deac112bd78739d85fe32b.tar.gz
llvm-ca3180ad6e39304177deac112bd78739d85fe32b.tar.bz2
[LLVM][rtsan] Add module pass to initialize rtsan (#118989)
This allows shared libraries instrumented with RTSan to be initialized. This approach directly mirrors the approach in Tsan, Asan and many of the other sanitizers
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index bf9b04f..fbb3fb6 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1024,12 +1024,14 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
FPM.addPass(BoundsCheckingPass());
});
- if (LangOpts.Sanitize.has(SanitizerKind::Realtime))
+ if (LangOpts.Sanitize.has(SanitizerKind::Realtime)) {
PB.registerScalarOptimizerLateEPCallback(
[](FunctionPassManager &FPM, OptimizationLevel Level) {
RealtimeSanitizerOptions Opts;
FPM.addPass(RealtimeSanitizerPass(Opts));
});
+ MPM.addPass(ModuleRealtimeSanitizerPass());
+ }
// Don't add sanitizers if we are here from ThinLTO PostLink. That already
// done on PreLink stage.