diff options
author | Kostya Serebryany <kcc@google.com> | 2012-03-19 16:40:35 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-03-19 16:40:35 +0000 |
commit | 8c0134a77615b66f57250f0662bc899e4574551e (patch) | |
tree | 06a9431608dfda89ed7632000f12eb693fa1774f /lib/Transforms/Instrumentation | |
parent | 5587a8e0946aa6dee999c5bc1d352204cb214293 (diff) | |
download | external_llvm-8c0134a77615b66f57250f0662bc899e4574551e.zip external_llvm-8c0134a77615b66f57250f0662bc899e4574551e.tar.gz external_llvm-8c0134a77615b66f57250f0662bc899e4574551e.tar.bz2 |
[asan] don't emit __asan_mapping_offset/__asan_mapping_scale by default -- they are currently used only for experiments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r-- | lib/Transforms/Instrumentation/AddressSanitizer.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 544e22c..a51bd7e 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -579,18 +579,23 @@ bool AddressSanitizer::runOnModule(Module &M) { if (ClGlobals) Res |= insertGlobalRedzones(M); - // Tell the run-time the current values of mapping offset and scale. - GlobalValue *asan_mapping_offset = - new GlobalVariable(M, IntptrTy, true, GlobalValue::LinkOnceODRLinkage, - ConstantInt::get(IntptrTy, MappingOffset), - kAsanMappingOffsetName); - GlobalValue *asan_mapping_scale = - new GlobalVariable(M, IntptrTy, true, GlobalValue::LinkOnceODRLinkage, - ConstantInt::get(IntptrTy, MappingScale), - kAsanMappingScaleName); - // Read these globals, otherwise they may be optimized away. - IRB.CreateLoad(asan_mapping_scale, true); - IRB.CreateLoad(asan_mapping_offset, true); + if (ClMappingOffsetLog >= 0) { + // Tell the run-time the current values of mapping offset and scale. + GlobalValue *asan_mapping_offset = + new GlobalVariable(M, IntptrTy, true, GlobalValue::LinkOnceODRLinkage, + ConstantInt::get(IntptrTy, MappingOffset), + kAsanMappingOffsetName); + // Read the global, otherwise it may be optimized away. + IRB.CreateLoad(asan_mapping_offset, true); + } + if (ClMappingScale) { + GlobalValue *asan_mapping_scale = + new GlobalVariable(M, IntptrTy, true, GlobalValue::LinkOnceODRLinkage, + ConstantInt::get(IntptrTy, MappingScale), + kAsanMappingScaleName); + // Read the global, otherwise it may be optimized away. + IRB.CreateLoad(asan_mapping_scale, true); + } for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |