diff options
author | Kostya Serebryany <kcc@google.com> | 2014-04-21 07:10:43 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-04-21 07:10:43 +0000 |
commit | 215fc7d9988bda6ae21370def427aaa81349a34a (patch) | |
tree | 7e4608db08078d633b1ff33efec92432b5edab54 /lib | |
parent | 7d5100d14edd6d1595cc60ce5f89b64bfc564ef4 (diff) | |
download | llvm-215fc7d9988bda6ae21370def427aaa81349a34a.tar.gz llvm-215fc7d9988bda6ae21370def427aaa81349a34a.tar.bz2 llvm-215fc7d9988bda6ae21370def427aaa81349a34a.tar.xz |
[asan] insert __asan_loadN/__asan_storeN as out-lined asan checks, llvm part
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Instrumentation/AddressSanitizer.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 680c0ed9de..efb16d4b96 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -365,7 +365,8 @@ struct AddressSanitizer : public FunctionPass { Function *AsanErrorCallback[2][kNumberOfAccessSizes]; Function *AsanMemoryAccessCallback[2][kNumberOfAccessSizes]; // This array is indexed by AccessIsWrite. - Function *AsanErrorCallbackSized[2]; + Function *AsanErrorCallbackSized[2], + *AsanMemoryAccessCallbackSized[2]; InlineAsm *EmptyAsm; SetOfDynamicallyInitializedGlobals DynamicallyInitializedGlobals; @@ -824,8 +825,12 @@ void AddressSanitizer::instrumentAddress(Instruction *OrigIns, size_t AccessSizeIndex = TypeSizeToSizeIndex(TypeSize); if (UseCalls) { - IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][AccessSizeIndex], - AddrLong); + if (SizeArgument) + IRB.CreateCall2(AsanMemoryAccessCallbackSized[IsWrite], AddrLong, + SizeArgument); + else + IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][AccessSizeIndex], + AddrLong); return; } @@ -1149,6 +1154,13 @@ void AddressSanitizer::initializeCallbacks(Module &M) { AsanErrorCallbackSized[1] = checkInterfaceFunction(M.getOrInsertFunction( kAsanReportStoreN, IRB.getVoidTy(), IntptrTy, IntptrTy, NULL)); + AsanMemoryAccessCallbackSized[0] = checkInterfaceFunction( + M.getOrInsertFunction(ClMemoryAccessCallbackPrefix + "loadN", + IRB.getVoidTy(), IntptrTy, IntptrTy, NULL)); + AsanMemoryAccessCallbackSized[1] = checkInterfaceFunction( + M.getOrInsertFunction(ClMemoryAccessCallbackPrefix + "storeN", + IRB.getVoidTy(), IntptrTy, IntptrTy, NULL)); + AsanHandleNoReturnFunc = checkInterfaceFunction(M.getOrInsertFunction( kAsanHandleNoReturnName, IRB.getVoidTy(), NULL)); AsanCovFunction = checkInterfaceFunction(M.getOrInsertFunction( |