mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-08 16:21:32 +00:00
Merge pull request #1940 from devnexen/llvm_18_build_fix
llvm 18 build fixes.
This commit is contained in:
commit
3c0cfd82bc
@ -696,12 +696,12 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
|
|||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext());
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isStrcasecmp &= FT->getNumParams() == 2 &&
|
isStrcasecmp &= FT->getNumParams() == 2 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext());
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isMemcmp &= FT->getNumParams() == 3 &&
|
isMemcmp &= FT->getNumParams() == 3 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0)->isPointerTy() &&
|
FT->getParamType(0)->isPointerTy() &&
|
||||||
@ -711,13 +711,13 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
|
|||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
isStrncasecmp &= FT->getNumParams() == 3 &&
|
isStrncasecmp &= FT->getNumParams() == 3 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
isStdString &= FT->getNumParams() >= 2 &&
|
isStdString &= FT->getNumParams() >= 2 &&
|
||||||
FT->getParamType(0)->isPointerTy() &&
|
FT->getParamType(0)->isPointerTy() &&
|
||||||
@ -1241,7 +1241,11 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
|
|||||||
if (F.empty()) return;
|
if (F.empty()) return;
|
||||||
if (F.getName().find(".module_ctor") != std::string::npos)
|
if (F.getName().find(".module_ctor") != std::string::npos)
|
||||||
return; // Should not instrument sanitizer init functions.
|
return; // Should not instrument sanitizer init functions.
|
||||||
|
#if LLVM_VERSION_MAJOR >= 18
|
||||||
|
if (F.getName().starts_with("__sanitizer_"))
|
||||||
|
#else
|
||||||
if (F.getName().startswith("__sanitizer_"))
|
if (F.getName().startswith("__sanitizer_"))
|
||||||
|
#endif
|
||||||
return; // Don't instrument __sanitizer_* callbacks.
|
return; // Don't instrument __sanitizer_* callbacks.
|
||||||
// Don't touch available_externally functions, their actual body is elsewhere.
|
// Don't touch available_externally functions, their actual body is elsewhere.
|
||||||
if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return;
|
if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return;
|
||||||
@ -1493,7 +1497,7 @@ GlobalVariable *ModuleSanitizerCoverageLTO::CreateFunctionLocalArrayInSection(
|
|||||||
Array->setComdat(Comdat);
|
Array->setComdat(Comdat);
|
||||||
#endif
|
#endif
|
||||||
Array->setSection(getSectionName(Section));
|
Array->setSection(getSectionName(Section));
|
||||||
Array->setAlignment(Align(DL->getTypeStoreSize(Ty).getFixedSize()));
|
Array->setAlignment(Align(DL->getTypeStoreSize(Ty).getFixedValue()));
|
||||||
GlobalsToAppendToUsed.push_back(Array);
|
GlobalsToAppendToUsed.push_back(Array);
|
||||||
GlobalsToAppendToCompilerUsed.push_back(Array);
|
GlobalsToAppendToCompilerUsed.push_back(Array);
|
||||||
MDNode *MD = MDNode::get(F.getContext(), ValueAsMetadata::get(&F));
|
MDNode *MD = MDNode::get(F.getContext(), ValueAsMetadata::get(&F));
|
||||||
|
@ -572,7 +572,11 @@ void ModuleSanitizerCoverageAFL::instrumentFunction(
|
|||||||
if (!isInInstrumentList(&F, FMNAME)) return;
|
if (!isInInstrumentList(&F, FMNAME)) return;
|
||||||
if (F.getName().find(".module_ctor") != std::string::npos)
|
if (F.getName().find(".module_ctor") != std::string::npos)
|
||||||
return; // Should not instrument sanitizer init functions.
|
return; // Should not instrument sanitizer init functions.
|
||||||
|
#if LLVM_VERSION_MAJOR >= 18
|
||||||
|
if (F.getName().starts_with("__sanitizer_"))
|
||||||
|
#else
|
||||||
if (F.getName().startswith("__sanitizer_"))
|
if (F.getName().startswith("__sanitizer_"))
|
||||||
|
#endif
|
||||||
return; // Don't instrument __sanitizer_* callbacks.
|
return; // Don't instrument __sanitizer_* callbacks.
|
||||||
// Don't touch available_externally functions, their actual body is elewhere.
|
// Don't touch available_externally functions, their actual body is elewhere.
|
||||||
if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return;
|
if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return;
|
||||||
|
@ -433,15 +433,15 @@ bool AFLdict2filePass::runOnModule(Module &M) {
|
|||||||
isStrstr &=
|
isStrstr &=
|
||||||
FT->getNumParams() == 2 &&
|
FT->getNumParams() == 2 &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) == IntegerType::getInt8PtrTy(M.getContext());
|
FT->getParamType(0) == IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isStrcmp &=
|
isStrcmp &=
|
||||||
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) == IntegerType::getInt8PtrTy(M.getContext());
|
FT->getParamType(0) == IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isStrcasecmp &=
|
isStrcasecmp &=
|
||||||
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) == IntegerType::getInt8PtrTy(M.getContext());
|
FT->getParamType(0) == IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isMemcmp &= FT->getNumParams() == 3 &&
|
isMemcmp &= FT->getNumParams() == 3 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0)->isPointerTy() &&
|
FT->getParamType(0)->isPointerTy() &&
|
||||||
@ -451,13 +451,13 @@ bool AFLdict2filePass::runOnModule(Module &M) {
|
|||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
isStrncasecmp &= FT->getNumParams() == 3 &&
|
isStrncasecmp &= FT->getNumParams() == 3 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
isStdString &= FT->getNumParams() >= 2 &&
|
isStdString &= FT->getNumParams() >= 2 &&
|
||||||
FT->getParamType(0)->isPointerTy() &&
|
FT->getParamType(0)->isPointerTy() &&
|
||||||
|
@ -385,7 +385,7 @@ bool CmpLogRoutines::hookRtns(Module &M) {
|
|||||||
isStrcmp &=
|
isStrcmp &=
|
||||||
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) == IntegerType::getInt8PtrTy(M.getContext());
|
FT->getParamType(0) == IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
|
|
||||||
bool isStrncmp = (!FuncName.compare("strncmp") ||
|
bool isStrncmp = (!FuncName.compare("strncmp") ||
|
||||||
!FuncName.compare("xmlStrncmp") ||
|
!FuncName.compare("xmlStrncmp") ||
|
||||||
@ -402,7 +402,7 @@ bool CmpLogRoutines::hookRtns(Module &M) {
|
|||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
|
|
||||||
bool isGccStdStringStdString =
|
bool isGccStdStringStdString =
|
||||||
|
@ -271,11 +271,11 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
|||||||
isStrcmp &=
|
isStrcmp &=
|
||||||
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) == IntegerType::getInt8PtrTy(M.getContext());
|
FT->getParamType(0) == IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isStrcasecmp &=
|
isStrcasecmp &=
|
||||||
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
FT->getNumParams() == 2 && FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) == IntegerType::getInt8PtrTy(M.getContext());
|
FT->getParamType(0) == IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
|
||||||
isMemcmp &= FT->getNumParams() == 3 &&
|
isMemcmp &= FT->getNumParams() == 3 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0)->isPointerTy() &&
|
FT->getParamType(0)->isPointerTy() &&
|
||||||
@ -285,13 +285,13 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
|||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
isStrncasecmp &= FT->getNumParams() == 3 &&
|
isStrncasecmp &= FT->getNumParams() == 3 &&
|
||||||
FT->getReturnType()->isIntegerTy(32) &&
|
FT->getReturnType()->isIntegerTy(32) &&
|
||||||
FT->getParamType(0) == FT->getParamType(1) &&
|
FT->getParamType(0) == FT->getParamType(1) &&
|
||||||
FT->getParamType(0) ==
|
FT->getParamType(0) ==
|
||||||
IntegerType::getInt8PtrTy(M.getContext()) &&
|
IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
|
||||||
FT->getParamType(2)->isIntegerTy();
|
FT->getParamType(2)->isIntegerTy();
|
||||||
|
|
||||||
if (!isStrcmp && !isMemcmp && !isStrncmp && !isStrcasecmp &&
|
if (!isStrcmp && !isMemcmp && !isStrncmp && !isStrcasecmp &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user