mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 21:29:41 +00:00
Revert "SanitizerCoverage: Use createSanitizerCtor
to create ctor and call init"
Will fix tomorrow. Unbreak build bots now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236786 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c8cfbdd791
commit
f31b4e9690
@ -156,6 +156,7 @@ class SanitizerCoverageModule : public ModulePass {
|
||||
Function *SanCovFunction;
|
||||
Function *SanCovWithCheckFunction;
|
||||
Function *SanCovIndirCallFunction;
|
||||
Function *SanCovModuleInit;
|
||||
Function *SanCovTraceEnter, *SanCovTraceBB;
|
||||
Function *SanCovTraceCmpFunction;
|
||||
InlineAsm *EmptyAsm;
|
||||
@ -183,6 +184,12 @@ bool SanitizerCoverageModule::runOnModule(Module &M) {
|
||||
Type *Int32PtrTy = PointerType::getUnqual(IRB.getInt32Ty());
|
||||
Int64Ty = IRB.getInt64Ty();
|
||||
|
||||
Function *CtorFunc =
|
||||
Function::Create(FunctionType::get(VoidTy, false),
|
||||
GlobalValue::InternalLinkage, kSanCovModuleCtorName, &M);
|
||||
ReturnInst::Create(*C, BasicBlock::Create(*C, "", CtorFunc));
|
||||
appendToGlobalCtors(M, CtorFunc, kSanCtorAndDtorPriority);
|
||||
|
||||
SanCovFunction = checkSanitizerInterfaceFunction(
|
||||
M.getOrInsertFunction(kSanCovName, VoidTy, Int32PtrTy, nullptr));
|
||||
SanCovWithCheckFunction = checkSanitizerInterfaceFunction(
|
||||
@ -194,6 +201,10 @@ bool SanitizerCoverageModule::runOnModule(Module &M) {
|
||||
checkSanitizerInterfaceFunction(M.getOrInsertFunction(
|
||||
kSanCovTraceCmp, VoidTy, Int64Ty, Int64Ty, Int64Ty, nullptr));
|
||||
|
||||
SanCovModuleInit = checkSanitizerInterfaceFunction(M.getOrInsertFunction(
|
||||
kSanCovModuleInitName, VoidTy, Int32PtrTy, IntptrTy,
|
||||
Int8PtrTy, Int8PtrTy, nullptr));
|
||||
SanCovModuleInit->setLinkage(Function::ExternalLinkage);
|
||||
// We insert an empty inline asm after cov callbacks to avoid callback merge.
|
||||
EmptyAsm = InlineAsm::get(FunctionType::get(IRB.getVoidTy(), false),
|
||||
StringRef(""), StringRef(""),
|
||||
@ -259,21 +270,15 @@ bool SanitizerCoverageModule::runOnModule(Module &M) {
|
||||
new GlobalVariable(M, ModNameStrConst->getType(), true,
|
||||
GlobalValue::PrivateLinkage, ModNameStrConst);
|
||||
|
||||
ArrayRef<Value *> InitArgs = {
|
||||
IRB.CreatePointerCast(RealGuardArray, Int32PtrTy),
|
||||
// Call __sanitizer_cov_module_init
|
||||
IRB.SetInsertPoint(CtorFunc->getEntryBlock().getTerminator());
|
||||
IRB.CreateCall4(
|
||||
SanCovModuleInit, IRB.CreatePointerCast(RealGuardArray, Int32PtrTy),
|
||||
ConstantInt::get(IntptrTy, N),
|
||||
Options.Use8bitCounters
|
||||
? IRB.CreatePointerCast(RealEightBitCounterArray, Int8PtrTy)
|
||||
: Constant::getNullValue(Int8PtrTy),
|
||||
IRB.CreatePointerCast(ModuleName, Int8PtrTy)};
|
||||
|
||||
Function *CtorFunc;
|
||||
std::tie(CtorFunc, std::ignore) = createSanitizerCtorAndInitFunctions(
|
||||
M, kSanCovModuleCtorName, kSanCovModuleInitName,
|
||||
{Int32PtrTy, IntptrTy, Int8PtrTy, Int8PtrTy}, InitArgs);
|
||||
|
||||
appendToGlobalCtors(M, CtorFunc, kSanCtorAndDtorPriority);
|
||||
|
||||
IRB.CreatePointerCast(ModuleName, Int8PtrTy));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user