about summary refs log tree commit diff
path: root/instrumentation/SanitizerCoverageLTO.so.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-12-23 22:07:32 +0100
committerGitHub <noreply@github.com>2023-12-23 22:07:32 +0100
commit3c0cfd82bccc8e44f01f76628209aecfc8f2aacf (patch)
treea0d53cfec4be6cdffbd985871171bee6cd6f29b2 /instrumentation/SanitizerCoverageLTO.so.cc
parent27d05f3c216e18163236efa42b630a5b3784d2e9 (diff)
parentdf0638ab87a37f0a3604f5a95a4164153a3bd582 (diff)
downloadafl++-3c0cfd82bccc8e44f01f76628209aecfc8f2aacf.tar.gz
Merge pull request #1940 from devnexen/llvm_18_build_fix
llvm 18 build fixes.
Diffstat (limited to 'instrumentation/SanitizerCoverageLTO.so.cc')
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index c70fbd4f..8365cf65 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -696,12 +696,12 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
                         FT->getReturnType()->isIntegerTy(32) &&
                         FT->getParamType(0) == FT->getParamType(1) &&
                         FT->getParamType(0) ==
-                            IntegerType::getInt8PtrTy(M.getContext());
+                            IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
             isStrcasecmp &= FT->getNumParams() == 2 &&
                             FT->getReturnType()->isIntegerTy(32) &&
                             FT->getParamType(0) == FT->getParamType(1) &&
                             FT->getParamType(0) ==
-                                IntegerType::getInt8PtrTy(M.getContext());
+                                IntegerType::getInt8Ty(M.getContext())->getPointerTo(0);
             isMemcmp &= FT->getNumParams() == 3 &&
                         FT->getReturnType()->isIntegerTy(32) &&
                         FT->getParamType(0)->isPointerTy() &&
@@ -711,13 +711,13 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
                          FT->getReturnType()->isIntegerTy(32) &&
                          FT->getParamType(0) == FT->getParamType(1) &&
                          FT->getParamType(0) ==
-                             IntegerType::getInt8PtrTy(M.getContext()) &&
+                             IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
                          FT->getParamType(2)->isIntegerTy();
             isStrncasecmp &= FT->getNumParams() == 3 &&
                              FT->getReturnType()->isIntegerTy(32) &&
                              FT->getParamType(0) == FT->getParamType(1) &&
                              FT->getParamType(0) ==
-                                 IntegerType::getInt8PtrTy(M.getContext()) &&
+                                 IntegerType::getInt8Ty(M.getContext())->getPointerTo(0) &&
                              FT->getParamType(2)->isIntegerTy();
             isStdString &= FT->getNumParams() >= 2 &&
                            FT->getParamType(0)->isPointerTy() &&
@@ -1241,7 +1241,11 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
   if (F.empty()) return;
   if (F.getName().find(".module_ctor") != std::string::npos)
     return;  // Should not instrument sanitizer init functions.
+#if LLVM_VERSION_MAJOR >= 18
+  if (F.getName().starts_with("__sanitizer_"))
+#else
   if (F.getName().startswith("__sanitizer_"))
+#endif
     return;  // Don't instrument __sanitizer_* callbacks.
   // Don't touch available_externally functions, their actual body is elsewhere.
   if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return;
@@ -1493,7 +1497,7 @@ GlobalVariable *ModuleSanitizerCoverageLTO::CreateFunctionLocalArrayInSection(
       Array->setComdat(Comdat);
 #endif
   Array->setSection(getSectionName(Section));
-  Array->setAlignment(Align(DL->getTypeStoreSize(Ty).getFixedSize()));
+  Array->setAlignment(Align(DL->getTypeStoreSize(Ty).getFixedValue()));
   GlobalsToAppendToUsed.push_back(Array);
   GlobalsToAppendToCompilerUsed.push_back(Array);
   MDNode *MD = MDNode::get(F.getContext(), ValueAsMetadata::get(&F));