diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp @@ -337,8 +337,6 @@ Module &M; const StackSafetyGlobalInfo *SSI; Triple TargetTriple; - FunctionCallee HWAsanMemmove, HWAsanMemcpy, HWAsanMemset; - FunctionCallee HWAsanHandleVfork; /// This struct defines the shadow mapping using the rule: /// shadow = (mem >> Scale) + Offset. @@ -392,6 +390,9 @@ FunctionCallee HwasanMemoryAccessCallback[2][kNumberOfAccessSizes]; FunctionCallee HwasanMemoryAccessCallbackSized[2]; + FunctionCallee HwasanMemmove, HwasanMemcpy, HwasanMemset; + FunctionCallee HwasanHandleVfork; + FunctionCallee HwasanTagMemoryFunc; FunctionCallee HwasanGenerateTagFunc; FunctionCallee HwasanRecordFrameRecordFunc; @@ -626,7 +627,7 @@ const std::string MatchAllStr = UseMatchAllCallback ? "_match_all" : ""; FunctionType *HwasanMemoryAccessCallbackSizedFnTy, *HwasanMemoryAccessCallbackFnTy, *HWAsanMemTransferFnTy, - *HWAsanMemsetFnTy; + *HwasanMemsetFnTy; if (UseMatchAllCallback) { HwasanMemoryAccessCallbackSizedFnTy = FunctionType::get(VoidTy, {IntptrTy, IntptrTy, Int8Ty}, false); @@ -634,7 +635,7 @@ FunctionType::get(VoidTy, {IntptrTy, Int8Ty}, false); HWAsanMemTransferFnTy = FunctionType::get( Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy, Int8Ty}, false); - HWAsanMemsetFnTy = FunctionType::get( + HwasanMemsetFnTy = FunctionType::get( Int8PtrTy, {Int8PtrTy, Int32Ty, IntptrTy, Int8Ty}, false); } else { HwasanMemoryAccessCallbackSizedFnTy = @@ -643,7 +644,7 @@ FunctionType::get(VoidTy, {IntptrTy}, false); HWAsanMemTransferFnTy = FunctionType::get(Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy}, false); - HWAsanMemsetFnTy = + HwasanMemsetFnTy = FunctionType::get(Int8PtrTy, {Int8PtrTy, Int32Ty, IntptrTy}, false); } @@ -670,12 +671,12 @@ ? std::string("") : ClMemoryAccessCallbackPrefix; - HWAsanMemmove = M.getOrInsertFunction( + HwasanMemmove = M.getOrInsertFunction( MemIntrinCallbackPrefix + "memmove" + MatchAllStr, HWAsanMemTransferFnTy); - HWAsanMemcpy = M.getOrInsertFunction( + HwasanMemcpy = M.getOrInsertFunction( MemIntrinCallbackPrefix + "memcpy" + MatchAllStr, HWAsanMemTransferFnTy); - HWAsanMemset = M.getOrInsertFunction( - MemIntrinCallbackPrefix + "memset" + MatchAllStr, HWAsanMemsetFnTy); + HwasanMemset = M.getOrInsertFunction( + MemIntrinCallbackPrefix + "memset" + MatchAllStr, HwasanMemsetFnTy); HwasanTagMemoryFunc = M.getOrInsertFunction("__hwasan_tag_memory", VoidTy, Int8PtrTy, Int8Ty, IntptrTy); @@ -688,7 +689,7 @@ ShadowGlobal = M.getOrInsertGlobal("__hwasan_shadow", ArrayType::get(Int8Ty, 0)); - HWAsanHandleVfork = + HwasanHandleVfork = M.getOrInsertFunction("__hwasan_handle_vfork", VoidTy, IntptrTy); } @@ -959,14 +960,14 @@ if (isa(MI)) { if (UseMatchAllCallback) { IRB.CreateCall( - isa(MI) ? HWAsanMemmove : HWAsanMemcpy, + isa(MI) ? HwasanMemmove : HwasanMemcpy, {IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()), IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy()), IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false), ConstantInt::get(Int8Ty, *MatchAllTag)}); } else { IRB.CreateCall( - isa(MI) ? HWAsanMemmove : HWAsanMemcpy, + isa(MI) ? HwasanMemmove : HwasanMemcpy, {IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()), IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy()), IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)}); @@ -974,14 +975,14 @@ } else if (isa(MI)) { if (UseMatchAllCallback) { IRB.CreateCall( - HWAsanMemset, + HwasanMemset, {IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()), IRB.CreateIntCast(MI->getOperand(1), IRB.getInt32Ty(), false), IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false), ConstantInt::get(Int8Ty, *MatchAllTag)}); } else { IRB.CreateCall( - HWAsanMemset, + HwasanMemset, {IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()), IRB.CreateIntCast(MI->getOperand(1), IRB.getInt32Ty(), false), IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)}); @@ -1326,7 +1327,7 @@ for (auto *LP : LandingPadVec) { IRBuilder<> IRB(LP->getNextNode()); IRB.CreateCall( - HWAsanHandleVfork, + HwasanHandleVfork, {readRegister(IRB, (TargetTriple.getArch() == Triple::x86_64) ? "rsp" : "sp")}); }