about summary refs log tree commit diff
path: root/instrumentation/SanitizerCoverageLTO.so.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-04-12 10:54:08 +0200
committerGitHub <noreply@github.com>2023-04-12 10:54:08 +0200
commit4f2d9eeaaa6b702ef28eb883f9000321eaf1fe9b (patch)
tree125cecc79c148552844723e95ddd246bf918d6fc /instrumentation/SanitizerCoverageLTO.so.cc
parent7101192865893e00b9029d0cb898a3ca3015d50b (diff)
parent743ae507756db0707a213cd8272b219b0de0f514 (diff)
downloadafl++-4f2d9eeaaa6b702ef28eb883f9000321eaf1fe9b.tar.gz
Merge pull request #1700 from AFLplusplus/dev
push to stable
Diffstat (limited to 'instrumentation/SanitizerCoverageLTO.so.cc')
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index f82224ed..b024179a 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -431,6 +431,8 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
     if ((afl_global_id = atoi(ptr)) < 0)
       FATAL("AFL_LLVM_LTO_STARTID value of \"%s\" is negative\n", ptr);
 
+  if (afl_global_id < 4) { afl_global_id = 4; }
+
   if ((ptr = getenv("AFL_LLVM_DOCUMENT_IDS")) != NULL) {
 
     dFile.open(ptr, std::ofstream::out | std::ofstream::app);
@@ -1779,6 +1781,7 @@ INITIALIZE_PASS_END(ModuleSanitizerCoverageLTOLegacyPass, "sancov-lto",
                     "Pass for instrumenting coverage on functions", false,
                     false)
 
+#if LLVM_VERSION_MAJOR < 16
 static void registerLTOPass(const PassManagerBuilder &,
                             legacy::PassManagerBase &PM) {
 
@@ -1793,8 +1796,9 @@ static RegisterStandardPasses RegisterCompTransPass(
 static RegisterStandardPasses RegisterCompTransPass0(
     PassManagerBuilder::EP_EnabledOnOptLevel0, registerLTOPass);
 
-#if LLVM_VERSION_MAJOR >= 11
+  #if LLVM_VERSION_MAJOR >= 11
 static RegisterStandardPasses RegisterCompTransPassLTO(
     PassManagerBuilder::EP_FullLinkTimeOptimizationLast, registerLTOPass);
+  #endif
 #endif