[llvm-commits] [llvm] r146379 - /llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Kostya Serebryany
kcc at google.com
Mon Dec 12 10:01:47 PST 2011
Author: kcc
Date: Mon Dec 12 12:01:46 2011
New Revision: 146379
URL: http://llvm.org/viewvc/llvm-project?rev=146379&view=rev
Log:
[asan] use .preinit_array only on linux
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=146379&r1=146378&r2=146379&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Mon Dec 12 12:01:46 2011
@@ -567,7 +567,6 @@
// .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 @@
}
appendToGlobalCtors(M, AsanCtorFunction, 1 /*high priority*/);
- appendToPreinitArray(M, AsanInitFunction);
+
+ if (M.getTargetTriple().find("linux") != std::string::npos)
+ appendToPreinitArray(M, AsanInitFunction);
return Res;
}
More information about the llvm-commits
mailing list