summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2011-12-12 18:01:46 +0000
committerKostya Serebryany <kcc@google.com>2011-12-12 18:01:46 +0000
commitacb42b59194b50b557d9f3203b878af0f9ff510e (patch)
tree437adb25436902bc7c3f9e82c6ebed0a7af7f8a4 /llvm/lib
parent531042840d376087b01475ec1a61d26329c471a7 (diff)
downloadbcm5719-llvm-acb42b59194b50b557d9f3203b878af0f9ff510e.tar.gz
bcm5719-llvm-acb42b59194b50b557d9f3203b878af0f9ff510e.zip
[asan] use .preinit_array only on linux
llvm-svn: 146379
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index fdea1b59466..f16bdf530c5 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -567,7 +567,6 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) {
// .preinit_array is something that hapens before all other inits.
// On systems where .preinit_array is honored, we will call __asan_init early.
-// On other systems this will make no effect.
void AddressSanitizer::appendToPreinitArray(Module &M, Function *F) {
IRBuilder<> IRB(M.getContext());
GlobalVariable *Var =
@@ -647,7 +646,9 @@ bool AddressSanitizer::runOnModule(Module &M) {
}
appendToGlobalCtors(M, AsanCtorFunction, 1 /*high priority*/);
- appendToPreinitArray(M, AsanInitFunction);
+
+ if (M.getTargetTriple().find("linux") != std::string::npos)
+ appendToPreinitArray(M, AsanInitFunction);
return Res;
}
OpenPOWER on IntegriCloud