llvm.org GIT mirror llvm / 215fc7d
[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 Kostya Serebryany 6 years ago
1 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
364364 Function *AsanErrorCallback[2][kNumberOfAccessSizes];
365365 Function *AsanMemoryAccessCallback[2][kNumberOfAccessSizes];
366366 // This array is indexed by AccessIsWrite.
367 Function *AsanErrorCallbackSized[2];
367 Function *AsanErrorCallbackSized[2],
368 *AsanMemoryAccessCallbackSized[2];
368369 InlineAsm *EmptyAsm;
369370 SetOfDynamicallyInitializedGlobals DynamicallyInitializedGlobals;
370371
823824 size_t AccessSizeIndex = TypeSizeToSizeIndex(TypeSize);
824825
825826 if (UseCalls) {
826 IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][AccessSizeIndex],
827 AddrLong);
827 if (SizeArgument)
828 IRB.CreateCall2(AsanMemoryAccessCallbackSized[IsWrite], AddrLong,
829 SizeArgument);
830 else
831 IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][AccessSizeIndex],
832 AddrLong);
828833 return;
829834 }
830835
11471152 kAsanReportLoadN, IRB.getVoidTy(), IntptrTy, IntptrTy, NULL));
11481153 AsanErrorCallbackSized[1] = checkInterfaceFunction(M.getOrInsertFunction(
11491154 kAsanReportStoreN, IRB.getVoidTy(), IntptrTy, IntptrTy, NULL));
1155
1156 AsanMemoryAccessCallbackSized[0] = checkInterfaceFunction(
1157 M.getOrInsertFunction(ClMemoryAccessCallbackPrefix + "loadN",
1158 IRB.getVoidTy(), IntptrTy, IntptrTy, NULL));
1159 AsanMemoryAccessCallbackSized[1] = checkInterfaceFunction(
1160 M.getOrInsertFunction(ClMemoryAccessCallbackPrefix + "storeN",
1161 IRB.getVoidTy(), IntptrTy, IntptrTy, NULL));
11501162
11511163 AsanHandleNoReturnFunc = checkInterfaceFunction(M.getOrInsertFunction(
11521164 kAsanHandleNoReturnName, IRB.getVoidTy(), NULL));