dev-util/bpftrace-0.10.0-r1: Bump, patch llvm-10 segfault (bug #724382)
authorPatrick McLean <patrick.mclean@sony.com>
Thu, 28 May 2020 20:26:30 +0000 (13:26 -0700)
committerPatrick McLean <chutzpah@gentoo.org>
Thu, 28 May 2020 20:26:48 +0000 (13:26 -0700)
Closes: https://bugs.gentoo.org/724382
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild [moved from dev-util/bpftrace/bpftrace-0.10.0.ebuild with 92% similarity]
dev-util/bpftrace/files/bpftrace-0.10.0-llvm-multi.patch [new file with mode: 0644]

similarity index 92%
rename from dev-util/bpftrace/bpftrace-0.10.0.ebuild
rename to dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild
index 3070afa1505ce44b63c205d18ce82afd7931b330..196615ab2a9426dc382a8c1b96e2867e6f8afb32 100644 (file)
@@ -27,6 +27,8 @@ COMMON_DEPEND="dev-util/systemtap
        sys-devel/clang:=
        dev-libs/libbpf:=
        >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)]
+       <sys-devel/clang-10:=
+       <sys-devel/llvm-10:=[llvm_targets_BPF(+)]
        >=dev-util/bcc-0.12.0:=
        virtual/libelf"
 DEPEND="${COMMON_DEPEND}
@@ -42,6 +44,7 @@ QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
 PATCHES=(
        "${FILESDIR}/bpftrace-0.10.0-install-libs.patch"
        "${FILESDIR}/bpftrace-0.10.0-dont-compress-man.patch"
+       "${FILESDIR}/bpftrace-0.10.0-llvm-multi.patch"
 )
 
 # lots of fixing needed
diff --git a/dev-util/bpftrace/files/bpftrace-0.10.0-llvm-multi.patch b/dev-util/bpftrace/files/bpftrace-0.10.0-llvm-multi.patch
new file mode 100644 (file)
index 0000000..48eeeb8
--- /dev/null
@@ -0,0 +1,60 @@
+diff -ru a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt   2020-05-20 21:00:22.789744736 -0500
++++ b/CMakeLists.txt   2020-05-20 18:52:38.241091110 -0500
+@@ -30,6 +30,11 @@
+   elseif(STATIC_LIBC)
+     message(WARNING "static libc is known to cause problems, consider STATIC_LIBC=OFF. Proceed at your own risk") #iovisor/bpftrace/issues/266
+   endif()
++else()
++  find_package(LLVM 9 REQUIRED CONFIG)
++
++  message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
++  message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
+ endif()
+
+ if(EMBED_LIBCLANG_ONLY AND NOT EMBED_CLANG)
+diff -ru a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+--- a/src/ast/CMakeLists.txt   2020-05-20 21:00:22.777744534 -0500
++++ b/src/ast/CMakeLists.txt   2020-05-20 20:52:39.657888690 -0500
+@@ -42,26 +41,29 @@
+     if(EMBED_LIBCLANG_ONLY)
+       unlink_transitive_dependency("${CLANG_EXPORTED_TARGETS}" "LLVM")
+     endif()
+-    target_link_libraries(bpftraceast ${CLANG_EMBEDDED_CMAKE_TARGETS})
++    target_link_libraries(bpftraceast ${CLANG_EMBEDDED_CMAKE_TARGETS})
+   else()
+     list(INSERT clang_libs 0 libclang.a)
+   endif()
+
+   if(EMBED_LLVM)
+-    target_link_libraries(bpftraceast ${LLVM_EMBEDDED_CMAKE_TARGETS})
++    target_link_libraries(bpftraceast ${LLVM_EMBEDDED_CMAKE_TARGETS})
+   else()
+     llvm_map_components_to_libnames(llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD})
+-    target_link_libraries(bpftraceast ${clang_libs})
+-    target_link_libraries(bpftraceast ${llvm_libs})
++    target_link_libraries(bpftraceast ${clang_libs})
++    target_link_libraries(bpftraceast ${llvm_libs})
+   endif()
+ else()
+-  find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+-  if(found_LLVM)
+-    target_link_libraries(bpftraceast LLVM)
+-  else()
+-    llvm_map_components_to_libnames(_llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD})
+-    llvm_expand_dependencies(llvm_libs ${_llvm_libs})
+-    target_link_libraries(bpftraceast ${llvm_libs})
++  find_package(LLVM 9 REQUIRED CONFIG)
++
++  include_directories(${LLVM_INCLUDE_DIRS})
++  add_definitions(${LLVM_DEFINITIONS})
++
++  find_library(found_clang clang HINTS ${LLVM_LIBRARY_DIRS})
++  if(found_clang)
++    target_link_libraries(bpftraceast ${found_clang})
+   endif()
+-  target_link_libraries(bpftraceast libclang)
++  llvm_map_components_to_libnames(_llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD})
++  llvm_expand_dependencies(llvm_libs ${_llvm_libs})
++  target_link_libraries(bpftraceast ${llvm_libs})
+ endif()