bpftrace/SOURCES/bpftrace-0.13.1-Fix-compile-under-llvm14-trunk.patch
2022-11-08 11:48:28 +00:00

43 lines
1.3 KiB
Diff

From 2ca4b80fcd54300eecdb500a81f411571bfd38ba Mon Sep 17 00:00:00 2001
From: Yucong Sun <sunyucong@gmail.com>
Date: Thu, 21 Oct 2021 14:43:38 -0700
Subject: [PATCH 5/6] Fix compile under llvm14 (trunk)
---
CMakeLists.txt | 2 +-
src/bpforc.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3beeb027..3cfae6cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -159,7 +159,7 @@ else()
find_package(LLVM REQUIRED)
endif()
- if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 12))
+ if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 14))
message(SEND_ERROR "Unsupported LLVM version found: ${LLVM_INCLUDE_DIRS}")
message(SEND_ERROR "Specify an LLVM major version using LLVM_REQUESTED_VERSION=<major version>")
endif()
diff --git a/src/bpforc.h b/src/bpforc.h
index cc6a1c97..a0e5c9b8 100644
--- a/src/bpforc.h
+++ b/src/bpforc.h
@@ -14,7 +14,11 @@
#include <llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h>
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#include <llvm/Support/Error.h>
+#if LLVM_VERSION_MAJOR < 14
#include <llvm/Support/TargetRegistry.h>
+#else
+#include <llvm/MC/TargetRegistry.h>
+#endif
#include <llvm/Target/TargetMachine.h>
#ifdef LLVM_ORC_V2
--
2.35.3