* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2023-08-31 18:35 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2023-08-31 18:35 UTC (permalink / raw
To: gentoo-commits
commit: 53e4f55f26d3ae4c93ac3308c56e7d8d44908a01
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 31 18:35:00 2023 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Thu Aug 31 18:35:00 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53e4f55f
dev-util/bpftrace: add 0.18.1
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 +
dev-util/bpftrace/bpftrace-0.18.1.ebuild | 95 ++++++
.../files/bpftrace-0.18.1-install-libs.patch | 329 +++++++++++++++++++++
3 files changed, 425 insertions(+)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 132e185ee5e1..6d71c4df156e 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,2 +1,3 @@
DIST bpftrace-0.17.1.gh.tar.gz 1035345 BLAKE2B 5dca6f3fc49458b4b2ed3068e3f99f1156067c430af36b53949e469a870101d2da6aba6c4d18bfaf173cc45eab18e3c316966a5e222a4b4cea98363a9afd90ce SHA512 57f00a0b209d745efe5ce39d0e8efb90a21b5c499b41385814378d828ef507dc2c6d9497f9d23dbb610fcff21f077cba9f7481e7a6a6465825065743289ef4ad
DIST bpftrace-0.18.0.gh.tar.gz 1046210 BLAKE2B 921fdd56cff48e7b8fc2b8164839393f2759218accaa58412fdf80b2df4474067c3c660da09e3ee808d258c1f19b0534fa81462cbea5ce3e814bdbeaa7dce5aa SHA512 b7da273d251f03a81b3a7097407352e7ad1d023972852bdb883176e97bab7046f9f327bd03bca51fe853ecaab5f60adc6994e75cb450a033a5b91118f719c36d
+DIST bpftrace-0.18.1.gh.tar.gz 1046307 BLAKE2B 67c5d586e803c16ae0338563953e86cb3fbf318410f5757824a56fdf049b4b4fe5cc2d2b7e0435c625728b0b25123bcc8d64eaa923c14334d9ec23075c8deeec SHA512 eb81554f4707f8c919930932ff6ec7602578c317c058238a16fe38d6db055da0d7b355733821203281767419aa8e1b2256bb7a921f50c987c85395ecfbda966a
diff --git a/dev-util/bpftrace/bpftrace-0.18.1.ebuild b/dev-util/bpftrace/bpftrace-0.18.1.ebuild
new file mode 100644
index 000000000000..46d001890f50
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.18.1.ebuild
@@ -0,0 +1,95 @@
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_MAX_SLOT=16
+
+inherit llvm linux-info cmake
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+MY_PV="${PV//_/}"
+SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+
+# remove keywords until build works:
+# https://github.com/iovisor/bpftrace/issues/2349
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="fuzzing test"
+
+# lots of fixing needed
+RESTRICT="test"
+
+RDEPEND="
+ >=dev-libs/libbpf-1.1:=
+ >=dev-util/bcc-0.25.0:=
+ >=sys-devel/llvm-10[llvm_targets_BPF(+)]
+ >=sys-devel/clang-10
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
+ <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
+ sys-libs/binutils-libs:=
+ virtual/libelf:=
+"
+DEPEND="
+ ${COMMON_DEPEND}
+ dev-libs/cereal:=
+ test? ( dev-cpp/gtest )
+"
+BDEPEND="
+ app-arch/xz-utils
+ sys-devel/flex
+ sys-devel/bison
+ virtual/pkgconfig
+"
+
+QA_DT_NEEDED="
+ /usr/lib.*/libbpftraceresources.so
+ /usr/lib.*/libcxxdemangler_llvm.so
+"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.18.1-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+)
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ # bug 809362, 754648
+ -DBUILD_TESTING:BOOL=$(usex test)
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ -DENABLE_MAN:BOOL=OFF
+ -DUSE_SYSTEM_BPF_BCC:BOOL=ON
+ )
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # bug 809362
+ dostrip -x /usr/bin/bpftrace
+ doman man/man8/*.?
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.18.1-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.18.1-install-libs.patch
new file mode 100644
index 000000000000..1a7cfe609ba1
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.18.1-install-libs.patch
@@ -0,0 +1,329 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4f026f04..235e60a4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -138,9 +138,10 @@ endif()
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index a95c60a1..f5c4d676 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 0a7a6a09..00020fc9 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -13,7 +13,7 @@ else()
+ endif ()
+ endif()
+
+-add_library(runtime
++add_library(bpftraceruntime
+ attached_probe.cpp
+ bpffeature.cpp
+ bpftrace.cpp
+@@ -44,7 +44,7 @@ add_library(runtime
+ ${BFD_DISASM_SRC}
+ )
+ # Ensure flex+bison outputs are built first
+-add_dependencies(runtime parser)
++add_dependencies(bpftraceruntime bpftraceparser)
+
+ add_library(libbpftrace
+ build_info.cpp
+@@ -61,6 +61,7 @@ add_executable(${BPFTRACE}
+ )
+
+ install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_link_libraries(${BPFTRACE} libbpftrace)
+
+ if (BUILD_FUZZ)
+@@ -89,7 +90,7 @@ endif()
+ set(KERNEL_HEADERS_DIR "" CACHE PATH "Hard-code kernel headers directory")
+ if (KERNEL_HEADERS_DIR)
+ MESSAGE(STATUS "Using KERNEL_HEADERS_DIR=${KERNEL_HEADERS_DIR}")
+- target_compile_definitions(runtime PUBLIC KERNEL_HEADERS_DIR="${KERNEL_HEADERS_DIR}")
++ target_compile_definitions(bpftraceruntime PUBLIC KERNEL_HEADERS_DIR="${KERNEL_HEADERS_DIR}")
+ endif()
+
+ execute_process(
+@@ -109,10 +110,11 @@ endif()
+
+ add_definitions("-DBPFTRACE_VERSION=\"${BPFTRACE_VERSION}\"")
+
+-target_include_directories(runtime PRIVATE ${CMAKE_BINARY_DIR})
+-target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src)
+-target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src/ast)
+-target_compile_definitions(runtime PRIVATE ${BPFTRACE_FLAGS})
++target_include_directories(bpftraceruntime PRIVATE ${CMAKE_BINARY_DIR})
++target_include_directories(bpftraceruntime PRIVATE ${CMAKE_SOURCE_DIR}/src)
++target_include_directories(bpftraceruntime PRIVATE ${CMAKE_SOURCE_DIR}/src/ast)
++target_compile_definitions(bpftraceruntime PRIVATE ${BPFTRACE_FLAGS})
++install(TARGETS bpftraceruntime LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_compile_definitions(libbpftrace PRIVATE ${BPFTRACE_FLAGS})
+
+ # Linking
+@@ -125,8 +127,8 @@ if(STATIC_LINKING)
+ endif(STATIC_LINKING)
+
+
+-target_link_libraries(runtime ${LIBBPF_LIBRARIES} ${ZLIB_LIBRARIES})
+-target_link_libraries(libbpftrace parser resources runtime aot ast arch cxxdemangler_llvm)
++target_link_libraries(bpftraceruntime ${LIBBPF_LIBRARIES} ${ZLIB_LIBRARIES})
++target_link_libraries(libbpftrace bpftraceparser bpftraceresources bpftraceruntime aot bpftraceast bpftracearch cxxdemangler_llvm)
+
+ if(LIBPCAP_FOUND)
+ target_link_libraries(libbpftrace ${LIBPCAP_LIBRARIES})
+@@ -136,37 +138,38 @@ if(HAVE_BFD_DISASM)
+ if(STATIC_LINKING)
+ add_library(LIBBFD STATIC IMPORTED)
+ set_property(TARGET LIBBFD PROPERTY IMPORTED_LOCATION ${LIBBFD_LIBRARIES})
+- target_link_libraries(runtime LIBBFD)
++ target_link_libraries(bpftraceruntime LIBBFD)
+ add_library(LIBOPCODES STATIC IMPORTED)
+ set_property(TARGET LIBOPCODES PROPERTY IMPORTED_LOCATION ${LIBOPCODES_LIBRARIES})
+- target_link_libraries(runtime LIBOPCODES)
++ target_link_libraries(bpftraceruntime LIBOPCODES)
+ add_library(LIBIBERTY STATIC IMPORTED)
+ set_property(TARGET LIBIBERTY PROPERTY IMPORTED_LOCATION ${LIBIBERTY_LIBRARIES})
+- target_link_libraries(runtime LIBIBERTY)
++ target_link_libraries(bpftraceruntime LIBIBERTY)
+ else()
+- target_link_libraries(runtime ${LIBBFD_LIBRARIES})
+- target_link_libraries(runtime ${LIBOPCODES_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBFD_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBOPCODES_LIBRARIES})
+ endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
+
+ # Link to bcc libraries (without LLVM) if possible
+ if(LIBBCC_BPF_CONTAINS_RUNTIME)
+- target_link_libraries(runtime ${LIBBCC_BPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBCC_BPF_LIBRARIES})
+ else()
+- target_link_libraries(runtime ${LIBBCC_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBCC_LIBRARIES})
+ endif()
+
+ if(STATIC_BPF_BCC)
+ # These are not part of the static libbcc so have to be added separate
+- target_link_libraries(runtime ${LIBBCC_BPF_LIBRARIES})
+- target_link_libraries(runtime ${LIBBPF_LIBRARIES})
+- target_link_libraries(runtime ${LIBBCC_LOADER_LIBRARY_STATIC})
++ target_link_libraries(bpftraceruntime ${LIBBCC_BPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBCC_LOADER_LIBRARY_STATIC})
+
+ add_library(LIBELF STATIC IMPORTED)
+ set_property(TARGET LIBELF PROPERTY IMPORTED_LOCATION ${LIBELF_LIBRARIES})
+- target_link_libraries(runtime LIBELF)
++ set_property(TARGET LIBELF PROPERTY IMPORTED_LOCATION ${LIBBPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime LIBELF)
+ else()
+- target_link_libraries(runtime ${LIBELF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBELF_LIBRARIES})
+ endif(STATIC_BPF_BCC)
+
+ if (LIBDW_FOUND)
+@@ -195,16 +198,16 @@ if (LIBDW_FOUND)
+
+ target_link_libraries(LIBDW INTERFACE ${LIBDW_LIBS})
+
+- target_link_libraries(runtime LIBDW)
++ target_link_libraries(bpftraceruntime LIBDW)
+ else()
+- target_link_libraries(runtime ${LIBDW_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBDW_LIBRARIES})
+ endif()
+ endif()
+
+ # Support for std::filesystem
+ # GCC version <9 and Clang (all versions) require -lstdc++fs
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9")
+- target_link_libraries(runtime "stdc++fs")
++ target_link_libraries(bpftraceruntime "stdc++fs")
+ target_link_libraries(libbpftrace "stdc++fs")
+ endif()
+
+@@ -226,16 +229,16 @@ endif()
+ if (STATIC_LINKING)
+ if(ANDROID)
+ target_link_libraries(libbpftrace "-Wl,-Bdynamic" "-ldl" "-lm" "-lz")
+- target_link_libraries(runtime "-Wl,-Bdynamic" "-ldl" "-lm" "-lz")
++ target_link_libraries(bpftraceruntime "-Wl,-Bdynamic" "-ldl" "-lm" "-lz")
+ else()
+ target_link_libraries(libbpftrace "-Wl,-Bdynamic" "-lrt" "-lpthread" "-ldl" "-lm")
+ target_link_libraries(libbpftrace "-Wl,-Bstatic" "-lz")
+- target_link_libraries(runtime "-Wl,-Bdynamic" "-lrt" "-lpthread" "-ldl" "-lm")
+- target_link_libraries(runtime "-Wl,-Bstatic" "-lz")
++ target_link_libraries(bpftraceruntime "-Wl,-Bdynamic" "-lrt" "-lpthread" "-ldl" "-lm")
++ target_link_libraries(bpftraceruntime "-Wl,-Bstatic" "-lz")
+ endif()
+ elseif(STATIC_BPF_BCC)
+ # partial static build, libbpf needs zlib, bcc needs liblzma
+- target_link_libraries(runtime "-lz" "-llzma")
++ target_link_libraries(bpftraceruntime "-lz" "-llzma")
+ endif()
+
+ unset(MAIN_SRC)
+diff --git a/src/aot/CMakeLists.txt b/src/aot/CMakeLists.txt
+index c776d204..41e84317 100644
+--- a/src/aot/CMakeLists.txt
++++ b/src/aot/CMakeLists.txt
+@@ -1,8 +1,9 @@
+ add_library(aot aot.cpp)
+-add_dependencies(aot parser)
++add_dependencies(aot bpftraceparser)
+ target_include_directories(aot PUBLIC ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(aot PUBLIC ${CMAKE_BINARY_DIR})
+ target_compile_definitions(aot PRIVATE ${BPFTRACE_FLAGS})
++install(TARGETS aot LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ # Only build aotrt if supported bcc is used
+ # (https://github.com/iovisor/bcc/commit/719191867a25ce07dc96f7faf9b8ccedadc7ec44)
+@@ -11,7 +12,7 @@ if(NOT LIBBCC_BPF_CONTAINS_RUNTIME)
+ endif()
+
+ add_executable(bpftrace-aotrt aot_main.cpp)
+-target_link_libraries(bpftrace-aotrt aot runtime arch ast_defs cxxdemangler_stdlib)
++target_link_libraries(bpftrace-aotrt aot bpftraceruntime bpftracearch ast_defs cxxdemangler_stdlib)
+ install(TARGETS bpftrace-aotrt DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(LIBPCAP_FOUND)
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index d01d1ea3..82bfeccc 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,21 +1,23 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
+- add_library(arch arm.cpp)
++ add_library(bpftracearch arm.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
+- add_library(arch s390.cpp)
++ add_library(bpftracearch s390.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
+- add_library(arch mips64.cpp)
++ add_library(bpftracearch mips64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
+- add_library(arch riscv64.cpp)
++ add_library(bpftracearch riscv64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "loongarch64")
+- add_library(arch loongarch64.cpp)
++ add_library(bpftracearch loongarch64.cpp)
+ else()
+ message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
++
++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index c390ea6a..37019bd9 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ add_library(ast_defs ast.cpp)
+
+-add_library(ast
++add_library(bpftraceast
+ async_event_types.cpp
+ attachpoint_parser.cpp
+ elf_parser.cpp
+@@ -21,11 +21,13 @@ add_library(ast
+ target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+ target_include_directories(ast_defs PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast ast_defs arch parser)
++target_link_libraries(bpftraceast ast_defs bpftracearch bpftraceparser)
++install(TARGETS ast_defs LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+-add_dependencies(ast_defs parser)
++add_dependencies(ast_defs bpftraceparser)
+
+-target_compile_definitions(ast PRIVATE ${BPFTRACE_FLAGS})
++target_compile_definitions(bpftraceast PRIVATE ${BPFTRACE_FLAGS})
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -58,20 +60,20 @@ if (STATIC_LINKING)
+
+
+ if(EMBED_USE_LLVM)
+- target_link_libraries(ast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
++ target_link_libraries(bpftraceast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
+ else()
+ llvm_map_components_to_libnames(llvm_libs ${llvm_lib_names})
+
+ if(TARGET libclang_static)
+- target_link_libraries(ast libclang_static)
++ target_link_libraries(bpftraceast libclang_static)
+ else()
+ # old LLVM versions don't export libclang_static in ClangTargets.cmake; fall back to
+ # libclang.a in that case
+- target_link_libraries(ast libclang.a)
++ target_link_libraries(abpftracest libclang.a)
+ endif()
+
+- target_link_libraries(ast ${clang_libs})
+- target_link_libraries(ast ${llvm_libs})
++ target_link_libraries(abpftracest ${clang_libs})
++ target_link_libraries(abpftracest ${llvm_libs})
+ endif()
+
+ if(STATIC_LIBC)
+@@ -81,11 +83,11 @@ if (STATIC_LINKING)
+ else()
+ find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+ if(found_LLVM)
+- target_link_libraries(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
+diff --git a/src/cxxdemangler/CMakeLists.txt b/src/cxxdemangler/CMakeLists.txt
+index 04cfcdd9..5677aa4b 100644
+--- a/src/cxxdemangler/CMakeLists.txt
++++ b/src/cxxdemangler/CMakeLists.txt
+@@ -1,2 +1,4 @@
+ add_library(cxxdemangler_stdlib cxxdemangler_stdlib.cpp)
+ add_library(cxxdemangler_llvm cxxdemangler_llvm.cpp)
++install(TARGETS cxxdemangler_stdlib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS cxxdemangler_llvm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2023-05-15 19:34 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2023-05-15 19:34 UTC (permalink / raw
To: gentoo-commits
commit: bc6c68c71d8ac4ff9a4f21397b3a85b94acdfda0
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Mon May 15 19:05:16 2023 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Mon May 15 19:34:23 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc6c68c7
dev-util/bpftrace: drop 0.16.0-r1, 0.16.0-r2, 0.17.0-r3, 0.17.0-r4
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.16.0-r1.ebuild | 92 -----
dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild | 93 -----
dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild | 97 -----
dev-util/bpftrace/bpftrace-0.17.0-r4.ebuild | 97 -----
.../files/bpftrace-0.16.0-install-libs.patch | 210 ----------
.../files/bpftrace-0.16.0-opaquepointer.patch | 450 ---------------------
6 files changed, 1039 deletions(-)
diff --git a/dev-util/bpftrace/bpftrace-0.16.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.16.0-r1.ebuild
deleted file mode 100644
index 3f624490bfe6..000000000000
--- a/dev-util/bpftrace/bpftrace-0.16.0-r1.ebuild
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 2019-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-LLVM_MAX_SLOT=16
-
-inherit llvm linux-info cmake
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-MY_PV="${PV//_/}"
-SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
-S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-
-# remove keywords until build works:
-# https://github.com/iovisor/bpftrace/issues/2349
-KEYWORDS="~amd64 ~arm64 ~x86"
-IUSE="fuzzing test"
-
-# lots of fixing needed
-RESTRICT="test"
-
-RDEPEND="
- >=dev-libs/libbpf-1.0:=
- >=dev-util/bcc-0.25.0:=
- <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
- <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
- sys-libs/binutils-libs:=
- virtual/libelf:=
-"
-DEPEND="
- ${COMMON_DEPEND}
- dev-libs/cereal:=
- test? ( dev-cpp/gtest )
-"
-BDEPEND="
- app-arch/xz-utils
- sys-devel/flex
- sys-devel/bison
- virtual/pkgconfig
-"
-
-QA_DT_NEEDED="
- /usr/lib.*/libbpftraceresources.so
- /usr/lib.*/libcxxdemangler_llvm.so
-"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.16.0-install-libs.patch"
- "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
- "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
-)
-
-pkg_pretend() {
- local CONFIG_CHECK="
- ~BPF
- ~BPF_EVENTS
- ~BPF_JIT
- ~BPF_SYSCALL
- ~FTRACE_SYSCALLS
- ~HAVE_EBPF_JIT
- "
-
- check_extra_config
-}
-
-pkg_setup() {
- llvm_pkg_setup
-}
-
-src_configure() {
- local mycmakeargs=(
- -DSTATIC_LINKING:BOOL=OFF
- # bug 809362, 754648
- -DBUILD_TESTING:BOOL=$(usex test)
- -DBUILD_FUZZ:BOOL=$(usex fuzzing)
- -DENABLE_MAN:BOOL=OFF
- )
-
- cmake_src_configure
-}
-
-src_install() {
- cmake_src_install
- # bug 809362
- dostrip -x /usr/bin/bpftrace
- doman man/man8/*.?
-}
diff --git a/dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild b/dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild
deleted file mode 100644
index dca9044e1ff0..000000000000
--- a/dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright 2019-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-LLVM_MAX_SLOT=16
-
-inherit llvm linux-info cmake
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-MY_PV="${PV//_/}"
-SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
-S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-
-# remove keywords until build works:
-# https://github.com/iovisor/bpftrace/issues/2349
-KEYWORDS="~amd64 ~arm64 ~x86"
-IUSE="fuzzing test"
-
-# lots of fixing needed
-RESTRICT="test"
-
-RDEPEND="
- >=dev-libs/libbpf-1.0:=
- >=dev-util/bcc-0.25.0:=
- <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
- <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
- sys-libs/binutils-libs:=
- virtual/libelf:=
-"
-DEPEND="
- ${COMMON_DEPEND}
- dev-libs/cereal:=
- test? ( dev-cpp/gtest )
-"
-BDEPEND="
- app-arch/xz-utils
- sys-devel/flex
- sys-devel/bison
- virtual/pkgconfig
-"
-
-QA_DT_NEEDED="
- /usr/lib.*/libbpftraceresources.so
- /usr/lib.*/libcxxdemangler_llvm.so
-"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.16.0-install-libs.patch"
- "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
- "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
- "${FILESDIR}/bpftrace-0.16.0-opaquepointer.patch"
-)
-
-pkg_pretend() {
- local CONFIG_CHECK="
- ~BPF
- ~BPF_EVENTS
- ~BPF_JIT
- ~BPF_SYSCALL
- ~FTRACE_SYSCALLS
- ~HAVE_EBPF_JIT
- "
-
- check_extra_config
-}
-
-pkg_setup() {
- llvm_pkg_setup
-}
-
-src_configure() {
- local mycmakeargs=(
- -DSTATIC_LINKING:BOOL=OFF
- # bug 809362, 754648
- -DBUILD_TESTING:BOOL=$(usex test)
- -DBUILD_FUZZ:BOOL=$(usex fuzzing)
- -DENABLE_MAN:BOOL=OFF
- )
-
- cmake_src_configure
-}
-
-src_install() {
- cmake_src_install
- # bug 809362
- dostrip -x /usr/bin/bpftrace
- doman man/man8/*.?
-}
diff --git a/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild b/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
deleted file mode 100644
index 161c441420f7..000000000000
--- a/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright 2019-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-LLVM_MAX_SLOT=16
-
-inherit llvm linux-info cmake
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-MY_PV="${PV//_/}"
-SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
-S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-
-# remove keywords until build works:
-# https://github.com/iovisor/bpftrace/issues/2349
-KEYWORDS="~amd64 ~arm64 ~x86"
-IUSE="fuzzing test"
-
-# lots of fixing needed
-RESTRICT="test"
-
-RDEPEND="
- >=dev-libs/libbpf-1.1:=
- >=dev-util/bcc-0.25.0:=
- >=sys-devel/llvm-10:=[llvm_targets_BPF(+)]
- >=sys-devel/clang-10:=
- <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
- <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
- sys-libs/binutils-libs:=
- virtual/libelf:=
-"
-DEPEND="
- ${COMMON_DEPEND}
- dev-libs/cereal:=
- test? ( dev-cpp/gtest )
-"
-BDEPEND="
- app-arch/xz-utils
- sys-devel/flex
- sys-devel/bison
- virtual/pkgconfig
-"
-
-QA_DT_NEEDED="
- /usr/lib.*/libbpftraceresources.so
- /usr/lib.*/libcxxdemangler_llvm.so
-"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.17.0-install-libs.patch"
- "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
- "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
- "${FILESDIR}/bpftrace-0.17.0-llvm-16.patch"
- "${FILESDIR}/bpftrace-0.17.0-use-std-optional.patch"
-)
-
-pkg_pretend() {
- local CONFIG_CHECK="
- ~BPF
- ~BPF_EVENTS
- ~BPF_JIT
- ~BPF_SYSCALL
- ~FTRACE_SYSCALLS
- ~HAVE_EBPF_JIT
- "
-
- check_extra_config
-}
-
-pkg_setup() {
- llvm_pkg_setup
-}
-
-src_configure() {
- local mycmakeargs=(
- -DSTATIC_LINKING:BOOL=OFF
- # bug 809362, 754648
- -DBUILD_TESTING:BOOL=$(usex test)
- -DBUILD_FUZZ:BOOL=$(usex fuzzing)
- -DENABLE_MAN:BOOL=OFF
- -DUSE_SYSTEM_BPF_BCC:BOOL=ON
- )
-
- cmake_src_configure
-}
-
-src_install() {
- cmake_src_install
- # bug 809362
- dostrip -x /usr/bin/bpftrace
- doman man/man8/*.?
-}
diff --git a/dev-util/bpftrace/bpftrace-0.17.0-r4.ebuild b/dev-util/bpftrace/bpftrace-0.17.0-r4.ebuild
deleted file mode 100644
index 21b7e21bf0fd..000000000000
--- a/dev-util/bpftrace/bpftrace-0.17.0-r4.ebuild
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright 2019-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-LLVM_MAX_SLOT=16
-
-inherit llvm linux-info cmake
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-MY_PV="${PV//_/}"
-SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
-S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-
-# remove keywords until build works:
-# https://github.com/iovisor/bpftrace/issues/2349
-KEYWORDS="~amd64 ~arm64 ~x86"
-IUSE="fuzzing test"
-
-# lots of fixing needed
-RESTRICT="test"
-
-RDEPEND="
- >=dev-libs/libbpf-1.1:=
- >=dev-util/bcc-0.25.0:=
- >=sys-devel/llvm-10[llvm_targets_BPF(+)]
- >=sys-devel/clang-10
- <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
- <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
- sys-libs/binutils-libs:=
- virtual/libelf:=
-"
-DEPEND="
- ${COMMON_DEPEND}
- dev-libs/cereal:=
- test? ( dev-cpp/gtest )
-"
-BDEPEND="
- app-arch/xz-utils
- sys-devel/flex
- sys-devel/bison
- virtual/pkgconfig
-"
-
-QA_DT_NEEDED="
- /usr/lib.*/libbpftraceresources.so
- /usr/lib.*/libcxxdemangler_llvm.so
-"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.17.0-install-libs.patch"
- "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
- "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
- "${FILESDIR}/bpftrace-0.17.0-llvm-16.patch"
- "${FILESDIR}/bpftrace-0.17.0-use-std-optional.patch"
-)
-
-pkg_pretend() {
- local CONFIG_CHECK="
- ~BPF
- ~BPF_EVENTS
- ~BPF_JIT
- ~BPF_SYSCALL
- ~FTRACE_SYSCALLS
- ~HAVE_EBPF_JIT
- "
-
- check_extra_config
-}
-
-pkg_setup() {
- llvm_pkg_setup
-}
-
-src_configure() {
- local mycmakeargs=(
- -DSTATIC_LINKING:BOOL=OFF
- # bug 809362, 754648
- -DBUILD_TESTING:BOOL=$(usex test)
- -DBUILD_FUZZ:BOOL=$(usex fuzzing)
- -DENABLE_MAN:BOOL=OFF
- -DUSE_SYSTEM_BPF_BCC:BOOL=ON
- )
-
- cmake_src_configure
-}
-
-src_install() {
- cmake_src_install
- # bug 809362
- dostrip -x /usr/bin/bpftrace
- doman man/man8/*.?
-}
diff --git a/dev-util/bpftrace/files/bpftrace-0.16.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.16.0-install-libs.patch
deleted file mode 100644
index 290c1065b2ce..000000000000
--- a/dev-util/bpftrace/files/bpftrace-0.16.0-install-libs.patch
+++ /dev/null
@@ -1,210 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e63bc83c..ada1d370 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -114,9 +114,10 @@ find_package(FLEX REQUIRED)
- bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
- flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
- add_flex_bison_dependency(flex_lexer bison_parser)
--add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
--target_compile_options(parser PRIVATE "-w")
--target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
-+add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
-+target_compile_options(bpftraceparser PRIVATE "-w")
-+target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
-+install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- include(CheckSymbolExists)
- set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
-diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
-index a95c60a1..f5c4d676 100644
---- a/resources/CMakeLists.txt
-+++ b/resources/CMakeLists.txt
-@@ -1,6 +1,7 @@
--add_library(resources headers.cpp)
-+add_library(bpftraceresources headers.cpp)
-
--target_include_directories(resources PUBLIC ../src)
-+target_include_directories(bpftraceresources PUBLIC ../src)
-+install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- function(embed_headers output)
- file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 09b8c1e0..b9e9ac44 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -42,7 +42,7 @@ add_library(runtime
- ${BFD_DISASM_SRC}
- )
- # Ensure flex+bison outputs are built first
--add_dependencies(runtime parser)
-+add_dependencies(runtime bpftraceparser)
-
- add_library(libbpftrace
- build_info.cpp
-@@ -59,6 +59,7 @@ add_executable(${BPFTRACE}
- )
-
- install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
-+install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- target_link_libraries(${BPFTRACE} libbpftrace)
-
- if (BUILD_FUZZ)
-@@ -111,6 +112,7 @@ target_include_directories(runtime PRIVATE ${CMAKE_BINARY_DIR})
- target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src)
- target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src/ast)
- target_compile_definitions(runtime PRIVATE ${BPFTRACE_FLAGS})
-+install(TARGETS runtime LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- target_compile_definitions(libbpftrace PRIVATE ${BPFTRACE_FLAGS})
-
- # Linking
-@@ -123,7 +125,8 @@ if(STATIC_LINKING)
- endif(STATIC_LINKING)
-
-
--target_link_libraries(libbpftrace parser resources runtime aot ast arch cxxdemangler_llvm)
-+target_link_libraries(libbpftrace bpftraceparser bpftraceresources
-+ runtime aot bpftraceast bpftracearch cxxdemangler_llvm)
-
- if (LIBBPF_BTF_DUMP_FOUND)
- target_link_libraries(runtime ${LIBBPF_LIBRARIES})
-@@ -168,6 +171,7 @@ if(STATIC_LINKING)
- target_link_libraries(runtime LIBELF)
- else()
- target_link_libraries(runtime ${LIBELF_LIBRARIES})
-+ target_link_libraries(runtime ${LIBBPF_LIBRARIES})
- endif(STATIC_LINKING)
-
- if (LIBDW_FOUND)
-diff --git a/src/aot/CMakeLists.txt b/src/aot/CMakeLists.txt
-index c776d204..a1d0d75e 100644
---- a/src/aot/CMakeLists.txt
-+++ b/src/aot/CMakeLists.txt
-@@ -1,8 +1,9 @@
- add_library(aot aot.cpp)
--add_dependencies(aot parser)
-+add_dependencies(aot bpftraceparser)
- target_include_directories(aot PUBLIC ${CMAKE_SOURCE_DIR}/src)
- target_include_directories(aot PUBLIC ${CMAKE_BINARY_DIR})
- target_compile_definitions(aot PRIVATE ${BPFTRACE_FLAGS})
-+install(TARGETS aot LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- # Only build aotrt if supported bcc is used
- # (https://github.com/iovisor/bcc/commit/719191867a25ce07dc96f7faf9b8ccedadc7ec44)
-@@ -11,7 +12,7 @@ if(NOT LIBBCC_BPF_CONTAINS_RUNTIME)
- endif()
-
- add_executable(bpftrace-aotrt aot_main.cpp)
--target_link_libraries(bpftrace-aotrt aot runtime arch ast_defs cxxdemangler_stdlib)
-+target_link_libraries(bpftrace-aotrt aot runtime bpftracearch ast_defs cxxdemangler_stdlib)
- install(TARGETS bpftrace-aotrt DESTINATION ${CMAKE_INSTALL_BINDIR})
-
- if(LIBPCAP_FOUND)
-diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
-index 127c3528..4e05d40a 100644
---- a/src/arch/CMakeLists.txt
-+++ b/src/arch/CMakeLists.txt
-@@ -1,17 +1,19 @@
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
-- add_library(arch aarch64.cpp)
-+ add_library(bpftracearch aarch64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
- CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
-- add_library(arch ppc64.cpp)
-+ add_library(bpftracearch ppc64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
- CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
-- add_library(arch s390.cpp)
-+ add_library(bpftracearch s390.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
-- add_library(arch x86_64.cpp)
-+ add_library(bpftracearch x86_64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
-- add_library(arch mips64.cpp)
-+ add_library(bpftracearch mips64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
-- add_library(arch riscv64.cpp)
-+ add_library(bpftracearch riscv64.cpp)
- else()
- message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
- endif()
-+
-+install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
-index 014295cd..c35f6ac6 100644
---- a/src/ast/CMakeLists.txt
-+++ b/src/ast/CMakeLists.txt
-@@ -1,6 +1,6 @@
- add_library(ast_defs ast.cpp)
-
--add_library(ast
-+add_library(bpftraceast
- async_event_types.cpp
- attachpoint_parser.cpp
- int_parser.cpp
-@@ -20,11 +20,13 @@ add_library(ast
- target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src)
- target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
- target_include_directories(ast_defs PUBLIC ${CMAKE_BINARY_DIR})
--target_link_libraries(ast ast_defs arch bpforc parser)
-+target_link_libraries(bpftraceast ast_defs bpftracearch bpforc bpftraceparser)
-+install(TARGETS ast_defs LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
--add_dependencies(ast_defs parser)
-+add_dependencies(ast_defs bpftraceparser)
-
--target_compile_definitions(ast PRIVATE ${BPFTRACE_FLAGS})
-+target_compile_definitions(bpftraceast PRIVATE ${BPFTRACE_FLAGS})
-
- if (STATIC_LINKING)
- set(clang_libs
-@@ -55,11 +57,11 @@ if (STATIC_LINKING)
-
-
- if(EMBED_USE_LLVM)
-- target_link_libraries(ast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
-+ target_link_libraries(bpftraceast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
- else()
- llvm_map_components_to_libnames(llvm_libs ${llvm_lib_names})
-- target_link_libraries(ast ${clang_libs})
-- target_link_libraries(ast ${llvm_libs})
-+ target_link_libraries(bpftraceast ${clang_libs})
-+ target_link_libraries(bpftraceast ${llvm_libs})
- endif()
-
- if(STATIC_LIBC)
-@@ -69,13 +71,13 @@ if (STATIC_LINKING)
- else()
- find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
- if(found_LLVM)
-- target_link_libraries(ast 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(ast ${llvm_libs})
-+ target_link_libraries(bpftraceast ${llvm_libs})
- endif()
-- target_link_libraries(ast libclang)
-+ target_link_libraries(bpftraceast libclang)
- endif()
-
- add_subdirectory(bpforc)
-diff --git a/src/ast/bpforc/CMakeLists.txt b/src/ast/bpforc/CMakeLists.txt
-index 3f6dbefa..8ccfbb2b 100644
---- a/src/ast/bpforc/CMakeLists.txt
-+++ b/src/ast/bpforc/CMakeLists.txt
-@@ -1 +1,2 @@
- add_library(bpforc bpforc.cpp)
-+install(TARGETS bpforc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/src/cxxdemangler/CMakeLists.txt b/src/cxxdemangler/CMakeLists.txt
-index 04cfcdd9..5677aa4b 100644
---- a/src/cxxdemangler/CMakeLists.txt
-+++ b/src/cxxdemangler/CMakeLists.txt
-@@ -1,2 +1,4 @@
- add_library(cxxdemangler_stdlib cxxdemangler_stdlib.cpp)
- add_library(cxxdemangler_llvm cxxdemangler_llvm.cpp)
-+install(TARGETS cxxdemangler_stdlib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+install(TARGETS cxxdemangler_llvm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/dev-util/bpftrace/files/bpftrace-0.16.0-opaquepointer.patch b/dev-util/bpftrace/files/bpftrace-0.16.0-opaquepointer.patch
deleted file mode 100644
index 656bf0f6a639..000000000000
--- a/dev-util/bpftrace/files/bpftrace-0.16.0-opaquepointer.patch
+++ /dev/null
@@ -1,450 +0,0 @@
-commit a8665b2ef3199e82fd2ad076c1f07f1af2ec9272
-Author: Viktor Malik <viktor.malik@gmail.com>
-Date: Mon Oct 10 14:26:38 2022 +0200
-
- IR builder: get rid of getPointerElementType calls
-
- Usage of Value::getPointerElementType is deprecated and will be dropped
- in LLVM 16 [1].
-
- There are several places where we use this method:
- - function (value) calls - the called function type is usually
- available, so just pass it to createCall, the only exception is
- CreateProbeReadStr which must have been refactored
- - getting the type of alloca instruction - there is a dedicated
- AllocaInst::getAllocatedType method that can be used instead
- - strncmp - pass sizes of the strings to CreateStrncmp to be able to get
- the correct string type (which is array of uint8)
-
- [1] https://llvm.org/docs/OpaquePointers.html
-
-diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
-index 09ae1c5e..da120ba1 100644
---- a/src/ast/irbuilderbpf.cpp
-+++ b/src/ast/irbuilderbpf.cpp
-@@ -291,17 +291,16 @@ CallInst *IRBuilderBPF::CreateHelperCall(libbpf::bpf_func_id func_id,
- Constant *helper_func = ConstantExpr::getCast(Instruction::IntToPtr,
- getInt64(func_id),
- helper_ptr_type);
-- return createCall(helper_func, args, Name);
-+ return createCall(helper_type, helper_func, args, Name);
- }
-
--CallInst *IRBuilderBPF::createCall(Value *callee,
-+CallInst *IRBuilderBPF::createCall(FunctionType *callee_type,
-+ Value *callee,
- ArrayRef<Value *> args,
- const Twine &Name)
- {
- #if LLVM_VERSION_MAJOR >= 11
-- auto *calleePtrType = cast<PointerType>(callee->getType());
-- auto *calleeType = cast<FunctionType>(calleePtrType->getPointerElementType());
-- return CreateCall(calleeType, callee, args, Name);
-+ return CreateCall(callee_type, callee, args, Name);
- #else
- return CreateCall(callee, args, Name);
- #endif
-@@ -310,7 +309,7 @@ CallInst *IRBuilderBPF::createCall(Value *callee,
- CallInst *IRBuilderBPF::CreateBpfPseudoCallId(int mapid)
- {
- Function *pseudo_func = module_.getFunction("llvm.bpf.pseudo");
-- return createCall(pseudo_func,
-+ return CreateCall(pseudo_func,
- { getInt64(BPF_PSEUDO_MAP_FD), getInt64(mapid) },
- "pseudo");
- }
-@@ -349,7 +348,8 @@ CallInst *IRBuilderBPF::createMapLookup(int mapid, Value *key)
- Instruction::IntToPtr,
- getInt64(libbpf::BPF_FUNC_map_lookup_elem),
- lookup_func_ptr_type);
-- return createCall(lookup_func, { map_ptr, key }, "lookup_elem");
-+ return createCall(
-+ lookup_func_type, lookup_func, { map_ptr, key }, "lookup_elem");
- }
-
- CallInst *IRBuilderBPF::CreateGetJoinMap(Value *ctx, const location &loc)
-@@ -400,8 +400,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx,
- CREATE_MEMCPY(value, call, type.GetSize(), 1);
- else
- {
-- assert(value->getType()->isPointerTy() &&
-- (value->getType()->getPointerElementType() == getInt64Ty()));
-+ assert(value->getAllocatedType() == getInt64Ty());
- // createMapLookup returns an u8*
- auto *cast = CreatePointerCast(call, value->getType(), "cast");
- CreateStore(CreateLoad(getInt64Ty(), cast), value);
-@@ -451,7 +450,8 @@ void IRBuilderBPF::CreateMapUpdateElem(Value *ctx,
- Instruction::IntToPtr,
- getInt64(libbpf::BPF_FUNC_map_update_elem),
- update_func_ptr_type);
-- CallInst *call = createCall(update_func,
-+ CallInst *call = createCall(update_func_type,
-+ update_func,
- { map_ptr, key, val, flags },
- "update_elem");
- CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_map_update_elem, loc);
-@@ -475,7 +475,8 @@ void IRBuilderBPF::CreateMapDeleteElem(Value *ctx,
- Instruction::IntToPtr,
- getInt64(libbpf::BPF_FUNC_map_delete_elem),
- delete_func_ptr_type);
-- CallInst *call = createCall(delete_func, { map_ptr, key }, "delete_elem");
-+ CallInst *call = createCall(
-+ delete_func_type, delete_func, { map_ptr, key }, "delete_elem");
- CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_map_delete_elem, loc);
- }
-
-@@ -501,72 +502,53 @@ void IRBuilderBPF::CreateProbeRead(Value *ctx,
- Constant *proberead_func = ConstantExpr::getCast(Instruction::IntToPtr,
- getInt64(read_fn),
- proberead_func_ptr_type);
-- CallInst *call = createCall(proberead_func,
-+ CallInst *call = createCall(proberead_func_type,
-+ proberead_func,
- { dst, size, src },
- probeReadHelperName(read_fn));
- CreateHelperErrorCond(ctx, call, read_fn, loc);
- }
-
--Constant *IRBuilderBPF::createProbeReadStrFn(llvm::Type *dst,
-- llvm::Type *src,
-- AddrSpace as)
--{
-- assert(src && (src->isIntegerTy() || src->isPointerTy()));
-- // int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
-- FunctionType *probereadstr_func_type = FunctionType::get(
-- getInt64Ty(), { dst, getInt32Ty(), src }, false);
-- PointerType *probereadstr_func_ptr_type = PointerType::get(
-- probereadstr_func_type, 0);
-- return ConstantExpr::getCast(Instruction::IntToPtr,
-- getInt64(selectProbeReadHelper(as, true)),
-- probereadstr_func_ptr_type);
--}
--
- CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
-- AllocaInst *dst,
-+ Value *dst,
- size_t size,
- Value *src,
- AddrSpace as,
- const location &loc)
- {
-- assert(ctx && ctx->getType() == getInt8PtrTy());
- return CreateProbeReadStr(ctx, dst, getInt32(size), src, as, loc);
- }
-
- CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
- Value *dst,
-- size_t size,
-- Value *src,
-- AddrSpace as,
-- const location &loc)
--{
-- assert(ctx && ctx->getType() == getInt8PtrTy());
-- Constant *fn = createProbeReadStrFn(dst->getType(), src->getType(), as);
-- auto read_fn = selectProbeReadHelper(as, true);
-- CallInst *call = createCall(fn,
-- { dst, getInt32(size), src },
-- probeReadHelperName(read_fn));
-- CreateHelperErrorCond(ctx, call, read_fn, loc);
-- return call;
--}
--
--CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
-- AllocaInst *dst,
- llvm::Value *size,
- Value *src,
- AddrSpace as,
- const location &loc)
- {
- assert(ctx && ctx->getType() == getInt8PtrTy());
-- assert(dst && dst->getAllocatedType()->isArrayTy() &&
-- dst->getAllocatedType()->getArrayElementType() == getInt8Ty());
- assert(size && size->getType()->isIntegerTy());
-+ if (auto *dst_alloca = dyn_cast<AllocaInst>(dst))
-+ {
-+ assert(dst_alloca->getAllocatedType()->isArrayTy() &&
-+ dst_alloca->getAllocatedType()->getArrayElementType() ==
-+ getInt8Ty());
-+ }
-
-- auto *size_i32 = CreateIntCast(size, getInt32Ty(), false);
-+ auto *size_i32 = size;
-+ if (size_i32->getType()->getScalarSizeInBits() != 32)
-+ size_i32 = CreateIntCast(size_i32, getInt32Ty(), false);
-
-- Constant *fn = createProbeReadStrFn(dst->getType(), src->getType(), as);
- auto read_fn = selectProbeReadHelper(as, true);
-- CallInst *call = createCall(fn,
-+ // int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
-+ FunctionType *probereadstr_func_type = FunctionType::get(
-+ getInt64Ty(), { dst->getType(), getInt32Ty(), src->getType() }, false);
-+ PointerType *probereadstr_func_ptr_type = PointerType::get(
-+ probereadstr_func_type, 0);
-+ Constant *probereadstr_callee = ConstantExpr::getCast(
-+ Instruction::IntToPtr, getInt64(read_fn), probereadstr_func_ptr_type);
-+ CallInst *call = createCall(probereadstr_func_type,
-+ probereadstr_callee,
- { dst, size_i32, src },
- probeReadHelperName(read_fn));
- CreateHelperErrorCond(ctx, call, read_fn, loc);
-@@ -725,8 +707,10 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx,
- return result;
- }
-
--Value *IRBuilderBPF::CreateStrncmp(Value *val1,
-- Value *val2,
-+Value *IRBuilderBPF::CreateStrncmp(Value *str1,
-+ uint64_t str1_size,
-+ Value *str2,
-+ uint64_t str2_size,
- uint64_t n,
- bool inverse)
- {
-@@ -755,40 +739,21 @@ Value *IRBuilderBPF::CreateStrncmp(Value *val1,
- // Check if the compared strings are literals.
- // If so, we can avoid storing the literal in memory.
- std::optional<std::string> literal1;
-- if (auto constString1 = dyn_cast<ConstantDataArray>(val1))
-+ if (auto constString1 = dyn_cast<ConstantDataArray>(str1))
- literal1 = constString1->getAsString();
-- else if (isa<ConstantAggregateZero>(val1))
-+ else if (isa<ConstantAggregateZero>(str1))
- literal1 = "";
- else
- literal1 = std::nullopt;
-
- std::optional<std::string> literal2;
-- if (auto constString2 = dyn_cast<ConstantDataArray>(val2))
-+ if (auto constString2 = dyn_cast<ConstantDataArray>(str2))
- literal2 = constString2->getAsString();
-- else if (isa<ConstantAggregateZero>(val2))
-+ else if (isa<ConstantAggregateZero>(str2))
- literal2 = "";
- else
- literal2 = std::nullopt;
-
-- auto *val1p = dyn_cast<PointerType>(val1->getType());
-- auto *val2p = dyn_cast<PointerType>(val2->getType());
--#ifndef NDEBUG
-- if (!literal1)
-- {
-- assert(val1p);
-- assert(val1p->getPointerElementType()->isArrayTy() &&
-- val1p->getPointerElementType()->getArrayElementType() ==
-- getInt8Ty());
-- }
-- if (!literal2)
-- {
-- assert(val2p);
-- assert(val2p->getPointerElementType()->isArrayTy() &&
-- val2p->getPointerElementType()->getArrayElementType() ==
-- getInt8Ty());
-- }
--#endif
--
- Function *parent = GetInsertBlock()->getParent();
- AllocaInst *store = CreateAllocaBPF(getInt1Ty(), "strcmp.result");
- BasicBlock *str_ne = BasicBlock::Create(module_.getContext(),
-@@ -815,8 +780,8 @@ Value *IRBuilderBPF::CreateStrncmp(Value *val1,
- l = getInt8(literal1->c_str()[i]);
- else
- {
-- auto *ptr_l = CreateGEP(val1p->getPointerElementType(),
-- val1,
-+ auto *ptr_l = CreateGEP(ArrayType::get(getInt8Ty(), str1_size),
-+ str1,
- { getInt32(0), getInt32(i) });
- l = CreateLoad(getInt8Ty(), ptr_l);
- }
-@@ -826,8 +791,8 @@ Value *IRBuilderBPF::CreateStrncmp(Value *val1,
- r = getInt8(literal2->c_str()[i]);
- else
- {
-- auto *ptr_r = CreateGEP(val2p->getPointerElementType(),
-- val2,
-+ auto *ptr_r = CreateGEP(ArrayType::get(getInt8Ty(), str2_size),
-+ str2,
- { getInt32(0), getInt32(i) });
- r = CreateLoad(getInt8Ty(), ptr_r);
- }
-@@ -987,11 +952,9 @@ void IRBuilderBPF::CreateGetCurrentComm(Value *ctx,
- size_t size,
- const location &loc)
- {
-- assert(buf->getType()->getPointerElementType()->isArrayTy() &&
-- buf->getType()->getPointerElementType()->getArrayNumElements() >=
-- size &&
-- buf->getType()->getPointerElementType()->getArrayElementType() ==
-- getInt8Ty());
-+ assert(buf->getAllocatedType()->isArrayTy() &&
-+ buf->getAllocatedType()->getArrayNumElements() >= size &&
-+ buf->getAllocatedType()->getArrayElementType() == getInt8Ty());
-
- // long bpf_get_current_comm(char *buf, int size_of_buf)
- // Return: 0 on success or negative error
-@@ -1070,7 +1033,7 @@ void IRBuilderBPF::CreateSignal(Value *ctx, Value *sig, const location &loc)
- Instruction::IntToPtr,
- getInt64(libbpf::BPF_FUNC_send_signal),
- signal_func_ptr_type);
-- CallInst *call = createCall(signal_func, { sig }, "signal");
-+ CallInst *call = createCall(signal_func_type, signal_func, { sig }, "signal");
- CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_send_signal, loc);
- }
-
-@@ -1084,7 +1047,7 @@ void IRBuilderBPF::CreateOverrideReturn(Value *ctx, Value *rc)
- Constant *override_func = ConstantExpr::getCast(Instruction::IntToPtr,
- getInt64(libbpf::BPF_FUNC_override_return),
- override_func_ptr_type);
-- createCall(override_func, { ctx, rc }, "override");
-+ createCall(override_func_type, override_func, { ctx, rc }, "override");
- }
-
- CallInst *IRBuilderBPF::CreateSkbOutput(Value *skb,
-@@ -1119,7 +1082,8 @@ CallInst *IRBuilderBPF::CreateSkbOutput(Value *skb,
- Instruction::IntToPtr,
- getInt64(libbpf::BPF_FUNC_skb_output),
- skb_output_func_ptr_type);
-- CallInst *call = createCall(skb_output_func,
-+ CallInst *call = createCall(skb_output_func_type,
-+ skb_output_func,
- { skb, map_ptr, flags, data, size_val },
- "skb_output");
- return call;
-@@ -1328,7 +1292,8 @@ void IRBuilderBPF::CreateSeqPrintf(Value *ctx,
- CreateGEP(getInt64Ty(), meta, getInt64(0)),
- "seq");
-
-- CallInst *call = createCall(seq_printf_func,
-+ CallInst *call = createCall(seq_printf_func_type,
-+ seq_printf_func,
- { seq, fmt, fmt_size, data, data_len },
- "seq_printf");
- CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_seq_printf, loc);
-diff --git a/src/ast/irbuilderbpf.h b/src/ast/irbuilderbpf.h
-index b6a06778..19b28180 100644
---- a/src/ast/irbuilderbpf.h
-+++ b/src/ast/irbuilderbpf.h
-@@ -106,17 +106,11 @@ public:
- bool isVolatile = false,
- std::optional<AddrSpace> addrSpace = std::nullopt);
- CallInst *CreateProbeReadStr(Value *ctx,
-- AllocaInst *dst,
-+ Value *dst,
- llvm::Value *size,
- Value *src,
- AddrSpace as,
- const location &loc);
-- CallInst *CreateProbeReadStr(Value *ctx,
-- AllocaInst *dst,
-- size_t size,
-- Value *src,
-- AddrSpace as,
-- const location &loc);
- CallInst *CreateProbeReadStr(Value *ctx,
- Value *dst,
- size_t size,
-@@ -131,7 +125,12 @@ public:
- pid_t pid,
- AddrSpace as,
- const location &loc);
-- Value *CreateStrncmp(Value *val1, Value *val2, uint64_t n, bool inverse);
-+ Value *CreateStrncmp(Value *str1,
-+ uint64_t str1_size,
-+ Value *str2,
-+ uint64_t str2_size,
-+ uint64_t n,
-+ bool inverse);
- CallInst *CreateGetNs(bool boot_time, const location &loc);
- CallInst *CreateGetPidTgid(const location &loc);
- CallInst *CreateGetCurrentCgroupId(const location &loc);
-@@ -147,7 +146,10 @@ public:
- ArrayRef<Value *> args,
- const Twine &Name,
- const location *loc = nullptr);
-- CallInst *createCall(Value *callee, ArrayRef<Value *> args, const Twine &Name);
-+ CallInst *createCall(FunctionType *callee_type,
-+ Value *callee,
-+ ArrayRef<Value *> args,
-+ const Twine &Name);
- void CreateGetCurrentComm(Value *ctx, AllocaInst *buf, size_t size, const location& loc);
- void CreatePerfEventOutput(Value *ctx,
- Value *data,
-@@ -205,9 +207,6 @@ private:
- AddrSpace as,
- const location &loc);
- CallInst *createMapLookup(int mapid, Value *key);
-- Constant *createProbeReadStrFn(llvm::Type *dst,
-- llvm::Type *src,
-- AddrSpace as);
- libbpf::bpf_func_id selectProbeReadHelper(AddrSpace as, bool str);
-
- llvm::Type *getKernelPointerStorageTy();
-diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
-index d4a5e1c7..0703d196 100644
---- a/src/ast/passes/codegen_llvm.cpp
-+++ b/src/ast/passes/codegen_llvm.cpp
-@@ -1152,8 +1152,12 @@ void CodegenLLVM::visit(Call &call)
- auto left_string = getString(left_arg);
- auto right_string = getString(right_arg);
-
-- expr_ = b_.CreateStrncmp(
-- left_string.first, right_string.first, size, false);
-+ expr_ = b_.CreateStrncmp(left_string.first,
-+ left_string.second,
-+ right_string.first,
-+ right_string.second,
-+ size,
-+ false);
- }
- else if (call.func == "override")
- {
-@@ -1284,8 +1288,7 @@ void CodegenLLVM::visit(Variable &var)
- else
- {
- auto *var_alloca = variables_[var.ident];
-- expr_ = b_.CreateLoad(var_alloca->getType()->getPointerElementType(),
-- var_alloca);
-+ expr_ = b_.CreateLoad(var_alloca->getAllocatedType(), var_alloca);
- }
- }
-
-@@ -1325,7 +1328,12 @@ void CodegenLLVM::binop_string(Binop &binop)
- auto right_string = getString(binop.right);
-
- size_t len = std::min(left_string.second, right_string.second);
-- expr_ = b_.CreateStrncmp(left_string.first, right_string.first, len, inverse);
-+ expr_ = b_.CreateStrncmp(left_string.first,
-+ left_string.second,
-+ right_string.first,
-+ right_string.second,
-+ len,
-+ inverse);
- }
-
- void CodegenLLVM::binop_buf(Binop &binop)
-@@ -1349,7 +1357,12 @@ void CodegenLLVM::binop_buf(Binop &binop)
-
- size_t len = std::min(binop.left->type.GetSize(),
- binop.right->type.GetSize());
-- expr_ = b_.CreateStrncmp(left_string, right_string, len, inverse);
-+ expr_ = b_.CreateStrncmp(left_string,
-+ binop.left->type.GetSize(),
-+ right_string,
-+ binop.right->type.GetSize(),
-+ len,
-+ inverse);
- }
-
- void CodegenLLVM::binop_int(Binop &binop)
-@@ -3498,9 +3511,8 @@ void CodegenLLVM::createIncDec(Unop &unop)
- else if (unop.expr->is_variable)
- {
- Variable &var = static_cast<Variable &>(*unop.expr);
-- Value *oldval = b_.CreateLoad(
-- variables_[var.ident]->getType()->getPointerElementType(),
-- variables_[var.ident]);
-+ Value *oldval = b_.CreateLoad(variables_[var.ident]->getAllocatedType(),
-+ variables_[var.ident]);
- Value *newval;
- if (is_increment)
- newval = b_.CreateAdd(oldval, b_.GetIntSameSize(step, oldval));
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2023-05-15 19:34 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2023-05-15 19:34 UTC (permalink / raw
To: gentoo-commits
commit: 3ff866987e32681f18e027f581eaa70c03038101
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Mon May 15 19:05:00 2023 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Mon May 15 19:34:23 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ff86698
dev-util/bpftrace: add 0.18.0
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 3 +-
dev-util/bpftrace/bpftrace-0.18.0.ebuild | 95 ++++++
.../files/bpftrace-0.18.0-install-libs.patch | 329 +++++++++++++++++++++
3 files changed, 425 insertions(+), 2 deletions(-)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 869576973dc0..132e185ee5e1 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,3 +1,2 @@
-DIST bpftrace-0.16.0.gh.tar.gz 1023480 BLAKE2B 20fa877adeaada655462004142a80f107f82a3fa73fd7a7675a477d45ecd3a28115af5d612da2b06e2d760cfa3e574583e4cc4d62f4175c49ecc9d9b3fcceb6e SHA512 52ca4fea4e2f8d2cbf0f9f1bc69af0ee3408201f019006dd2e838b9458cfc01761eba3df24c39e05cf93220d85d0cecc69bb44ec72f9f44cec0eb94479bff734
-DIST bpftrace-0.17.0.gh.tar.gz 1033934 BLAKE2B 960582096fcf1652a65c4f8e18dcc5e17792c3b5c048dff59465fc1fc43d39e033c06ebc5c9bc88310b429a81fac5a8cfcdc261e7f0dcdcba4823b518f74fa3e SHA512 b1c8fc81b23f38bc45b4e73edd29c4cd0775e703b368612f00902fbda39dc3758038cd7afa351c1711cec467efd2a199a6b8b933b03aebd591d230d533e190d3
DIST bpftrace-0.17.1.gh.tar.gz 1035345 BLAKE2B 5dca6f3fc49458b4b2ed3068e3f99f1156067c430af36b53949e469a870101d2da6aba6c4d18bfaf173cc45eab18e3c316966a5e222a4b4cea98363a9afd90ce SHA512 57f00a0b209d745efe5ce39d0e8efb90a21b5c499b41385814378d828ef507dc2c6d9497f9d23dbb610fcff21f077cba9f7481e7a6a6465825065743289ef4ad
+DIST bpftrace-0.18.0.gh.tar.gz 1046210 BLAKE2B 921fdd56cff48e7b8fc2b8164839393f2759218accaa58412fdf80b2df4474067c3c660da09e3ee808d258c1f19b0534fa81462cbea5ce3e814bdbeaa7dce5aa SHA512 b7da273d251f03a81b3a7097407352e7ad1d023972852bdb883176e97bab7046f9f327bd03bca51fe853ecaab5f60adc6994e75cb450a033a5b91118f719c36d
diff --git a/dev-util/bpftrace/bpftrace-0.18.0.ebuild b/dev-util/bpftrace/bpftrace-0.18.0.ebuild
new file mode 100644
index 000000000000..b71d49f48399
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.18.0.ebuild
@@ -0,0 +1,95 @@
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_MAX_SLOT=16
+
+inherit llvm linux-info cmake
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+MY_PV="${PV//_/}"
+SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+
+# remove keywords until build works:
+# https://github.com/iovisor/bpftrace/issues/2349
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="fuzzing test"
+
+# lots of fixing needed
+RESTRICT="test"
+
+RDEPEND="
+ >=dev-libs/libbpf-1.1:=
+ >=dev-util/bcc-0.25.0:=
+ >=sys-devel/llvm-10[llvm_targets_BPF(+)]
+ >=sys-devel/clang-10
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
+ <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
+ sys-libs/binutils-libs:=
+ virtual/libelf:=
+"
+DEPEND="
+ ${COMMON_DEPEND}
+ dev-libs/cereal:=
+ test? ( dev-cpp/gtest )
+"
+BDEPEND="
+ app-arch/xz-utils
+ sys-devel/flex
+ sys-devel/bison
+ virtual/pkgconfig
+"
+
+QA_DT_NEEDED="
+ /usr/lib.*/libbpftraceresources.so
+ /usr/lib.*/libcxxdemangler_llvm.so
+"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.18.0-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+)
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ # bug 809362, 754648
+ -DBUILD_TESTING:BOOL=$(usex test)
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ -DENABLE_MAN:BOOL=OFF
+ -DUSE_SYSTEM_BPF_BCC:BOOL=ON
+ )
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # bug 809362
+ dostrip -x /usr/bin/bpftrace
+ doman man/man8/*.?
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.18.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.18.0-install-libs.patch
new file mode 100644
index 000000000000..17a07bc6ea02
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.18.0-install-libs.patch
@@ -0,0 +1,329 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4c573207..ab376c3e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -135,9 +135,10 @@ endif()
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index a95c60a1..f5c4d676 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 708c8bf3..7be92f63 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -13,7 +13,7 @@ else()
+ endif ()
+ endif()
+
+-add_library(runtime
++add_library(bpftraceruntime
+ attached_probe.cpp
+ bpffeature.cpp
+ bpftrace.cpp
+@@ -44,7 +44,7 @@ add_library(runtime
+ ${BFD_DISASM_SRC}
+ )
+ # Ensure flex+bison outputs are built first
+-add_dependencies(runtime parser)
++add_dependencies(bpftraceruntime bpftraceparser)
+
+ add_library(libbpftrace
+ build_info.cpp
+@@ -61,6 +61,7 @@ add_executable(${BPFTRACE}
+ )
+
+ install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_link_libraries(${BPFTRACE} libbpftrace)
+
+ if (BUILD_FUZZ)
+@@ -89,7 +90,7 @@ endif()
+ set(KERNEL_HEADERS_DIR "" CACHE PATH "Hard-code kernel headers directory")
+ if (KERNEL_HEADERS_DIR)
+ MESSAGE(STATUS "Using KERNEL_HEADERS_DIR=${KERNEL_HEADERS_DIR}")
+- target_compile_definitions(runtime PUBLIC KERNEL_HEADERS_DIR="${KERNEL_HEADERS_DIR}")
++ target_compile_definitions(bpftraceruntime PUBLIC KERNEL_HEADERS_DIR="${KERNEL_HEADERS_DIR}")
+ endif()
+
+ execute_process(
+@@ -109,10 +110,11 @@ endif()
+
+ add_definitions("-DBPFTRACE_VERSION=\"${BPFTRACE_VERSION}\"")
+
+-target_include_directories(runtime PRIVATE ${CMAKE_BINARY_DIR})
+-target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src)
+-target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src/ast)
+-target_compile_definitions(runtime PRIVATE ${BPFTRACE_FLAGS})
++target_include_directories(bpftraceruntime PRIVATE ${CMAKE_BINARY_DIR})
++target_include_directories(bpftraceruntime PRIVATE ${CMAKE_SOURCE_DIR}/src)
++target_include_directories(bpftraceruntime PRIVATE ${CMAKE_SOURCE_DIR}/src/ast)
++target_compile_definitions(bpftraceruntime PRIVATE ${BPFTRACE_FLAGS})
++install(TARGETS bpftraceruntime LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_compile_definitions(libbpftrace PRIVATE ${BPFTRACE_FLAGS})
+
+ # Linking
+@@ -125,8 +127,8 @@ if(STATIC_LINKING)
+ endif(STATIC_LINKING)
+
+
+-target_link_libraries(runtime ${LIBBPF_LIBRARIES})
+-target_link_libraries(libbpftrace parser resources runtime aot ast arch cxxdemangler_llvm)
++target_link_libraries(bpftraceruntime ${LIBBPF_LIBRARIES})
++target_link_libraries(libbpftrace bpftraceparser bpftraceresources bpftraceruntime aot bpftraceast bpftracearch cxxdemangler_llvm)
+
+ if(LIBPCAP_FOUND)
+ target_link_libraries(libbpftrace ${LIBPCAP_LIBRARIES})
+@@ -136,37 +138,38 @@ if(HAVE_BFD_DISASM)
+ if(STATIC_LINKING)
+ add_library(LIBBFD STATIC IMPORTED)
+ set_property(TARGET LIBBFD PROPERTY IMPORTED_LOCATION ${LIBBFD_LIBRARIES})
+- target_link_libraries(runtime LIBBFD)
++ target_link_libraries(bpftraceruntime LIBBFD)
+ add_library(LIBOPCODES STATIC IMPORTED)
+ set_property(TARGET LIBOPCODES PROPERTY IMPORTED_LOCATION ${LIBOPCODES_LIBRARIES})
+- target_link_libraries(runtime LIBOPCODES)
++ target_link_libraries(bpftraceruntime LIBOPCODES)
+ add_library(LIBIBERTY STATIC IMPORTED)
+ set_property(TARGET LIBIBERTY PROPERTY IMPORTED_LOCATION ${LIBIBERTY_LIBRARIES})
+- target_link_libraries(runtime LIBIBERTY)
++ target_link_libraries(bpftraceruntime LIBIBERTY)
+ else()
+- target_link_libraries(runtime ${LIBBFD_LIBRARIES})
+- target_link_libraries(runtime ${LIBOPCODES_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBFD_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBOPCODES_LIBRARIES})
+ endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
+
+ # Link to bcc libraries (without LLVM) if possible
+ if(LIBBCC_BPF_CONTAINS_RUNTIME)
+- target_link_libraries(runtime ${LIBBCC_BPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBCC_BPF_LIBRARIES})
+ else()
+- target_link_libraries(runtime ${LIBBCC_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBCC_LIBRARIES})
+ endif()
+
+ if(STATIC_BPF_BCC)
+ # These are not part of the static libbcc so have to be added separate
+- target_link_libraries(runtime ${LIBBCC_BPF_LIBRARIES})
+- target_link_libraries(runtime ${LIBBPF_LIBRARIES})
+- target_link_libraries(runtime ${LIBBCC_LOADER_LIBRARY_STATIC})
++ target_link_libraries(bpftraceruntime ${LIBBCC_BPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBBCC_LOADER_LIBRARY_STATIC})
+
+ add_library(LIBELF STATIC IMPORTED)
+ set_property(TARGET LIBELF PROPERTY IMPORTED_LOCATION ${LIBELF_LIBRARIES})
+- target_link_libraries(runtime LIBELF)
++ set_property(TARGET LIBELF PROPERTY IMPORTED_LOCATION ${LIBBPF_LIBRARIES})
++ target_link_libraries(bpftraceruntime LIBELF)
+ else()
+- target_link_libraries(runtime ${LIBELF_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBELF_LIBRARIES})
+ endif(STATIC_BPF_BCC)
+
+ if (LIBDW_FOUND)
+@@ -195,16 +198,16 @@ if (LIBDW_FOUND)
+
+ target_link_libraries(LIBDW INTERFACE ${LIBDW_LIBS})
+
+- target_link_libraries(runtime LIBDW)
++ target_link_libraries(bpftraceruntime LIBDW)
+ else()
+- target_link_libraries(runtime ${LIBDW_LIBRARIES})
++ target_link_libraries(bpftraceruntime ${LIBDW_LIBRARIES})
+ endif()
+ endif()
+
+ # Support for std::filesystem
+ # GCC version <9 and Clang (all versions) require -lstdc++fs
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9")
+- target_link_libraries(runtime "stdc++fs")
++ target_link_libraries(bpftraceruntime "stdc++fs")
+ target_link_libraries(libbpftrace "stdc++fs")
+ endif()
+
+@@ -226,16 +229,16 @@ endif()
+ if (STATIC_LINKING)
+ if(ANDROID)
+ target_link_libraries(libbpftrace "-Wl,-Bdynamic" "-ldl" "-lm" "-lz")
+- target_link_libraries(runtime "-Wl,-Bdynamic" "-ldl" "-lm" "-lz")
++ target_link_libraries(bpftraceruntime "-Wl,-Bdynamic" "-ldl" "-lm" "-lz")
+ else()
+ target_link_libraries(libbpftrace "-Wl,-Bdynamic" "-lrt" "-lpthread" "-ldl" "-lm")
+ target_link_libraries(libbpftrace "-Wl,-Bstatic" "-lz")
+- target_link_libraries(runtime "-Wl,-Bdynamic" "-lrt" "-lpthread" "-ldl" "-lm")
+- target_link_libraries(runtime "-Wl,-Bstatic" "-lz")
++ target_link_libraries(bpftraceruntime "-Wl,-Bdynamic" "-lrt" "-lpthread" "-ldl" "-lm")
++ target_link_libraries(bpftraceruntime "-Wl,-Bstatic" "-lz")
+ endif()
+ elseif(STATIC_BPF_BCC)
+ # partial static build, libbpf needs zlib, bcc needs liblzma
+- target_link_libraries(runtime "-lz" "-llzma")
++ target_link_libraries(bpftraceruntime "-lz" "-llzma")
+ endif()
+
+ unset(MAIN_SRC)
+diff --git a/src/aot/CMakeLists.txt b/src/aot/CMakeLists.txt
+index c776d204..41e84317 100644
+--- a/src/aot/CMakeLists.txt
++++ b/src/aot/CMakeLists.txt
+@@ -1,8 +1,9 @@
+ add_library(aot aot.cpp)
+-add_dependencies(aot parser)
++add_dependencies(aot bpftraceparser)
+ target_include_directories(aot PUBLIC ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(aot PUBLIC ${CMAKE_BINARY_DIR})
+ target_compile_definitions(aot PRIVATE ${BPFTRACE_FLAGS})
++install(TARGETS aot LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ # Only build aotrt if supported bcc is used
+ # (https://github.com/iovisor/bcc/commit/719191867a25ce07dc96f7faf9b8ccedadc7ec44)
+@@ -11,7 +12,7 @@ if(NOT LIBBCC_BPF_CONTAINS_RUNTIME)
+ endif()
+
+ add_executable(bpftrace-aotrt aot_main.cpp)
+-target_link_libraries(bpftrace-aotrt aot runtime arch ast_defs cxxdemangler_stdlib)
++target_link_libraries(bpftrace-aotrt aot bpftraceruntime bpftracearch ast_defs cxxdemangler_stdlib)
+ install(TARGETS bpftrace-aotrt DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(LIBPCAP_FOUND)
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index d01d1ea3..82bfeccc 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,21 +1,23 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
+- add_library(arch arm.cpp)
++ add_library(bpftracearch arm.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
+- add_library(arch s390.cpp)
++ add_library(bpftracearch s390.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
+- add_library(arch mips64.cpp)
++ add_library(bpftracearch mips64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
+- add_library(arch riscv64.cpp)
++ add_library(bpftracearch riscv64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "loongarch64")
+- add_library(arch loongarch64.cpp)
++ add_library(bpftracearch loongarch64.cpp)
+ else()
+ message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
++
++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index c390ea6a..37019bd9 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ add_library(ast_defs ast.cpp)
+
+-add_library(ast
++add_library(bpftraceast
+ async_event_types.cpp
+ attachpoint_parser.cpp
+ elf_parser.cpp
+@@ -21,11 +21,13 @@ add_library(ast
+ target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+ target_include_directories(ast_defs PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast ast_defs arch parser)
++target_link_libraries(bpftraceast ast_defs bpftracearch bpftraceparser)
++install(TARGETS ast_defs LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+-add_dependencies(ast_defs parser)
++add_dependencies(ast_defs bpftraceparser)
+
+-target_compile_definitions(ast PRIVATE ${BPFTRACE_FLAGS})
++target_compile_definitions(bpftraceast PRIVATE ${BPFTRACE_FLAGS})
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -58,20 +60,20 @@ if (STATIC_LINKING)
+
+
+ if(EMBED_USE_LLVM)
+- target_link_libraries(ast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
++ target_link_libraries(bpftraceast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
+ else()
+ llvm_map_components_to_libnames(llvm_libs ${llvm_lib_names})
+
+ if(TARGET libclang_static)
+- target_link_libraries(ast libclang_static)
++ target_link_libraries(bpftraceast libclang_static)
+ else()
+ # old LLVM versions don't export libclang_static in ClangTargets.cmake; fall back to
+ # libclang.a in that case
+- target_link_libraries(ast libclang.a)
++ target_link_libraries(abpftracest libclang.a)
+ endif()
+
+- target_link_libraries(ast ${clang_libs})
+- target_link_libraries(ast ${llvm_libs})
++ target_link_libraries(abpftracest ${clang_libs})
++ target_link_libraries(abpftracest ${llvm_libs})
+ endif()
+
+ if(STATIC_LIBC)
+@@ -81,11 +83,11 @@ if (STATIC_LINKING)
+ else()
+ find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+ if(found_LLVM)
+- target_link_libraries(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
+diff --git a/src/cxxdemangler/CMakeLists.txt b/src/cxxdemangler/CMakeLists.txt
+index 04cfcdd9..5677aa4b 100644
+--- a/src/cxxdemangler/CMakeLists.txt
++++ b/src/cxxdemangler/CMakeLists.txt
+@@ -1,2 +1,4 @@
+ add_library(cxxdemangler_stdlib cxxdemangler_stdlib.cpp)
+ add_library(cxxdemangler_llvm cxxdemangler_llvm.cpp)
++install(TARGETS cxxdemangler_stdlib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS cxxdemangler_llvm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2023-03-19 17:34 Michał Górny
0 siblings, 0 replies; 22+ messages in thread
From: Michał Górny @ 2023-03-19 17:34 UTC (permalink / raw
To: gentoo-commits
commit: 25470c4c3bcdad4ae67fbe3a65b21682fe0fe670
Author: Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Sun Mar 19 12:40:51 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar 19 17:34:31 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25470c4c
dev-util/bpftrace: fixes for llvm-16
Closes: https://bugs.gentoo.org/902135
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/30234
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
...-0.17.0-r2.ebuild => bpftrace-0.17.0-r3.ebuild} | 2 +
.../bpftrace/files/bpftrace-0.17.0-llvm-16.patch | 26 +++++++++++++
.../files/bpftrace-0.17.0-use-std-optional.patch | 44 ++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild b/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
similarity index 94%
rename from dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild
rename to dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
index f976f34e8416..161c441420f7 100644
--- a/dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
@@ -55,6 +55,8 @@ PATCHES=(
"${FILESDIR}/bpftrace-0.17.0-install-libs.patch"
"${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
"${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+ "${FILESDIR}/bpftrace-0.17.0-llvm-16.patch"
+ "${FILESDIR}/bpftrace-0.17.0-use-std-optional.patch"
)
pkg_pretend() {
diff --git a/dev-util/bpftrace/files/bpftrace-0.17.0-llvm-16.patch b/dev-util/bpftrace/files/bpftrace-0.17.0-llvm-16.patch
new file mode 100644
index 000000000000..5d845c134bea
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.17.0-llvm-16.patch
@@ -0,0 +1,26 @@
+
+From: https://github.com/iovisor/bpftrace/pull/2528
+
+From a91064d7fb26626d79719c2e2a13cc2acab9549a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0a7914f580d..341ac7e9c1f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -165,7 +165,7 @@ else()
+ endif()
+
+ set(MIN_LLVM_MAJOR 6)
+- set(MAX_LLVM_MAJOR 15)
++ set(MAX_LLVM_MAJOR 16)
+
+ if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+ message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
diff --git a/dev-util/bpftrace/files/bpftrace-0.17.0-use-std-optional.patch b/dev-util/bpftrace/files/bpftrace-0.17.0-use-std-optional.patch
new file mode 100644
index 000000000000..21b4b7e6c267
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.17.0-use-std-optional.patch
@@ -0,0 +1,44 @@
+
+From: https://github.com/iovisor/bpftrace/pull/2525
+
+From a794397394aa836f776da17c8e08876a2f64d477 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+ throw std::runtime_error(
+ "Could not find bpf llvm target, does your llvm support it?");
+
+- target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+- "generic",
+- "",
+- TargetOptions(),
+- Optional<Reloc::Model>()));
++ target_machine_.reset(
++ target->createTargetMachine(LLVMTargetTriple,
++ "generic",
++ "",
++ TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++ std::optional<Reloc::Model>()
++#else
++ Optional<Reloc::Model>()
++#endif
++ ));
+ target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+
+ module_->setTargetTriple(LLVMTargetTriple);
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2023-02-06 2:04 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2023-02-06 2:04 UTC (permalink / raw
To: gentoo-commits
commit: c769d53008070e3795d5999bc5732f2d966e01c7
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 6 02:03:48 2023 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Mon Feb 6 02:03:48 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c769d530
dev-util/bpftrace: revbump to 0.17.0-r2 Install bpstracearch (bug #893122)
Closes: https://bugs.gentoo.org/893122
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
.../{bpftrace-0.17.0-r1.ebuild => bpftrace-0.17.0-r2.ebuild} | 0
dev-util/bpftrace/files/bpftrace-0.17.0-install-libs.patch | 6 ++++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dev-util/bpftrace/bpftrace-0.17.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild
similarity index 100%
rename from dev-util/bpftrace/bpftrace-0.17.0-r1.ebuild
rename to dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild
diff --git a/dev-util/bpftrace/files/bpftrace-0.17.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.17.0-install-libs.patch
index a884acc7ef28..7c14f8f9416e 100644
--- a/dev-util/bpftrace/files/bpftrace-0.17.0-install-libs.patch
+++ b/dev-util/bpftrace/files/bpftrace-0.17.0-install-libs.patch
@@ -213,10 +213,10 @@ index c776d204..41e84317 100644
if(LIBPCAP_FOUND)
diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
-index d01d1ea3..7d96587f 100644
+index d01d1ea3..82bfeccc 100644
--- a/src/arch/CMakeLists.txt
+++ b/src/arch/CMakeLists.txt
-@@ -1,21 +1,21 @@
+@@ -1,21 +1,23 @@
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
- add_library(arch aarch64.cpp)
+ add_library(bpftracearch aarch64.cpp)
@@ -246,6 +246,8 @@ index d01d1ea3..7d96587f 100644
else()
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
++
++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
index c390ea6a..37019bd9 100644
--- a/src/ast/CMakeLists.txt
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2023-01-26 18:57 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2023-01-26 18:57 UTC (permalink / raw
To: gentoo-commits
commit: 1d68a256d8d1ee428ce51403bb5d2b443ad29a19
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 26 18:56:42 2023 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 18:56:42 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d68a256
dev-util/bpftrace: Pull in OpaquePointer fix for 0.16 (bug #890672)
Closes: https://bugs.gentoo.org/890672
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild | 93 +++++
.../files/bpftrace-0.16.0-opaquepointer.patch | 450 +++++++++++++++++++++
2 files changed, 543 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild b/dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild
new file mode 100644
index 000000000000..dca9044e1ff0
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.16.0-r2.ebuild
@@ -0,0 +1,93 @@
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_MAX_SLOT=16
+
+inherit llvm linux-info cmake
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+MY_PV="${PV//_/}"
+SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+
+# remove keywords until build works:
+# https://github.com/iovisor/bpftrace/issues/2349
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="fuzzing test"
+
+# lots of fixing needed
+RESTRICT="test"
+
+RDEPEND="
+ >=dev-libs/libbpf-1.0:=
+ >=dev-util/bcc-0.25.0:=
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
+ <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
+ sys-libs/binutils-libs:=
+ virtual/libelf:=
+"
+DEPEND="
+ ${COMMON_DEPEND}
+ dev-libs/cereal:=
+ test? ( dev-cpp/gtest )
+"
+BDEPEND="
+ app-arch/xz-utils
+ sys-devel/flex
+ sys-devel/bison
+ virtual/pkgconfig
+"
+
+QA_DT_NEEDED="
+ /usr/lib.*/libbpftraceresources.so
+ /usr/lib.*/libcxxdemangler_llvm.so
+"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.16.0-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+ "${FILESDIR}/bpftrace-0.16.0-opaquepointer.patch"
+)
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ # bug 809362, 754648
+ -DBUILD_TESTING:BOOL=$(usex test)
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ -DENABLE_MAN:BOOL=OFF
+ )
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # bug 809362
+ dostrip -x /usr/bin/bpftrace
+ doman man/man8/*.?
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.16.0-opaquepointer.patch b/dev-util/bpftrace/files/bpftrace-0.16.0-opaquepointer.patch
new file mode 100644
index 000000000000..656bf0f6a639
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.16.0-opaquepointer.patch
@@ -0,0 +1,450 @@
+commit a8665b2ef3199e82fd2ad076c1f07f1af2ec9272
+Author: Viktor Malik <viktor.malik@gmail.com>
+Date: Mon Oct 10 14:26:38 2022 +0200
+
+ IR builder: get rid of getPointerElementType calls
+
+ Usage of Value::getPointerElementType is deprecated and will be dropped
+ in LLVM 16 [1].
+
+ There are several places where we use this method:
+ - function (value) calls - the called function type is usually
+ available, so just pass it to createCall, the only exception is
+ CreateProbeReadStr which must have been refactored
+ - getting the type of alloca instruction - there is a dedicated
+ AllocaInst::getAllocatedType method that can be used instead
+ - strncmp - pass sizes of the strings to CreateStrncmp to be able to get
+ the correct string type (which is array of uint8)
+
+ [1] https://llvm.org/docs/OpaquePointers.html
+
+diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
+index 09ae1c5e..da120ba1 100644
+--- a/src/ast/irbuilderbpf.cpp
++++ b/src/ast/irbuilderbpf.cpp
+@@ -291,17 +291,16 @@ CallInst *IRBuilderBPF::CreateHelperCall(libbpf::bpf_func_id func_id,
+ Constant *helper_func = ConstantExpr::getCast(Instruction::IntToPtr,
+ getInt64(func_id),
+ helper_ptr_type);
+- return createCall(helper_func, args, Name);
++ return createCall(helper_type, helper_func, args, Name);
+ }
+
+-CallInst *IRBuilderBPF::createCall(Value *callee,
++CallInst *IRBuilderBPF::createCall(FunctionType *callee_type,
++ Value *callee,
+ ArrayRef<Value *> args,
+ const Twine &Name)
+ {
+ #if LLVM_VERSION_MAJOR >= 11
+- auto *calleePtrType = cast<PointerType>(callee->getType());
+- auto *calleeType = cast<FunctionType>(calleePtrType->getPointerElementType());
+- return CreateCall(calleeType, callee, args, Name);
++ return CreateCall(callee_type, callee, args, Name);
+ #else
+ return CreateCall(callee, args, Name);
+ #endif
+@@ -310,7 +309,7 @@ CallInst *IRBuilderBPF::createCall(Value *callee,
+ CallInst *IRBuilderBPF::CreateBpfPseudoCallId(int mapid)
+ {
+ Function *pseudo_func = module_.getFunction("llvm.bpf.pseudo");
+- return createCall(pseudo_func,
++ return CreateCall(pseudo_func,
+ { getInt64(BPF_PSEUDO_MAP_FD), getInt64(mapid) },
+ "pseudo");
+ }
+@@ -349,7 +348,8 @@ CallInst *IRBuilderBPF::createMapLookup(int mapid, Value *key)
+ Instruction::IntToPtr,
+ getInt64(libbpf::BPF_FUNC_map_lookup_elem),
+ lookup_func_ptr_type);
+- return createCall(lookup_func, { map_ptr, key }, "lookup_elem");
++ return createCall(
++ lookup_func_type, lookup_func, { map_ptr, key }, "lookup_elem");
+ }
+
+ CallInst *IRBuilderBPF::CreateGetJoinMap(Value *ctx, const location &loc)
+@@ -400,8 +400,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx,
+ CREATE_MEMCPY(value, call, type.GetSize(), 1);
+ else
+ {
+- assert(value->getType()->isPointerTy() &&
+- (value->getType()->getPointerElementType() == getInt64Ty()));
++ assert(value->getAllocatedType() == getInt64Ty());
+ // createMapLookup returns an u8*
+ auto *cast = CreatePointerCast(call, value->getType(), "cast");
+ CreateStore(CreateLoad(getInt64Ty(), cast), value);
+@@ -451,7 +450,8 @@ void IRBuilderBPF::CreateMapUpdateElem(Value *ctx,
+ Instruction::IntToPtr,
+ getInt64(libbpf::BPF_FUNC_map_update_elem),
+ update_func_ptr_type);
+- CallInst *call = createCall(update_func,
++ CallInst *call = createCall(update_func_type,
++ update_func,
+ { map_ptr, key, val, flags },
+ "update_elem");
+ CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_map_update_elem, loc);
+@@ -475,7 +475,8 @@ void IRBuilderBPF::CreateMapDeleteElem(Value *ctx,
+ Instruction::IntToPtr,
+ getInt64(libbpf::BPF_FUNC_map_delete_elem),
+ delete_func_ptr_type);
+- CallInst *call = createCall(delete_func, { map_ptr, key }, "delete_elem");
++ CallInst *call = createCall(
++ delete_func_type, delete_func, { map_ptr, key }, "delete_elem");
+ CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_map_delete_elem, loc);
+ }
+
+@@ -501,72 +502,53 @@ void IRBuilderBPF::CreateProbeRead(Value *ctx,
+ Constant *proberead_func = ConstantExpr::getCast(Instruction::IntToPtr,
+ getInt64(read_fn),
+ proberead_func_ptr_type);
+- CallInst *call = createCall(proberead_func,
++ CallInst *call = createCall(proberead_func_type,
++ proberead_func,
+ { dst, size, src },
+ probeReadHelperName(read_fn));
+ CreateHelperErrorCond(ctx, call, read_fn, loc);
+ }
+
+-Constant *IRBuilderBPF::createProbeReadStrFn(llvm::Type *dst,
+- llvm::Type *src,
+- AddrSpace as)
+-{
+- assert(src && (src->isIntegerTy() || src->isPointerTy()));
+- // int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
+- FunctionType *probereadstr_func_type = FunctionType::get(
+- getInt64Ty(), { dst, getInt32Ty(), src }, false);
+- PointerType *probereadstr_func_ptr_type = PointerType::get(
+- probereadstr_func_type, 0);
+- return ConstantExpr::getCast(Instruction::IntToPtr,
+- getInt64(selectProbeReadHelper(as, true)),
+- probereadstr_func_ptr_type);
+-}
+-
+ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
+- AllocaInst *dst,
++ Value *dst,
+ size_t size,
+ Value *src,
+ AddrSpace as,
+ const location &loc)
+ {
+- assert(ctx && ctx->getType() == getInt8PtrTy());
+ return CreateProbeReadStr(ctx, dst, getInt32(size), src, as, loc);
+ }
+
+ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
+ Value *dst,
+- size_t size,
+- Value *src,
+- AddrSpace as,
+- const location &loc)
+-{
+- assert(ctx && ctx->getType() == getInt8PtrTy());
+- Constant *fn = createProbeReadStrFn(dst->getType(), src->getType(), as);
+- auto read_fn = selectProbeReadHelper(as, true);
+- CallInst *call = createCall(fn,
+- { dst, getInt32(size), src },
+- probeReadHelperName(read_fn));
+- CreateHelperErrorCond(ctx, call, read_fn, loc);
+- return call;
+-}
+-
+-CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
+- AllocaInst *dst,
+ llvm::Value *size,
+ Value *src,
+ AddrSpace as,
+ const location &loc)
+ {
+ assert(ctx && ctx->getType() == getInt8PtrTy());
+- assert(dst && dst->getAllocatedType()->isArrayTy() &&
+- dst->getAllocatedType()->getArrayElementType() == getInt8Ty());
+ assert(size && size->getType()->isIntegerTy());
++ if (auto *dst_alloca = dyn_cast<AllocaInst>(dst))
++ {
++ assert(dst_alloca->getAllocatedType()->isArrayTy() &&
++ dst_alloca->getAllocatedType()->getArrayElementType() ==
++ getInt8Ty());
++ }
+
+- auto *size_i32 = CreateIntCast(size, getInt32Ty(), false);
++ auto *size_i32 = size;
++ if (size_i32->getType()->getScalarSizeInBits() != 32)
++ size_i32 = CreateIntCast(size_i32, getInt32Ty(), false);
+
+- Constant *fn = createProbeReadStrFn(dst->getType(), src->getType(), as);
+ auto read_fn = selectProbeReadHelper(as, true);
+- CallInst *call = createCall(fn,
++ // int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
++ FunctionType *probereadstr_func_type = FunctionType::get(
++ getInt64Ty(), { dst->getType(), getInt32Ty(), src->getType() }, false);
++ PointerType *probereadstr_func_ptr_type = PointerType::get(
++ probereadstr_func_type, 0);
++ Constant *probereadstr_callee = ConstantExpr::getCast(
++ Instruction::IntToPtr, getInt64(read_fn), probereadstr_func_ptr_type);
++ CallInst *call = createCall(probereadstr_func_type,
++ probereadstr_callee,
+ { dst, size_i32, src },
+ probeReadHelperName(read_fn));
+ CreateHelperErrorCond(ctx, call, read_fn, loc);
+@@ -725,8 +707,10 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx,
+ return result;
+ }
+
+-Value *IRBuilderBPF::CreateStrncmp(Value *val1,
+- Value *val2,
++Value *IRBuilderBPF::CreateStrncmp(Value *str1,
++ uint64_t str1_size,
++ Value *str2,
++ uint64_t str2_size,
+ uint64_t n,
+ bool inverse)
+ {
+@@ -755,40 +739,21 @@ Value *IRBuilderBPF::CreateStrncmp(Value *val1,
+ // Check if the compared strings are literals.
+ // If so, we can avoid storing the literal in memory.
+ std::optional<std::string> literal1;
+- if (auto constString1 = dyn_cast<ConstantDataArray>(val1))
++ if (auto constString1 = dyn_cast<ConstantDataArray>(str1))
+ literal1 = constString1->getAsString();
+- else if (isa<ConstantAggregateZero>(val1))
++ else if (isa<ConstantAggregateZero>(str1))
+ literal1 = "";
+ else
+ literal1 = std::nullopt;
+
+ std::optional<std::string> literal2;
+- if (auto constString2 = dyn_cast<ConstantDataArray>(val2))
++ if (auto constString2 = dyn_cast<ConstantDataArray>(str2))
+ literal2 = constString2->getAsString();
+- else if (isa<ConstantAggregateZero>(val2))
++ else if (isa<ConstantAggregateZero>(str2))
+ literal2 = "";
+ else
+ literal2 = std::nullopt;
+
+- auto *val1p = dyn_cast<PointerType>(val1->getType());
+- auto *val2p = dyn_cast<PointerType>(val2->getType());
+-#ifndef NDEBUG
+- if (!literal1)
+- {
+- assert(val1p);
+- assert(val1p->getPointerElementType()->isArrayTy() &&
+- val1p->getPointerElementType()->getArrayElementType() ==
+- getInt8Ty());
+- }
+- if (!literal2)
+- {
+- assert(val2p);
+- assert(val2p->getPointerElementType()->isArrayTy() &&
+- val2p->getPointerElementType()->getArrayElementType() ==
+- getInt8Ty());
+- }
+-#endif
+-
+ Function *parent = GetInsertBlock()->getParent();
+ AllocaInst *store = CreateAllocaBPF(getInt1Ty(), "strcmp.result");
+ BasicBlock *str_ne = BasicBlock::Create(module_.getContext(),
+@@ -815,8 +780,8 @@ Value *IRBuilderBPF::CreateStrncmp(Value *val1,
+ l = getInt8(literal1->c_str()[i]);
+ else
+ {
+- auto *ptr_l = CreateGEP(val1p->getPointerElementType(),
+- val1,
++ auto *ptr_l = CreateGEP(ArrayType::get(getInt8Ty(), str1_size),
++ str1,
+ { getInt32(0), getInt32(i) });
+ l = CreateLoad(getInt8Ty(), ptr_l);
+ }
+@@ -826,8 +791,8 @@ Value *IRBuilderBPF::CreateStrncmp(Value *val1,
+ r = getInt8(literal2->c_str()[i]);
+ else
+ {
+- auto *ptr_r = CreateGEP(val2p->getPointerElementType(),
+- val2,
++ auto *ptr_r = CreateGEP(ArrayType::get(getInt8Ty(), str2_size),
++ str2,
+ { getInt32(0), getInt32(i) });
+ r = CreateLoad(getInt8Ty(), ptr_r);
+ }
+@@ -987,11 +952,9 @@ void IRBuilderBPF::CreateGetCurrentComm(Value *ctx,
+ size_t size,
+ const location &loc)
+ {
+- assert(buf->getType()->getPointerElementType()->isArrayTy() &&
+- buf->getType()->getPointerElementType()->getArrayNumElements() >=
+- size &&
+- buf->getType()->getPointerElementType()->getArrayElementType() ==
+- getInt8Ty());
++ assert(buf->getAllocatedType()->isArrayTy() &&
++ buf->getAllocatedType()->getArrayNumElements() >= size &&
++ buf->getAllocatedType()->getArrayElementType() == getInt8Ty());
+
+ // long bpf_get_current_comm(char *buf, int size_of_buf)
+ // Return: 0 on success or negative error
+@@ -1070,7 +1033,7 @@ void IRBuilderBPF::CreateSignal(Value *ctx, Value *sig, const location &loc)
+ Instruction::IntToPtr,
+ getInt64(libbpf::BPF_FUNC_send_signal),
+ signal_func_ptr_type);
+- CallInst *call = createCall(signal_func, { sig }, "signal");
++ CallInst *call = createCall(signal_func_type, signal_func, { sig }, "signal");
+ CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_send_signal, loc);
+ }
+
+@@ -1084,7 +1047,7 @@ void IRBuilderBPF::CreateOverrideReturn(Value *ctx, Value *rc)
+ Constant *override_func = ConstantExpr::getCast(Instruction::IntToPtr,
+ getInt64(libbpf::BPF_FUNC_override_return),
+ override_func_ptr_type);
+- createCall(override_func, { ctx, rc }, "override");
++ createCall(override_func_type, override_func, { ctx, rc }, "override");
+ }
+
+ CallInst *IRBuilderBPF::CreateSkbOutput(Value *skb,
+@@ -1119,7 +1082,8 @@ CallInst *IRBuilderBPF::CreateSkbOutput(Value *skb,
+ Instruction::IntToPtr,
+ getInt64(libbpf::BPF_FUNC_skb_output),
+ skb_output_func_ptr_type);
+- CallInst *call = createCall(skb_output_func,
++ CallInst *call = createCall(skb_output_func_type,
++ skb_output_func,
+ { skb, map_ptr, flags, data, size_val },
+ "skb_output");
+ return call;
+@@ -1328,7 +1292,8 @@ void IRBuilderBPF::CreateSeqPrintf(Value *ctx,
+ CreateGEP(getInt64Ty(), meta, getInt64(0)),
+ "seq");
+
+- CallInst *call = createCall(seq_printf_func,
++ CallInst *call = createCall(seq_printf_func_type,
++ seq_printf_func,
+ { seq, fmt, fmt_size, data, data_len },
+ "seq_printf");
+ CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_seq_printf, loc);
+diff --git a/src/ast/irbuilderbpf.h b/src/ast/irbuilderbpf.h
+index b6a06778..19b28180 100644
+--- a/src/ast/irbuilderbpf.h
++++ b/src/ast/irbuilderbpf.h
+@@ -106,17 +106,11 @@ public:
+ bool isVolatile = false,
+ std::optional<AddrSpace> addrSpace = std::nullopt);
+ CallInst *CreateProbeReadStr(Value *ctx,
+- AllocaInst *dst,
++ Value *dst,
+ llvm::Value *size,
+ Value *src,
+ AddrSpace as,
+ const location &loc);
+- CallInst *CreateProbeReadStr(Value *ctx,
+- AllocaInst *dst,
+- size_t size,
+- Value *src,
+- AddrSpace as,
+- const location &loc);
+ CallInst *CreateProbeReadStr(Value *ctx,
+ Value *dst,
+ size_t size,
+@@ -131,7 +125,12 @@ public:
+ pid_t pid,
+ AddrSpace as,
+ const location &loc);
+- Value *CreateStrncmp(Value *val1, Value *val2, uint64_t n, bool inverse);
++ Value *CreateStrncmp(Value *str1,
++ uint64_t str1_size,
++ Value *str2,
++ uint64_t str2_size,
++ uint64_t n,
++ bool inverse);
+ CallInst *CreateGetNs(bool boot_time, const location &loc);
+ CallInst *CreateGetPidTgid(const location &loc);
+ CallInst *CreateGetCurrentCgroupId(const location &loc);
+@@ -147,7 +146,10 @@ public:
+ ArrayRef<Value *> args,
+ const Twine &Name,
+ const location *loc = nullptr);
+- CallInst *createCall(Value *callee, ArrayRef<Value *> args, const Twine &Name);
++ CallInst *createCall(FunctionType *callee_type,
++ Value *callee,
++ ArrayRef<Value *> args,
++ const Twine &Name);
+ void CreateGetCurrentComm(Value *ctx, AllocaInst *buf, size_t size, const location& loc);
+ void CreatePerfEventOutput(Value *ctx,
+ Value *data,
+@@ -205,9 +207,6 @@ private:
+ AddrSpace as,
+ const location &loc);
+ CallInst *createMapLookup(int mapid, Value *key);
+- Constant *createProbeReadStrFn(llvm::Type *dst,
+- llvm::Type *src,
+- AddrSpace as);
+ libbpf::bpf_func_id selectProbeReadHelper(AddrSpace as, bool str);
+
+ llvm::Type *getKernelPointerStorageTy();
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index d4a5e1c7..0703d196 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -1152,8 +1152,12 @@ void CodegenLLVM::visit(Call &call)
+ auto left_string = getString(left_arg);
+ auto right_string = getString(right_arg);
+
+- expr_ = b_.CreateStrncmp(
+- left_string.first, right_string.first, size, false);
++ expr_ = b_.CreateStrncmp(left_string.first,
++ left_string.second,
++ right_string.first,
++ right_string.second,
++ size,
++ false);
+ }
+ else if (call.func == "override")
+ {
+@@ -1284,8 +1288,7 @@ void CodegenLLVM::visit(Variable &var)
+ else
+ {
+ auto *var_alloca = variables_[var.ident];
+- expr_ = b_.CreateLoad(var_alloca->getType()->getPointerElementType(),
+- var_alloca);
++ expr_ = b_.CreateLoad(var_alloca->getAllocatedType(), var_alloca);
+ }
+ }
+
+@@ -1325,7 +1328,12 @@ void CodegenLLVM::binop_string(Binop &binop)
+ auto right_string = getString(binop.right);
+
+ size_t len = std::min(left_string.second, right_string.second);
+- expr_ = b_.CreateStrncmp(left_string.first, right_string.first, len, inverse);
++ expr_ = b_.CreateStrncmp(left_string.first,
++ left_string.second,
++ right_string.first,
++ right_string.second,
++ len,
++ inverse);
+ }
+
+ void CodegenLLVM::binop_buf(Binop &binop)
+@@ -1349,7 +1357,12 @@ void CodegenLLVM::binop_buf(Binop &binop)
+
+ size_t len = std::min(binop.left->type.GetSize(),
+ binop.right->type.GetSize());
+- expr_ = b_.CreateStrncmp(left_string, right_string, len, inverse);
++ expr_ = b_.CreateStrncmp(left_string,
++ binop.left->type.GetSize(),
++ right_string,
++ binop.right->type.GetSize(),
++ len,
++ inverse);
+ }
+
+ void CodegenLLVM::binop_int(Binop &binop)
+@@ -3498,9 +3511,8 @@ void CodegenLLVM::createIncDec(Unop &unop)
+ else if (unop.expr->is_variable)
+ {
+ Variable &var = static_cast<Variable &>(*unop.expr);
+- Value *oldval = b_.CreateLoad(
+- variables_[var.ident]->getType()->getPointerElementType(),
+- variables_[var.ident]);
++ Value *oldval = b_.CreateLoad(variables_[var.ident]->getAllocatedType(),
++ variables_[var.ident]);
+ Value *newval;
+ if (is_increment)
+ newval = b_.CreateAdd(oldval, b_.GetIntSameSize(step, oldval));
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2022-09-17 21:46 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2022-09-17 21:46 UTC (permalink / raw
To: gentoo-commits
commit: c026e499608c9a6a71ad316d526d5e46d03690ef
Author: Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Wed Sep 14 05:33:18 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 17 21:41:46 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c026e499
dev-util/bpftrace: fix build failure with binutils-2.39
Closes: https://bugs.gentoo.org/868120
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/27243
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild | 1 +
.../files/bpftrace-0.15.0-binutils-2.39.patch | 87 ++++++++++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
index 51346cb3d38d..566a14a29b4a 100644
--- a/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
@@ -53,6 +53,7 @@ PATCHES=(
"${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
"${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
"${FILESDIR}/bpftrace-0.15.0-bcc-025.patch"
+ "${FILESDIR}/bpftrace-0.15.0-binutils-2.39.patch"
)
pkg_pretend() {
diff --git a/dev-util/bpftrace/files/bpftrace-0.15.0-binutils-2.39.patch b/dev-util/bpftrace/files/bpftrace-0.15.0-binutils-2.39.patch
new file mode 100644
index 000000000000..cb4b8a9bb2d2
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.15.0-binutils-2.39.patch
@@ -0,0 +1,87 @@
+
+Patch taken from: https://github.com/iovisor/bpftrace/pull/2328
+Removed hunk #1 (CHANGELOG.md) since it conflicts and is not required.
+Bug: https://bugs.gentoo.org/868120
+
+From 3be6e708d514d3378a4fe985ab907643ecbc77ee Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Mon, 15 Aug 2022 15:13:14 +0200
+Subject: [PATCH] Fix builds against libbfd(binutils) >=2.39
+
+Binutils 2.39 changed signature of the init_disassemble_info function by
+adding an extra parameter for styled printf function. Let CMake detect
+which of the versions is present and call it appropriately.
+---
+ CHANGELOG.md | 2 ++
+ CMakeLists.txt | 3 +++
+ cmake/FindLibBfd.cmake | 10 ++++++++++
+ src/bfd-disasm.cpp | 14 ++++++++++++++
+ 4 files changed, 29 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8f7995afd2..2e54eb84f8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -249,6 +249,9 @@ if(HAVE_BFD_DISASM)
+ if(LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
+ set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
+ endif(LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
++ if(LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
++ set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
++ endif(LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
+ endif(HAVE_BFD_DISASM)
+
+ if (LIBBPF_BTF_DUMP_FOUND)
+diff --git a/cmake/FindLibBfd.cmake b/cmake/FindLibBfd.cmake
+index 4f4b8c4e20..5d917b188c 100644
+--- a/cmake/FindLibBfd.cmake
++++ b/cmake/FindLibBfd.cmake
+@@ -75,5 +75,15 @@ int main(void) {
+ abfd);
+ return 0;
+ }" LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
++CHECK_CXX_SOURCE_COMPILES("
++// See comment in bfd-disasm.cpp for why this needs to exist
++#define PACKAGE \"bpftrace-test\"
++#include <dis-asm.h>
++
++int main(void) {
++ init_disassemble_info(NULL, NULL, NULL, NULL);
++ return 0;
++}
++" LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ endif()
+diff --git a/src/bfd-disasm.cpp b/src/bfd-disasm.cpp
+index f846468cd8..d4165dfac5 100644
+--- a/src/bfd-disasm.cpp
++++ b/src/bfd-disasm.cpp
+@@ -38,6 +38,16 @@ static int fprintf_nop(void *out __attribute__((unused)), const char *fmt __attr
+ return 0;
+ }
+
++#ifdef LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE
++static int fprintf_styled_nop(void *out __attribute__((unused)),
++ enum disassembler_style s __attribute__((unused)),
++ const char *fmt __attribute__((unused)),
++ ...)
++{
++ return 0;
++}
++#endif
++
+ static AlignState is_aligned_buf(void *buf, uint64_t size, uint64_t offset)
+ {
+ disassembler_ftype disassemble;
+@@ -55,7 +65,11 @@ static AlignState is_aligned_buf(void *buf, uint64_t size, uint64_t offset)
+ return AlignState::Fail;
+ }
+
++#ifdef LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE
++ init_disassemble_info(&info, stdout, fprintf_nop, fprintf_styled_nop);
++#else
+ init_disassemble_info(&info, stdout, fprintf_nop);
++#endif
+
+ info.arch = bfd_get_arch(bfdf);
+ info.mach = bfd_get_mach(bfdf);
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2022-08-29 17:40 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2022-08-29 17:40 UTC (permalink / raw
To: gentoo-commits
commit: 542f1c70470d93d8f66fb8ef04ece7fb83221512
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 29 17:39:38 2022 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Mon Aug 29 17:39:38 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=542f1c70
dev-util/bpftrace: Add patch to build with bcc-0.25 (bug #866611)
Closes: https://bugs.gentoo.org/866611
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild | 1 +
.../bpftrace/files/bpftrace-0.15.0-bcc-025.patch | 88 ++++++++++++++++++++++
2 files changed, 89 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
index 1b080a8637d2..51346cb3d38d 100644
--- a/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
@@ -52,6 +52,7 @@ PATCHES=(
"${FILESDIR}/bpftrace-0.15.0-install-libs.patch"
"${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
"${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+ "${FILESDIR}/bpftrace-0.15.0-bcc-025.patch"
)
pkg_pretend() {
diff --git a/dev-util/bpftrace/files/bpftrace-0.15.0-bcc-025.patch b/dev-util/bpftrace/files/bpftrace-0.15.0-bcc-025.patch
new file mode 100644
index 000000000000..ef2ca76e1c50
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.15.0-bcc-025.patch
@@ -0,0 +1,88 @@
+From f86c3bde84d9e75ec2780a51a1ca7dc20a4740e6 Mon Sep 17 00:00:00 2001
+From: Dominique Martinet <asmadeus@codewreck.org>
+Date: Thu, 25 Aug 2022 21:47:30 +0900
+Subject: [PATCH] Fix builds against bcc >= 0.25.0
+
+libbpf 1.0.0 removed bpf_load_program_attr in
+https://github.com/libbpf/libbpf/commit/9476dce6fe905a6bf1d4c483f7b2b8575c4ffb2d
+and bcc 0.25.0 in turn changed bcc_prog_load_xattr to use
+bpf_prog_load_opts instead in
+https://github.com/iovisor/bcc/commit/185143bdec6134255363446f644acd766ffb3825
+
+Add a compile check to use the appropriate version
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c5c4c39630d2..f23b2ba52740 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -138,7 +138,7 @@ check_symbol_exists(bpf_attach_kfunc "${LIBBCC_INCLUDE_DIRS}/bcc/libbpf.h" HAVE_
+ check_symbol_exists(bcc_usdt_addsem_probe "${LIBBCC_INCLUDE_DIRS}/bcc/bcc_usdt.h" HAVE_BCC_USDT_ADDSEM)
+ check_symbol_exists(bcc_procutils_which_so "${LIBBCC_INCLUDE_DIRS}/bcc/bcc_proc.h" HAVE_BCC_WHICH_SO)
+
+-# bcc_prog_load_xattr needs struct bpf_load_program_attr,
++# bcc_prog_load_xattr needs struct bpf_prog_load_opts or bpf_load_program_attr,
+ # which is defined in libbpf
+ if (LIBBPF_FOUND)
+ check_symbol_exists(bcc_prog_load_xattr "${LIBBCC_INCLUDE_DIRS}/bcc/libbpf.h" HAVE_BCC_PROG_LOAD_XATTR)
+@@ -236,6 +236,10 @@ if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+
++if(LIBBCC_PROG_LOAD_XATTRS_WITH_OPTS)
++ set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" LIBBCC_PROG_LOAD_XATTRS_WITH_OPTS)
++endif(LIBBCC_PROG_LOAD_XATTRS_WITH_OPTS)
++
+ if (HAVE_BCC_KFUNC)
+ set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" HAVE_BCC_KFUNC)
+ endif(HAVE_BCC_KFUNC)
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 7b4f12835786..20d2e68cd75f 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -85,6 +85,16 @@ int main(void) {
+ return 0;
+ }
+ " LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++ struct bpf_prog_load_opts *opts = (struct bpf_prog_load_opts*) 1;
++
++ bcc_prog_load_xattr(BPF_PROG_TYPE_UNSPEC, 0, 0, 0, opts, 0, 0, 0, true);
++ return 0;
++}
++" LIBBCC_PROG_LOAD_XATTRS_WITH_OPTS)
+ SET(CMAKE_REQUIRED_INCLUDES)
+
+ SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARIES})
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 60778e53ce44..dd46f15fd8d2 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -731,7 +731,24 @@ void AttachedProbe::load_prog()
+ continue;
+ }
+
+-#ifdef HAVE_BCC_PROG_LOAD_XATTR
++#ifdef LIBBCC_PROG_LOAD_XATTRS_WITH_OPTS
++ struct bpf_prog_load_opts opts = { };
++
++ opts.sz = sizeof(opts);
++ opts.log_level = log_level;
++
++ progfd_ = bcc_prog_load_xattr(
++ progtype(probe_.type),
++ name.c_str(),
++ license,
++ reinterpret_cast<struct bpf_insn *>(insns),
++ &opts,
++ prog_len,
++ log_buf.get(),
++ log_buf_size,
++ true);
++
++#elif HAVE_BCC_PROG_LOAD_XATTR
+ struct bpf_load_program_attr attr = {};
+
+ attr.prog_type = progtype(probe_.type);
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2022-05-24 17:47 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2022-05-24 17:47 UTC (permalink / raw
To: gentoo-commits
commit: 948804562536b1d469f4c230c8ec44b3f46f0f16
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 17:47:08 2022 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Tue May 24 17:47:08 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94880456
dev-util/bpftrace: add 0.15.0
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 +
dev-util/bpftrace/bpftrace-0.15.0.ebuild | 92 ++++++++++
.../files/bpftrace-0.15.0-dont-compress-man.patch | 47 +++++
.../files/bpftrace-0.15.0-install-libs.patch | 199 +++++++++++++++++++++
4 files changed, 339 insertions(+)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 1c4b3ff288a4..96ee56633f51 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,2 +1,3 @@
DIST bpftrace-0.14.1-llvm14.patch.gz 7377 BLAKE2B 69b3b74bce74a8d4d8d9cc74de352dc33875ae905d8a88c776bbe80862a4f4ac2d450bcb6190da8be880bcc8fb751e3b8172df5454f31dc4bcd3e41edb02e396 SHA512 3269132981a7d2c0263fe9003bbcd2348e186ca0cdc95ada368331fc6e2495ae126c7bd68676438ccb575aafdafa3d17604a28fdc11d8b629eeaee130c1fd614
DIST bpftrace-0.14.1.tar.gz 991481 BLAKE2B 832f213760eb86804d63df782ff1923f6355b63770b8c4d486dd2547ae3dc474f9e4923f3107bbefbf2066dc013c930d4765ef86ef4d10bda6757513e30c2de1 SHA512 0be06c209ba12f70a0d1140b168dac94945c1b034dbd0c7dae5460fca43eec10bb436e28c122ec37b259256bf6b9bb23a3c5e7f8435feb67eae1b9277debaf73
+DIST bpftrace-0.15.0.tar.gz 1006735 BLAKE2B 3ef4bb5f13aa6dea5140b5362e6fc3de21baa1192e2218307895bf29ddeba8d69543e32c2b769bf3456076095ba661b66e1625f2696631d22628311d7f6ec1a4 SHA512 916e9afeab301e62472e570ef77a3b9b27b43251880b64f1c5f151583c59a6c61e9ede50f3607044b27c5a6ce1a654f290153bf3f9237ebc0a823b5e6356187a
diff --git a/dev-util/bpftrace/bpftrace-0.15.0.ebuild b/dev-util/bpftrace/bpftrace-0.15.0.ebuild
new file mode 100644
index 000000000000..cb4b8281e70b
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.15.0.ebuild
@@ -0,0 +1,92 @@
+# Copyright 2019-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LLVM_MAX_SLOT=15
+
+inherit llvm linux-info cmake toolchain-funcs
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+MY_PV="${PV//_/}"
+SRC_URI="
+ https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz
+ https://dev.gentoo.org/~chutzpah/dist/bpftrace/bpftrace-0.14.1-llvm14.patch.gz
+"
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="fuzzing test"
+# lots of fixing needed
+RESTRICT="test"
+
+RDEPEND="
+ >=dev-libs/libbpf-0.8:=
+ >=dev-util/bcc-0.13.0:=
+ dev-util/systemtap
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
+ <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
+ sys-libs/binutils-libs:=
+ virtual/libelf:=
+"
+DEPEND="
+ ${COMMON_DEPEND}
+ dev-libs/cereal:=
+ test? ( dev-cpp/gtest )
+"
+BDEPEND="
+ sys-apps/sed
+ app-arch/xz-utils
+ sys-devel/flex
+ sys-devel/bison
+ virtual/pkgconfig
+"
+
+QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.15.0-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+)
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+}
+
+src_configure() {
+ local -a mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ # bug 809362, 754648
+ -DBUILD_SHARED_LIBS:=OFF
+ -DBUILD_TESTING:BOOL=OFF
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ -DENABLE_MAN:BOOL=OFF
+ -DLIBBPF_INCLUDE_DIRS="$($(tc-getPKG_CONFIG) --cflags-only-I libbpf | sed 's:-I::g')"
+ )
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # bug 809362
+ dostrip -x /usr/bin/bpftrace
+ doman man/man8/*.?
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.15.0-dont-compress-man.patch b/dev-util/bpftrace/files/bpftrace-0.15.0-dont-compress-man.patch
new file mode 100644
index 000000000000..84241e052462
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.15.0-dont-compress-man.patch
@@ -0,0 +1,47 @@
+diff --git a/man/adoc/CMakeLists.txt b/man/adoc/CMakeLists.txt
+index 1a81dee0..c93ccbd2 100644
+--- a/man/adoc/CMakeLists.txt
++++ b/man/adoc/CMakeLists.txt
+@@ -1,7 +1,5 @@
+-find_program(GZIP gzip REQUIRED)
+ find_program(ASCIIDOCTOR asciidoctor)
+ file(GLOB FILES *.adoc)
+-set(GZFILES "")
+ if(NOT "${ASCIIDOCTOR}" STREQUAL "ASCIIDOCTOR-NOTFOUND")
+ foreach(FIL ${FILES})
+ get_filename_component(NAME ${FIL} NAME_WE)
+@@ -12,14 +10,9 @@ if(NOT "${ASCIIDOCTOR}" STREQUAL "ASCIIDOCTOR-NOTFOUND")
+ COMMAND ${ASCIIDOCTOR} ${FIL} -b manpage -o - > ${MANPAGE_FILE}
+ DEPENDS ${FIL})
+
+- add_custom_command(OUTPUT ${GZ_MANPAGE_FILE}
+- COMMAND ${GZIP} -c ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE}
+- DEPENDS ${MANPAGE_FILE})
+-
+- list(APPEND GZFILES ${GZ_MANPAGE_FILE})
+ endforeach()
+- add_custom_target(adoc_man DEPENDS ${GZFILES})
+- install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
++ add_custom_target(adoc_man DEPENDS ${FILES})
++ install(FILES ${FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
+ else()
+ message(WARNING "asciidoctor not found, building without bpftrace manpage")
+ add_custom_target(adoc_man)
+diff --git a/man/man8/CMakeLists.txt b/man/man8/CMakeLists.txt
+index 2a316cd9..2207cf80 100644
+--- a/man/man8/CMakeLists.txt
++++ b/man/man8/CMakeLists.txt
+@@ -1,12 +1,3 @@
+-find_program(GZIP gzip REQUIRED)
+ file(GLOB FILES *.8)
+-set(GZFILES "")
+-foreach(FIL ${FILES})
+- get_filename_component(NAME ${FIL} NAME)
+- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
+- COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
+- DEPENDS ${FIL})
+- list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz")
+-endforeach()
+ add_custom_target(man_man DEPENDS ${GZFILES})
+-install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
++install(FILES ${FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
diff --git a/dev-util/bpftrace/files/bpftrace-0.15.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.15.0-install-libs.patch
new file mode 100644
index 000000000000..b20e39e4d268
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.15.0-install-libs.patch
@@ -0,0 +1,199 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c5c4c396..4bc3e499 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -103,9 +103,10 @@ find_package(FLEX REQUIRED)
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index a95c60a1..f5c4d676 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 66a7fd66..738d9327 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -41,7 +41,7 @@ add_library(runtime
+ ${BFD_DISASM_SRC}
+ )
+ # Ensure flex+bison outputs are built first
+-add_dependencies(runtime parser)
++add_dependencies(runtime bpftraceparser)
+
+ add_library(libbpftrace
+ build_info.cpp
+@@ -58,6 +58,7 @@ add_executable(${BPFTRACE}
+ )
+
+ install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_link_libraries(${BPFTRACE} libbpftrace)
+
+ if (BUILD_FUZZ)
+@@ -110,6 +111,7 @@ target_include_directories(runtime PRIVATE ${CMAKE_BINARY_DIR})
+ target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(runtime PRIVATE ${CMAKE_SOURCE_DIR}/src/ast)
+ target_compile_definitions(runtime PRIVATE ${BPFTRACE_FLAGS})
++install(TARGETS runtime LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_compile_definitions(libbpftrace PRIVATE ${BPFTRACE_FLAGS})
+
+ # Linking
+@@ -122,7 +124,8 @@ if(STATIC_LINKING)
+ endif(STATIC_LINKING)
+
+
+-target_link_libraries(libbpftrace parser resources runtime aot ast arch cxxdemangler_llvm)
++target_link_libraries(libbpftrace bpftraceparser bpftraceresources
++ runtime aot bpftraceast bpftracearch cxxdemangler_llvm)
+
+ if (LIBBPF_BTF_DUMP_FOUND)
+ target_include_directories(runtime PUBLIC ${LIBBPF_INCLUDE_DIRS})
+diff --git a/src/aot/CMakeLists.txt b/src/aot/CMakeLists.txt
+index 291d53f2..22944ddc 100644
+--- a/src/aot/CMakeLists.txt
++++ b/src/aot/CMakeLists.txt
+@@ -2,6 +2,7 @@ add_library(aot aot.cpp)
+ target_include_directories(aot PUBLIC ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(aot PUBLIC ${CMAKE_BINARY_DIR})
+ target_compile_definitions(aot PRIVATE ${BPFTRACE_FLAGS})
++install(TARGETS aot LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ # Only build aotrt if supported bcc is used
+ # (https://github.com/iovisor/bcc/commit/719191867a25ce07dc96f7faf9b8ccedadc7ec44)
+@@ -10,7 +11,7 @@ if(NOT LIBBCC_BPF_CONTAINS_RUNTIME)
+ endif()
+
+ add_executable(bpftrace-aotrt aot_main.cpp)
+-target_link_libraries(bpftrace-aotrt aot runtime arch ast_defs cxxdemangler_stdlib)
++target_link_libraries(bpftrace-aotrt aot runtime bpftracearch ast_defs cxxdemangler_stdlib)
+ install(TARGETS bpftrace-aotrt DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ # Linking
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index 127c3528..4e05d40a 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,17 +1,19 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
+- add_library(arch s390.cpp)
++ add_library(bpftracearch s390.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
+- add_library(arch mips64.cpp)
++ add_library(bpftracearch mips64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
+- add_library(arch riscv64.cpp)
++ add_library(bpftracearch riscv64.cpp)
+ else()
+ message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
++
++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index 014295cd..c35f6ac6 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ add_library(ast_defs ast.cpp)
+
+-add_library(ast
++add_library(bpftraceast
+ async_event_types.cpp
+ attachpoint_parser.cpp
+ int_parser.cpp
+@@ -20,11 +20,13 @@ add_library(ast
+ target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src)
+ target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+ target_include_directories(ast_defs PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast ast_defs arch bpforc parser)
++target_link_libraries(bpftraceast ast_defs bpftracearch bpforc bpftraceparser)
++install(TARGETS ast_defs LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+-add_dependencies(ast_defs parser)
++add_dependencies(ast_defs bpftraceparser)
+
+-target_compile_definitions(ast PRIVATE ${BPFTRACE_FLAGS})
++target_compile_definitions(bpftraceast PRIVATE ${BPFTRACE_FLAGS})
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -55,11 +57,11 @@ if (STATIC_LINKING)
+
+
+ if(EMBED_USE_LLVM)
+- target_link_libraries(ast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
++ target_link_libraries(bpftraceast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
+ else()
+ llvm_map_components_to_libnames(llvm_libs ${llvm_lib_names})
+- target_link_libraries(ast ${clang_libs})
+- target_link_libraries(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${clang_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+
+ if(STATIC_LIBC)
+@@ -69,13 +71,13 @@ if (STATIC_LINKING)
+ else()
+ find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+ if(found_LLVM)
+- target_link_libraries(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
+
+ add_subdirectory(bpforc)
+diff --git a/src/ast/bpforc/CMakeLists.txt b/src/ast/bpforc/CMakeLists.txt
+index 3f6dbefa..8ccfbb2b 100644
+--- a/src/ast/bpforc/CMakeLists.txt
++++ b/src/ast/bpforc/CMakeLists.txt
+@@ -1 +1,2 @@
+ add_library(bpforc bpforc.cpp)
++install(TARGETS bpforc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff --git a/src/cxxdemangler/CMakeLists.txt b/src/cxxdemangler/CMakeLists.txt
+index 04cfcdd9..5677aa4b 100644
+--- a/src/cxxdemangler/CMakeLists.txt
++++ b/src/cxxdemangler/CMakeLists.txt
+@@ -1,2 +1,4 @@
+ add_library(cxxdemangler_stdlib cxxdemangler_stdlib.cpp)
+ add_library(cxxdemangler_llvm cxxdemangler_llvm.cpp)
++install(TARGETS cxxdemangler_stdlib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS cxxdemangler_llvm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2021-12-02 18:02 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2021-12-02 18:02 UTC (permalink / raw
To: gentoo-commits
commit: 935ed96e4e87c521f1204bea27629d045e3e66bf
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 2 18:02:04 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Thu Dec 2 18:02:04 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=935ed96e
dev-util/bpftrace: Remove old
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 -
dev-util/bpftrace/bpftrace-0.13.0-r1.ebuild | 88 -------------
.../files/bpftrace-0.10.0-dont-compress-man.patch | 18 ---
.../files/bpftrace-0.13.0-install-libs.patch | 145 ---------------------
4 files changed, 252 deletions(-)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index f2b2d8765fc0..dc83538e89dc 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,2 +1 @@
-DIST bpftrace-0.13.0.tar.gz 952412 BLAKE2B 8e3f6f28b0c652e2257e1a970b80b87ba5ac5e94dc26719bffe16a0bbff48efc2b9ab5bc03e5fe4b764f5c9c3df16039d931f1f13c1f14327880838a373edacc SHA512 16b3f11c365cc7e306045a5cb6bcf6c66b92d746884f6587ce7cc4c76841b284757bff7b38b9838eb3db129e996e4f1b13afec34da57981362dadef8460816d0
DIST bpftrace-0.14.0.tar.gz 991314 BLAKE2B 3222068d7f84c13f736197cef2d188fa31a25db6bd266afe5cbacb1c062155b5ebd5d0310fbad56c15574a795766a33b12624f0252b0bc0677bf05324f414df5 SHA512 78f2d9a4d54c0dda1947b924a828777b402befc3a05031b609da4d256907df1e64f946454a9be7317449f49706f02a881febc4e63d2ef2f4e76924ea19e36ddb
diff --git a/dev-util/bpftrace/bpftrace-0.13.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.13.0-r1.ebuild
deleted file mode 100644
index bf4eda842dfa..000000000000
--- a/dev-util/bpftrace/bpftrace-0.13.0-r1.ebuild
+++ /dev/null
@@ -1,88 +0,0 @@
-# Copyright 2019-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit llvm linux-info cmake
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-
-if [[ ${PV} =~ 9{4,} ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/iovisor/${PN}"
- BDEPEND=""
-else
- MY_PV="${PV//_/}"
- SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
- KEYWORDS="~amd64 ~arm64 ~x86"
- BDEPEND="app-arch/xz-utils "
-fi
-
-LICENSE="Apache-2.0"
-SLOT="0"
-IUSE="fuzzing test"
-
-COMMON_DEPEND="
- dev-libs/libbpf:=
- >=dev-util/bcc-0.13.0:=
- dev-util/systemtap
- >=sys-devel/llvm-6:=[llvm_targets_BPF(+)]
- <=sys-devel/llvm-13:=[llvm_targets_BPF(+)]
- <=sys-devel/clang-13:=
- sys-libs/binutils-libs:=
- virtual/libelf
-"
-DEPEND="${COMMON_DEPEND}
- test? ( dev-cpp/gtest )
-"
-RDEPEND="${COMMON_DEPEND}"
-BDEPEND+="
- >=dev-util/cmake-3.8
- sys-devel/flex
- sys-devel/bison
-"
-
-S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
-QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.13.0-install-libs.patch"
- "${FILESDIR}/bpftrace-0.10.0-dont-compress-man.patch"
- "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
- "${FILESDIR}/bpftrace-0.12.0-fuzzing-build.patch"
-)
-
-# lots of fixing needed
-RESTRICT="test"
-
-pkg_pretend() {
- local CONFIG_CHECK="
- ~BPF
- ~BPF_EVENTS
- ~BPF_JIT
- ~BPF_SYSCALL
- ~FTRACE_SYSCALLS
- ~HAVE_EBPF_JIT
- "
-
- check_extra_config
-}
-
-pkg_setup() {
- LLVM_MAX_SLOT=12 llvm_pkg_setup
-}
-
-src_prepare() {
- cmake_src_prepare
-}
-
-src_configure() {
- local -a mycmakeargs=(
- -DSTATIC_LINKING:BOOL=OFF
- -DBUILD_TESTING:BOOL=OFF
- -DBUILD_FUZZ:BOOL=$(usex fuzzing)
- )
-
- cmake_src_configure
-}
diff --git a/dev-util/bpftrace/files/bpftrace-0.10.0-dont-compress-man.patch b/dev-util/bpftrace/files/bpftrace-0.10.0-dont-compress-man.patch
deleted file mode 100644
index 750ed4f712a3..000000000000
--- a/dev-util/bpftrace/files/bpftrace-0.10.0-dont-compress-man.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git a/man/man8/CMakeLists.txt b/man/man8/CMakeLists.txt
-index f1fc334..7ee58ed 100644
---- a/man/man8/CMakeLists.txt
-+++ b/man/man8/CMakeLists.txt
-@@ -1,12 +1,3 @@
--find_program(GZIP gzip)
- file(GLOB FILES *.8)
--set(GZFILES "")
--foreach(FIL ${FILES})
-- get_filename_component(NAME ${FIL} NAME)
-- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
-- COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
-- DEPENDS ${FIL})
-- list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz")
--endforeach()
- add_custom_target(man ALL DEPENDS ${GZFILES})
--install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
-+install(FILES ${FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
diff --git a/dev-util/bpftrace/files/bpftrace-0.13.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.13.0-install-libs.patch
deleted file mode 100644
index fb75f9db1ba3..000000000000
--- a/dev-util/bpftrace/files/bpftrace-0.13.0-install-libs.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e33bb1ca..52e1fa25 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -100,9 +100,10 @@ find_package(FLEX REQUIRED)
- bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
- flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
- add_flex_bison_dependency(flex_lexer bison_parser)
--add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
--target_compile_options(parser PRIVATE "-w")
--target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
-+add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
-+target_compile_options(bpftraceparser PRIVATE "-w")
-+target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
-+install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- include(CheckSymbolExists)
- set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
-diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
-index a95c60a1..f5c4d676 100644
---- a/resources/CMakeLists.txt
-+++ b/resources/CMakeLists.txt
-@@ -1,6 +1,7 @@
--add_library(resources headers.cpp)
-+add_library(bpftraceresources headers.cpp)
-
--target_include_directories(resources PUBLIC ../src)
-+target_include_directories(bpftraceresources PUBLIC ../src)
-+install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- function(embed_headers output)
- file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 0361cdaa..f9c536a3 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -49,6 +49,7 @@ add_executable(${BPFTRACE}
- )
-
- install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
-+install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- target_link_libraries(${BPFTRACE} libbpftrace)
-
- if (BUILD_FUZZ)
-@@ -109,7 +110,7 @@ if(STATIC_LINKING)
- endif(STATIC_LINKING)
-
-
--target_link_libraries(libbpftrace parser resources ast arch)
-+target_link_libraries(libbpftrace bpftraceparser bpftraceresources bpftraceast bpftracearch)
-
- if (LIBBPF_BTF_DUMP_FOUND)
- target_include_directories(libbpftrace PUBLIC ${LIBBPF_INCLUDE_DIRS})
-diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
-index 76bb217e..4ad0f626 100644
---- a/src/arch/CMakeLists.txt
-+++ b/src/arch/CMakeLists.txt
-@@ -1,15 +1,17 @@
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
-- add_library(arch aarch64.cpp)
-+ add_library(bpftracearch aarch64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
- CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
-- add_library(arch ppc64.cpp)
-+ add_library(bpftracearch ppc64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
- CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
-- add_library(arch s390.cpp)
-+ add_library(bpftracearch s390.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
-- add_library(arch x86_64.cpp)
-+ add_library(bpftracearch x86_64.cpp)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
-- add_library(arch mips64.cpp)
-+ add_library(bpftracearch mips64.cpp)
- else()
- message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
- endif()
-+
-+install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
-index 5234388c..8b40faaa 100644
---- a/src/ast/CMakeLists.txt
-+++ b/src/ast/CMakeLists.txt
-@@ -1,4 +1,4 @@
--add_library(ast
-+add_library(bpftraceast
- ast.cpp
- attachpoint_parser.cpp
- codegen_llvm.cpp
-@@ -13,17 +13,18 @@ add_library(ast
- signal.cpp
- visitors.cpp
- )
-+install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
--target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src)
--target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
--target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR})
--target_link_libraries(ast arch)
-+target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src)
-+target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
-+target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR})
-+target_link_libraries(bpftraceast bpftracearch)
-
- if (HAVE_BCC_KFUNC)
-- target_compile_definitions(ast PRIVATE HAVE_BCC_KFUNC)
-+ target_compile_definitions(bpftraceast PRIVATE HAVE_BCC_KFUNC)
- endif(HAVE_BCC_KFUNC)
-
--add_dependencies(ast parser)
-+add_dependencies(bpftraceast bpftraceparser)
-
- if (STATIC_LINKING)
- set(clang_libs
-@@ -54,11 +55,11 @@ if (STATIC_LINKING)
-
-
- if(EMBED_USE_LLVM)
-- target_link_libraries(ast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
-+ target_link_libraries(bpftraceast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
- else()
- llvm_map_components_to_libnames(llvm_libs ${llvm_lib_names})
-- target_link_libraries(ast ${clang_libs})
-- target_link_libraries(ast ${llvm_libs})
-+ target_link_libraries(bpftraceast ${clang_libs})
-+ target_link_libraries(bpftraceast ${llvm_libs})
- endif()
-
- if(STATIC_LIBC)
-@@ -68,11 +69,11 @@ if (STATIC_LINKING)
- else()
- find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
- if(found_LLVM)
-- target_link_libraries(ast 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(ast ${llvm_libs})
-+ target_link_libraries(bpftraceast ${llvm_libs})
- endif()
-- target_link_libraries(ast libclang)
-+ target_link_libraries(bpftraceast libclang)
- endif()
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2021-12-02 17:30 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2021-12-02 17:30 UTC (permalink / raw
To: gentoo-commits
commit: ef0f3b1bb4c6bfb876c0af6cb1bcddff39dcef3b
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 2 17:30:33 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Thu Dec 2 17:30:48 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef0f3b1b
dev-util/bpftrace: Fix build with libbpf-0.6.0
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.14.0-r4.ebuild | 92 ++++++++++++++++++++++
.../bpftrace/files/bpftrace-0.14-libbpf-0.6.patch | 17 ++++
2 files changed, 109 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.14.0-r4.ebuild b/dev-util/bpftrace/bpftrace-0.14.0-r4.ebuild
new file mode 100644
index 000000000000..0aeeffbf10f6
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.14.0-r4.ebuild
@@ -0,0 +1,92 @@
+# Copyright 2019-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LLVM_MAX_SLOT=13
+
+inherit llvm linux-info cmake
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+MY_PV="${PV//_/}"
+SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="fuzzing test"
+# lots of fixing needed
+RESTRICT="test"
+
+RDEPEND="
+ dev-libs/libbpf:=
+ >=dev-util/bcc-0.13.0:=
+ dev-util/systemtap
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
+ <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
+ sys-libs/binutils-libs:=
+ virtual/libelf:=
+"
+DEPEND="
+ ${COMMON_DEPEND}
+ dev-libs/cereal:=
+ test? ( dev-cpp/gtest )
+"
+BDEPEND="
+ sys-apps/sed
+ app-arch/xz-utils
+ sys-devel/flex
+ sys-devel/bison
+ virtual/pkgconfig
+"
+
+QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.14.0-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.14.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.14.0-fuzzing.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+ "${FILESDIR}/bpftrace-0.12.0-fuzzing-build.patch"
+ "${FILESDIR}/bpftrace-0.14-libbpf-0.6.patch"
+)
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+}
+
+src_configure() {
+ local -a mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ # bug 809362, 754648
+ -DBUILD_SHARED_LIBS:=OFF
+ -DBUILD_TESTING:BOOL=OFF
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ -DENABLE_MAN:BOOL=OFF
+ -DLIBBPF_INCLUDE_DIRS="$(pkg-config --cflags-only-I libbpf | sed 's:-I::g')"
+ )
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # bug 809362
+ dostrip -x /usr/bin/bpftrace
+ doman man/man8/*.?
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.14-libbpf-0.6.patch b/dev-util/bpftrace/files/bpftrace-0.14-libbpf-0.6.patch
new file mode 100644
index 000000000000..e4a383dd69fc
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.14-libbpf-0.6.patch
@@ -0,0 +1,17 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 47a050e2..5dd5ff3f 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -123,10 +123,8 @@ endif(STATIC_LINKING)
+
+ target_link_libraries(libbpftrace parser resources runtime aot ast arch cxxdemangler_llvm)
+
+-if (LIBBPF_BTF_DUMP_FOUND)
+- target_include_directories(runtime PUBLIC ${LIBBPF_INCLUDE_DIRS})
+- target_link_libraries(runtime ${LIBBPF_LIBRARIES})
+-endif(LIBBPF_BTF_DUMP_FOUND)
++target_include_directories(runtime PUBLIC ${LIBBPF_INCLUDE_DIRS})
++target_link_libraries(runtime ${LIBBPF_LIBRARIES})
+
+ if(HAVE_BFD_DISASM)
+ if(STATIC_LINKING)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2021-11-07 20:59 Jakov Smolić
0 siblings, 0 replies; 22+ messages in thread
From: Jakov Smolić @ 2021-11-07 20:59 UTC (permalink / raw
To: gentoo-commits
commit: 9af1ceff0ce358bd93f2e54e8f4a7ef496623d45
Author: Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 7 20:58:17 2021 +0000
Commit: Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
CommitDate: Sun Nov 7 20:58:40 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9af1ceff
dev-util/bpftrace: Fix includes in fuzz_main.cpp
Closes: https://bugs.gentoo.org/801385
Signed-off-by: Jakov Smolić <jsmolic <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.14.0-r3.ebuild | 1 +
dev-util/bpftrace/files/bpftrace-0.14.0-fuzzing.patch | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.14.0-r3.ebuild b/dev-util/bpftrace/bpftrace-0.14.0-r3.ebuild
index 4435e4c8379..9f4a31fdf7b 100644
--- a/dev-util/bpftrace/bpftrace-0.14.0-r3.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.14.0-r3.ebuild
@@ -43,6 +43,7 @@ QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
PATCHES=(
"${FILESDIR}/bpftrace-0.14.0-install-libs.patch"
"${FILESDIR}/bpftrace-0.14.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.14.0-fuzzing.patch"
"${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
"${FILESDIR}/bpftrace-0.12.0-fuzzing-build.patch"
)
diff --git a/dev-util/bpftrace/files/bpftrace-0.14.0-fuzzing.patch b/dev-util/bpftrace/files/bpftrace-0.14.0-fuzzing.patch
new file mode 100644
index 00000000000..6c759a9e1ca
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.14.0-fuzzing.patch
@@ -0,0 +1,18 @@
+https://github.com/iovisor/bpftrace/pull/2059
+--- a/src/fuzz_main.cpp
++++ b/src/fuzz_main.cpp
+@@ -17,12 +17,12 @@
+ #include <unistd.h>
+
+ #include "ast/bpforc/bpforc.h"
+-#include "ast/clang_parser.h"
++#include "clang_parser.h"
+ #include "ast/passes/callback_visitor.h"
+ #include "ast/passes/field_analyser.h"
+ #include "ast/passes/semantic_analyser.h"
+ #include "bpftrace.h"
+-#include "codegen_llvm.h"
++#include "ast/passes/codegen_llvm.h"
+ #include "driver.h"
+ #include "log.h"
+ #include "output.h"
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2021-10-26 22:07 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2021-10-26 22:07 UTC (permalink / raw
To: gentoo-commits
commit: 83059a7de54913700cdfe7d36391673c1b7ebcc9
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Tue Oct 26 22:05:35 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Tue Oct 26 22:07:06 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83059a7d
dev-util/bpftrace: bump fix install of ast lib (bug # 784332)
Closes: https://bugs.gentoo.org/784332
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
.../{bpftrace-0.14.0.ebuild => bpftrace-0.14.0-r1.ebuild} | 0
dev-util/bpftrace/files/bpftrace-0.14.0-install-libs.patch | 9 +++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dev-util/bpftrace/bpftrace-0.14.0.ebuild b/dev-util/bpftrace/bpftrace-0.14.0-r1.ebuild
similarity index 100%
rename from dev-util/bpftrace/bpftrace-0.14.0.ebuild
rename to dev-util/bpftrace/bpftrace-0.14.0-r1.ebuild
diff --git a/dev-util/bpftrace/files/bpftrace-0.14.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.14.0-install-libs.patch
index 00d35c6f49e..dc8e8905260 100644
--- a/dev-util/bpftrace/files/bpftrace-0.14.0-install-libs.patch
+++ b/dev-util/bpftrace/files/bpftrace-0.14.0-install-libs.patch
@@ -115,7 +115,7 @@ index 76bb217e..4ad0f626 100644
+
+install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
-index 014295cd..b038aa18 100644
+index 014295cd..c35f6ac6 100644
--- a/src/ast/CMakeLists.txt
+++ b/src/ast/CMakeLists.txt
@@ -1,6 +1,6 @@
@@ -126,13 +126,14 @@ index 014295cd..b038aa18 100644
async_event_types.cpp
attachpoint_parser.cpp
int_parser.cpp
-@@ -20,11 +20,12 @@ add_library(ast
+@@ -20,11 +20,13 @@ add_library(ast
target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src)
target_include_directories(ast_defs PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
target_include_directories(ast_defs PUBLIC ${CMAKE_BINARY_DIR})
-target_link_libraries(ast ast_defs arch bpforc parser)
+target_link_libraries(bpftraceast ast_defs bpftracearch bpforc bpftraceparser)
+install(TARGETS ast_defs LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-add_dependencies(ast_defs parser)
+add_dependencies(ast_defs bpftraceparser)
@@ -142,7 +143,7 @@ index 014295cd..b038aa18 100644
if (STATIC_LINKING)
set(clang_libs
-@@ -55,11 +56,11 @@ if (STATIC_LINKING)
+@@ -55,11 +57,11 @@ if (STATIC_LINKING)
if(EMBED_USE_LLVM)
@@ -157,7 +158,7 @@ index 014295cd..b038aa18 100644
endif()
if(STATIC_LIBC)
-@@ -69,13 +70,13 @@ if (STATIC_LINKING)
+@@ -69,13 +71,13 @@ if (STATIC_LINKING)
else()
find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
if(found_LLVM)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2021-07-09 17:11 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2021-07-09 17:11 UTC (permalink / raw
To: gentoo-commits
commit: be8e4e44dfb0c9dd8521dcdaa886e6efae106556
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 9 17:09:39 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Jul 9 17:11:31 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be8e4e44
dev-util/bpftrace-0.13.0: Version bump
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 +
dev-util/bpftrace/bpftrace-0.13.0.ebuild | 88 +++++++++++++
.../files/bpftrace-0.13.0-install-libs.patch | 143 +++++++++++++++++++++
3 files changed, 232 insertions(+)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index babfffac440..482103e5556 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,2 +1,3 @@
DIST bpftrace-0.11.4.tar.gz 868016 BLAKE2B 50af7b4094e2875905d1ca36c003cde84e51adb11360f7933b82cd004dd7b9a8c2146d11c1422411ec0bb1935a693b17ab6d405aa5569ecabccfc21cdd1ca548 SHA512 611a7e61dbd1f4cc52b7e51a1a143296ff7b2df115b3a28034c674d8eefb5d482cac551ab82d6b7cc2f6fc0668b07d2d9e283dff371fd9a3f649c80113fdca82
DIST bpftrace-0.12.1.tar.gz 938043 BLAKE2B 3599c21d2381265ab5a7a3c0bf142dc7f79acb66fbb4f54b4100d042c21fc3c9e86297522bfe46f82ad5edbc2203314a6b02ff7cc07552c778b0726e681cb993 SHA512 a578499668bd2eb7342689b6c0ef3db6ca263a971d8e6f1b9a68c502c27170d24ede212a0fc2a72263e72aff58924f488a5c80d447397503a08512dc47b63345
+DIST bpftrace-0.13.0.tar.gz 952412 BLAKE2B 8e3f6f28b0c652e2257e1a970b80b87ba5ac5e94dc26719bffe16a0bbff48efc2b9ab5bc03e5fe4b764f5c9c3df16039d931f1f13c1f14327880838a373edacc SHA512 16b3f11c365cc7e306045a5cb6bcf6c66b92d746884f6587ce7cc4c76841b284757bff7b38b9838eb3db129e996e4f1b13afec34da57981362dadef8460816d0
diff --git a/dev-util/bpftrace/bpftrace-0.13.0.ebuild b/dev-util/bpftrace/bpftrace-0.13.0.ebuild
new file mode 100644
index 00000000000..3437f2e80ce
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.13.0.ebuild
@@ -0,0 +1,88 @@
+# Copyright 2019-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs llvm linux-info cmake
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+
+if [[ ${PV} =~ 9{4,} ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/iovisor/${PN}"
+ BDEPEND=""
+else
+ MY_PV="${PV//_/}"
+ SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~x86"
+ BDEPEND="app-arch/xz-utils "
+fi
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="fuzzing test"
+
+COMMON_DEPEND="
+ dev-libs/libbpf:=
+ >=dev-util/bcc-0.13.0:=
+ dev-util/systemtap
+ >=sys-devel/llvm-6:=[llvm_targets_BPF(+)]
+ <=sys-devel/llvm-13:=[llvm_targets_BPF(+)]
+ <=sys-devel/clang-13:=
+ sys-libs/binutils-libs:=
+ virtual/libelf
+"
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-cpp/gtest )
+"
+RDEPEND="${COMMON_DEPEND}"
+BDEPEND+="
+ >=dev-util/cmake-3.8
+ sys-devel/flex
+ sys-devel/bison
+"
+
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.13.0-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.10.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+ "${FILESDIR}/bpftrace-0.12.0-fuzzing-build.patch"
+)
+
+# lots of fixing needed
+RESTRICT="test"
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ LLVM_MAX_SLOT=12 llvm_pkg_setup
+}
+
+src_prepare() {
+ cmake_src_prepare
+}
+
+src_configure() {
+ local -a mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ -DBUILD_TESTING:BOOL=OFF
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ )
+
+ cmake_src_configure
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.13.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.13.0-install-libs.patch
new file mode 100644
index 00000000000..03fd2d13e60
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.13.0-install-libs.patch
@@ -0,0 +1,143 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e33bb1ca..52e1fa25 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -100,9 +100,10 @@ find_package(FLEX REQUIRED)
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index a95c60a1..f5c4d676 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 0361cdaa..f9c536a3 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -49,6 +49,7 @@ add_executable(${BPFTRACE}
+ )
+
+ install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ target_link_libraries(${BPFTRACE} libbpftrace)
+
+ if (BUILD_FUZZ)
+@@ -109,7 +110,7 @@ if(STATIC_LINKING)
+ endif(STATIC_LINKING)
+
+
+-target_link_libraries(libbpftrace parser resources ast arch)
++target_link_libraries(libbpftrace bpftraceparser bpftraceresources bpftraceast bpftracearch)
+
+ if (LIBBPF_BTF_DUMP_FOUND)
+ target_include_directories(libbpftrace PUBLIC ${LIBBPF_INCLUDE_DIRS})
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index 76bb217e..6d243a7e 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,15 +1,15 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
+- add_library(arch s390.cpp)
++ add_library(bpftracearch s390.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
+- add_library(arch mips64.cpp)
++ add_library(bpftracearch mips64.cpp)
+ else()
+ message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index 5234388c..8b40faaa 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-add_library(ast
++add_library(bpftraceast
+ ast.cpp
+ attachpoint_parser.cpp
+ codegen_llvm.cpp
+@@ -13,17 +13,18 @@ add_library(ast
+ signal.cpp
+ visitors.cpp
+ )
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src)
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+-target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast arch)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR})
++target_link_libraries(bpftraceast bpftracearch)
+
+ if (HAVE_BCC_KFUNC)
+- target_compile_definitions(ast PRIVATE HAVE_BCC_KFUNC)
++ target_compile_definitions(bpftraceast PRIVATE HAVE_BCC_KFUNC)
+ endif(HAVE_BCC_KFUNC)
+
+-add_dependencies(ast parser)
++add_dependencies(bpftraceast bpftraceparser)
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -54,11 +55,11 @@ if (STATIC_LINKING)
+
+
+ if(EMBED_USE_LLVM)
+- target_link_libraries(ast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
++ target_link_libraries(bpftraceast "-Wl,--start-group" ${CLANG_EMBEDDED_CMAKE_TARGETS} ${LLVM_EMBEDDED_CMAKE_TARGETS} "-Wl,--end-group")
+ else()
+ llvm_map_components_to_libnames(llvm_libs ${llvm_lib_names})
+- target_link_libraries(ast ${clang_libs})
+- target_link_libraries(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${clang_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+
+ if(STATIC_LIBC)
+@@ -68,11 +69,11 @@ if (STATIC_LINKING)
+ else()
+ find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+ if(found_LLVM)
+- target_link_libraries(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2021-04-19 23:50 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2021-04-19 23:50 UTC (permalink / raw
To: gentoo-commits
commit: 86cdb30121712b13ba63c7f44019e70658a4e278
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Mon Apr 19 23:49:47 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Mon Apr 19 23:49:47 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86cdb301
dev-util/bpftrace-0.12.1: Version bump
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 +
dev-util/bpftrace/bpftrace-0.12.1.ebuild | 89 ++++++++++++
.../files/bpftrace-0.12.0-fuzzing-build.patch | 13 ++
.../files/bpftrace-0.12.0-install-libs.patch | 160 +++++++++++++++++++++
dev-util/bpftrace/metadata.xml | 3 +
5 files changed, 266 insertions(+)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 786d756a582..babfffac440 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1 +1,2 @@
DIST bpftrace-0.11.4.tar.gz 868016 BLAKE2B 50af7b4094e2875905d1ca36c003cde84e51adb11360f7933b82cd004dd7b9a8c2146d11c1422411ec0bb1935a693b17ab6d405aa5569ecabccfc21cdd1ca548 SHA512 611a7e61dbd1f4cc52b7e51a1a143296ff7b2df115b3a28034c674d8eefb5d482cac551ab82d6b7cc2f6fc0668b07d2d9e283dff371fd9a3f649c80113fdca82
+DIST bpftrace-0.12.1.tar.gz 938043 BLAKE2B 3599c21d2381265ab5a7a3c0bf142dc7f79acb66fbb4f54b4100d042c21fc3c9e86297522bfe46f82ad5edbc2203314a6b02ff7cc07552c778b0726e681cb993 SHA512 a578499668bd2eb7342689b6c0ef3db6ca263a971d8e6f1b9a68c502c27170d24ede212a0fc2a72263e72aff58924f488a5c80d447397503a08512dc47b63345
diff --git a/dev-util/bpftrace/bpftrace-0.12.1.ebuild b/dev-util/bpftrace/bpftrace-0.12.1.ebuild
new file mode 100644
index 00000000000..cd944547539
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.12.1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 2019-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs llvm linux-info cmake
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+
+if [[ ${PV} =~ 9{4,} ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/iovisor/${PN}"
+ BDEPEND=""
+else
+ MY_PV="${PV//_/}"
+ SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~x86"
+ BDEPEND="app-arch/xz-utils "
+fi
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="fuzzing test"
+
+COMMON_DEPEND="
+ dev-libs/libbpf:=
+ >=dev-util/bcc-0.13.0:=
+ dev-util/systemtap
+ >=sys-devel/llvm-6:=[llvm_targets_BPF(+)]
+ <=sys-devel/llvm-13:=[llvm_targets_BPF(+)]
+ <=sys-devel/clang-13:=
+ sys-libs/binutils-libs:=
+ virtual/libelf
+"
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-cpp/gtest )
+"
+RDEPEND="${COMMON_DEPEND}"
+BDEPEND+="
+ >=dev-util/cmake-3.8
+ sys-devel/flex
+ sys-devel/bison
+"
+
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.12.0-install-libs.patch"
+ "${FILESDIR}/bpftrace-0.10.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
+ "${FILESDIR}/bpftrace-0.12.0-fuzzing-build.patch"
+)
+
+# lots of fixing needed
+RESTRICT="test"
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+pkg_setup() {
+ LLVM_MAX_SLOT=12 llvm_pkg_setup
+}
+
+src_prepare() {
+ cmake_src_prepare
+}
+
+src_configure() {
+ local -a mycmakeargs=(
+ -DSTATIC_LINKING:BOOL=OFF
+ -DBUILD_TESTING:BOOL=OFF
+ -DBUILD_FUZZ:BOOL=$(usex fuzzing)
+ -DUSE_LIBFUZZER:BOOL=$(usex libfuzzer)
+ )
+
+ cmake_src_configure
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.12.0-fuzzing-build.patch b/dev-util/bpftrace/files/bpftrace-0.12.0-fuzzing-build.patch
new file mode 100644
index 00000000000..30f03eb8ff2
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.12.0-fuzzing-build.patch
@@ -0,0 +1,13 @@
+diff --git a/src/fuzz_main.cpp b/src/fuzz_main.cpp
+index a08d0b03..82127be0 100644
+--- a/src/fuzz_main.cpp
++++ b/src/fuzz_main.cpp
+@@ -135,7 +135,7 @@ int fuzz_main(const char* data, size_t sz)
+ struct utsname utsname;
+ uname(&utsname);
+ std::string ksrc, kobj;
+- auto kdirs = get_kernel_dirs(utsname, !bpftrace.features_->has_btf());
++ auto kdirs = get_kernel_dirs(utsname, !bpftrace.feature_->has_btf());
+ ksrc = std::get<0>(kdirs);
+ kobj = std::get<1>(kdirs);
+
diff --git a/dev-util/bpftrace/files/bpftrace-0.12.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.12.0-install-libs.patch
new file mode 100644
index 00000000000..ef715ea5da8
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.12.0-install-libs.patch
@@ -0,0 +1,160 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e4544559..272ea18d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -92,9 +92,10 @@ find_package(FLEX REQUIRED)
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index a95c60a1..f5c4d676 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 37ee2204..d35574f5 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -145,7 +145,7 @@ if (ALLOW_UNSAFE_PROBE)
+ target_compile_definitions(libbpftrace PRIVATE HAVE_UNSAFE_PROBE)
+ endif(ALLOW_UNSAFE_PROBE)
+
+-target_link_libraries(libbpftrace arch ast parser resources)
++target_link_libraries(libbpftrace bpftracearch bpftraceast bpftraceparser bpftraceresources)
+
+ target_link_libraries(libbpftrace ${LIBBCC_LIBRARIES})
+ if(STATIC_LINKING)
+@@ -194,6 +194,7 @@ if (USE_LIBFUZZER)
+ endif()
+
+ install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS libbpftrace LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ set(KERNEL_HEADERS_DIR "" CACHE PATH "Hard-code kernel headers directory")
+ if (KERNEL_HEADERS_DIR)
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index 76bb217e..6d243a7e 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,15 +1,15 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "s390" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "s390x")
+- add_library(arch s390.cpp)
++ add_library(bpftracearch s390.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64")
+- add_library(arch mips64.cpp)
++ add_library(bpftracearch mips64.cpp)
+ else()
+ message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index 3d444fb4..c2cf84ed 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-add_library(ast
++add_library(bpftraceast
+ ast.cpp
+ attachpoint_parser.cpp
+ callback_visitor.cpp
+@@ -11,17 +11,18 @@ add_library(ast
+ signal.cpp
+ visitors.cpp
+ )
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src)
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+-target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast arch)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR})
++target_link_libraries(bpftraceast bpftracearch)
+
+ if (HAVE_BCC_KFUNC)
+- target_compile_definitions(ast PRIVATE HAVE_BCC_KFUNC)
++ target_compile_definitions(bpftraceast PRIVATE HAVE_BCC_KFUNC)
+ endif(HAVE_BCC_KFUNC)
+
+-add_dependencies(ast parser)
++add_dependencies(bpftraceast bpftraceparser)
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -45,17 +46,17 @@ if (STATIC_LINKING)
+ if(EMBED_LIBCLANG_ONLY)
+ unlink_transitive_dependency("${CLANG_EXPORTED_TARGETS}" "LLVM")
+ endif()
+- target_link_libraries(ast ${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(ast ${LLVM_EMBEDDED_CMAKE_TARGETS})
++ target_link_libraries(bpftraceast ${LLVM_EMBEDDED_CMAKE_TARGETS})
+ else()
+ llvm_map_components_to_libnames(llvm_libs bpfcodegen ipo irreader mcjit option orcjit ${LLVM_TARGETS_TO_BUILD})
+- target_link_libraries(ast ${clang_libs})
+- target_link_libraries(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${clang_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+
+ if(STATIC_LIBC)
+@@ -64,11 +65,11 @@ if (STATIC_LINKING)
+ else()
+ find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+ if(found_LLVM)
+- target_link_libraries(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 8d546f9a..105dcd11 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-add_compile_options("-Wno-undef")
++gdd_compile_options("-Wno-undef")
+ add_compile_options("-Wno-switch-default")
+ add_compile_options("-Wno-switch-enum")
+
diff --git a/dev-util/bpftrace/metadata.xml b/dev-util/bpftrace/metadata.xml
index 777f99f832c..0c520774865 100644
--- a/dev-util/bpftrace/metadata.xml
+++ b/dev-util/bpftrace/metadata.xml
@@ -4,6 +4,9 @@
<maintainer type="person">
<email>chutzpah@gentoo.org</email>
</maintainer>
+ <use>
+ <flag name="fuzzing">Build bpftrace for fuzzing</flag>
+ </use>
<upstream>
<remote-id type="github">iovisor/bpftrace</remote-id>
</upstream>
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2020-11-27 19:01 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2020-11-27 19:01 UTC (permalink / raw
To: gentoo-commits
commit: a9a195700d0c2766fe95ffafb44708882ea9e54e
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Fri Nov 27 19:00:50 2020 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Nov 27 19:01:41 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9a19570
dev-util/bpftrace-0.11.4: Version bump
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-3.0.10, Repoman-3.0.2
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 2 +-
...ace-0.11.3-r1.ebuild => bpftrace-0.11.4.ebuild} | 1 +
.../files/bpftrace-0.11.4-old-kernels.patch | 28 ++++++++++++++++++++++
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 6aab218fe7e..786d756a582 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1 +1 @@
-DIST bpftrace-0.11.3.tar.gz 867967 BLAKE2B 950362e4a4c0f61d67056eacfde0b54a9be9b65285b243cbbb137d113020868f01b1792fddaffbaf41ed174b47cd2f197c0aa89f78690d3e71dae4b7a4c05e3e SHA512 76f6b19ce2a2f3989ebafc49a4df337c6b5f3acf39e7415846b16ee08e2fa7a59821cd18de3c9ed29420b323de8458d1411ccf801e9cd5f3ac64f2bd981e2c3c
+DIST bpftrace-0.11.4.tar.gz 868016 BLAKE2B 50af7b4094e2875905d1ca36c003cde84e51adb11360f7933b82cd004dd7b9a8c2146d11c1422411ec0bb1935a693b17ab6d405aa5569ecabccfc21cdd1ca548 SHA512 611a7e61dbd1f4cc52b7e51a1a143296ff7b2df115b3a28034c674d8eefb5d482cac551ab82d6b7cc2f6fc0668b07d2d9e283dff371fd9a3f649c80113fdca82
diff --git a/dev-util/bpftrace/bpftrace-0.11.3-r1.ebuild b/dev-util/bpftrace/bpftrace-0.11.4.ebuild
similarity index 96%
rename from dev-util/bpftrace/bpftrace-0.11.3-r1.ebuild
rename to dev-util/bpftrace/bpftrace-0.11.4.ebuild
index b941fc56d71..a3a1fb79701 100644
--- a/dev-util/bpftrace/bpftrace-0.11.3-r1.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.11.4.ebuild
@@ -48,6 +48,7 @@ QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
PATCHES=(
"${FILESDIR}/bpftrace-0.11.0-install-libs.patch"
"${FILESDIR}/bpftrace-0.10.0-dont-compress-man.patch"
+ "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
)
# lots of fixing needed
diff --git a/dev-util/bpftrace/files/bpftrace-0.11.4-old-kernels.patch b/dev-util/bpftrace/files/bpftrace-0.11.4-old-kernels.patch
new file mode 100644
index 00000000000..831de6487a8
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.11.4-old-kernels.patch
@@ -0,0 +1,28 @@
+diff --git a/src/btf.h b/src/btf.h
+index 61579a3..4e9f9fc 100644
+--- a/src/btf.h
++++ b/src/btf.h
+@@ -2,6 +2,7 @@
+
+ #include "types.h"
+ #include <linux/types.h>
++#include <linux/version.h>
+ #include <map>
+ #include <regex>
+ #include <string>
+@@ -11,6 +12,15 @@
+ struct btf;
+ struct btf_type;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)
++/* this is required to build with 5.4 and earlier kernel headers */
++enum btf_func_linkage {
++ BTF_FUNC_STATIC = 0,
++ BTF_FUNC_GLOBAL = 1,
++ BTF_FUNC_EXTERN = 2,
++};
++#endif
++
+ namespace bpftrace {
+
+ class BTF
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2020-06-20 19:23 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2020-06-20 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 9071888928b0b9d61e061fea79e4bd8f60eeab01
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 20 19:21:58 2020 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Sat Jun 20 19:21:58 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90718889
dev-util/bpftrace-0.10.0-r1: Fix build with bcc-0.15.0
Package-Manager: Portage-2.3.101, Repoman-2.3.22
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild | 2 ++
.../files/bpftrace-0.10.0-no-bpf_detach_kfunc.patch | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild
index 196615ab2a9..26c1753afef 100644
--- a/dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.10.0-r1.ebuild
@@ -45,6 +45,8 @@ 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"
+ # bpf_detach_kfunc has always been a noop
+ "${FILESDIR}/bpftrace-0.10.0-no-bpf_detach_kfunc.patch"
)
# lots of fixing needed
diff --git a/dev-util/bpftrace/files/bpftrace-0.10.0-no-bpf_detach_kfunc.patch b/dev-util/bpftrace/files/bpftrace-0.10.0-no-bpf_detach_kfunc.patch
new file mode 100644
index 00000000000..145fb1c0ca9
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.10.0-no-bpf_detach_kfunc.patch
@@ -0,0 +1,13 @@
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index c7e789e..08f657e 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -116,7 +116,7 @@ void AttachedProbe::attach_kfunc(void)
+ int AttachedProbe::detach_kfunc(void)
+ {
+ close(tracing_fd_);
+- return bpf_detach_kfunc(progfd_, NULL);
++ return 0;
+ }
+ #else
+ void AttachedProbe::attach_kfunc(void)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2020-04-14 2:07 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2020-04-14 2:07 UTC (permalink / raw
To: gentoo-commits
commit: 0c4e0935e4b4dfda5ed69460a0b6812bd91e8216
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Mon Apr 13 23:14:40 2020 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Tue Apr 14 01:23:27 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c4e0935
dev-util/bpftrace-0.10.0: Version bump
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 +
dev-util/bpftrace/bpftrace-0.10.0.ebuild | 75 +++++++++++
.../files/bpftrace-0.10.0-dont-compress-man.patch | 18 +++
.../files/bpftrace-0.10.0-install-libs.patch | 148 +++++++++++++++++++++
4 files changed, 242 insertions(+)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 2414ad795d3..44a6444f74b 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,3 +1,4 @@
+DIST bpftrace-0.10.0.tar.gz 835854 BLAKE2B 623369bb2a2ad8d5eec364afa98bdae3fbe5e66182d8f1187fe86a8bd70ee357a554eb063fdbe5476eab23912adf2cf027092cac3e6989d8f716e91aa5d01212 SHA512 da400efe78cea505a32deead594b047ec4394d3eefe86e7b6853fe2dc715c5847a3abcbd26c1fac39d0a534f1e57d6c0bc3625e0c3f1054b0d84b7b1d6eb69b9
DIST bpftrace-0.9.2.tar.gz 715019 BLAKE2B 1f20998bd379b91cb46d7e856a5d892e0de7ad6d9f85cb657fcf6a0c879167c0931d28c78e4be98adab349144fe0bc99871cf70556dd1998e5b8f918fa1702e3 SHA512 5c6ee5fec690a907c370ed0bed85906d304215d7f97b99a2cae90453061f522fa6369627c9524a5a24e97c6cbb595a880a2a1b1d71095fffb693a4cef172a6f0
DIST bpftrace-0.9.3.tar.gz 743506 BLAKE2B d00708bcebaf7f039788dfc52f4a0bb501bb3c52e8b789060f824652b3917ea3950d77dbc7bee04da013f4b552338251bda9781d19a03ec227208b943fded232 SHA512 49b12735fe2fbf4f72d3d0c0372a7a570c7abc92d1f626624d591a863009c8bfabdf86825f133885800c7ea293773651be66e4c792f9cd397f82d250a7af83be
DIST bpftrace-0.9.4.tar.gz 792253 BLAKE2B d34d390a612825141b86ba14482f06820c88bea76580c53c17d19a6480c0e2a5656531f39b79fbcea4e004ecd3eea36877560f22fac584f36a3dffa1e7fe96c5 SHA512 d2b32235fa81d6f06771df32877388a9105230adfc638b0d0ebf4f11a567246e8514d93c14da9c7008dbacd6b2c4108604fc5a2721ef831efa5c596cbe50b1da
diff --git a/dev-util/bpftrace/bpftrace-0.10.0.ebuild b/dev-util/bpftrace/bpftrace-0.10.0.ebuild
new file mode 100644
index 00000000000..3070afa1505
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.10.0.ebuild
@@ -0,0 +1,75 @@
+# Copyright 2019-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs linux-info cmake-utils
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+
+if [[ ${PV} =~ 9{4,} ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/iovisor/${PN}"
+ BDEPEND=""
+else
+ MY_PV="${PV//_/}"
+ SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~x86"
+ BDEPEND="app-arch/xz-utils "
+fi
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="test"
+
+COMMON_DEPEND="dev-util/systemtap
+ sys-devel/clang:=
+ dev-libs/libbpf:=
+ >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)]
+ >=dev-util/bcc-0.12.0:=
+ virtual/libelf"
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-cpp/gtest )"
+RDEPEND="${COMMON_DEPEND}"
+BDEPEND+="dev-util/cmake
+ sys-devel/flex
+ sys-devel/bison"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+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"
+)
+
+# lots of fixing needed
+RESTRICT="test"
+
+pkg_pretend() {
+ local CONFIG_CHECK="
+ ~BPF
+ ~BPF_EVENTS
+ ~BPF_JIT
+ ~BPF_SYSCALL
+ ~FTRACE_SYSCALLS
+ ~HAVE_EBPF_JIT
+ "
+
+ check_extra_config
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+}
+
+src_configure() {
+ local -a mycmakeargs
+ mycmakeargs=(
+ "-DSTATIC_LINKING:BOOL=OFF"
+ "-DBUILD_TESTING:BOOL=OFF"
+ )
+
+ cmake-utils_src_configure
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.10.0-dont-compress-man.patch b/dev-util/bpftrace/files/bpftrace-0.10.0-dont-compress-man.patch
new file mode 100644
index 00000000000..750ed4f712a
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.10.0-dont-compress-man.patch
@@ -0,0 +1,18 @@
+diff --git a/man/man8/CMakeLists.txt b/man/man8/CMakeLists.txt
+index f1fc334..7ee58ed 100644
+--- a/man/man8/CMakeLists.txt
++++ b/man/man8/CMakeLists.txt
+@@ -1,12 +1,3 @@
+-find_program(GZIP gzip)
+ file(GLOB FILES *.8)
+-set(GZFILES "")
+-foreach(FIL ${FILES})
+- get_filename_component(NAME ${FIL} NAME)
+- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
+- COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
+- DEPENDS ${FIL})
+- list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz")
+-endforeach()
+ add_custom_target(man ALL DEPENDS ${GZFILES})
+-install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
++install(FILES ${FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
diff --git a/dev-util/bpftrace/files/bpftrace-0.10.0-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.10.0-install-libs.patch
new file mode 100644
index 00000000000..cf5ed9d76b9
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.10.0-install-libs.patch
@@ -0,0 +1,148 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e89a6a9..efa2ff3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -90,9 +90,10 @@ find_package(FLEX REQUIRED)
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index a95c60a..f5c4d67 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 4fa0418..4d0c2a9 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -75,7 +75,8 @@ if (ALLOW_UNSAFE_PROBE)
+ target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+ endif(ALLOW_UNSAFE_PROBE)
+
+-target_link_libraries(bpftrace arch ast parser resources)
++target_link_libraries(bpftrace bpftracearch bpftraceast bpftraceparser
++ bpftraceresources)
+
+ target_link_libraries(bpftrace ${LIBBCC_LIBRARIES})
+ if(STATIC_LINKING)
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index 7156276..32faeae 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,10 +1,12 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ else()
+ message(FATAL_ERROR "Unsupported architecture: {CMAKE_SYSTEM_PROCESSOR}")
+ endif()
++
++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index 0d58cd9..e33d585 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-add_library(ast
++add_library(bpftraceast
+ ast.cpp
+ attachpoint_parser.cpp
+ codegen_llvm.cpp
+@@ -8,16 +8,17 @@ add_library(ast
+ semantic_analyser.cpp
+ )
+
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src)
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+-target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast arch)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR})
++target_link_libraries(bpftraceast bpftracearch)
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ if (HAVE_KFUNC)
+- target_compile_definitions(ast PRIVATE HAVE_KFUNC)
++ target_compile_definitions(bpftraceast PRIVATE HAVE_KFUNC)
+ endif(HAVE_KFUNC)
+
+-add_dependencies(ast parser)
++add_dependencies(bpftraceast bpftraceparser)
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -41,26 +42,26 @@ if (STATIC_LINKING)
+ if(EMBED_LIBCLANG_ONLY)
+ unlink_transitive_dependency("${CLANG_EXPORTED_TARGETS}" "LLVM")
+ endif()
+- target_link_libraries(ast ${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(ast ${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(ast ${clang_libs})
+- target_link_libraries(ast ${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(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 56bcb4a..3f874f8 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -93,7 +93,8 @@ if(HAVE_BFD_DISASM)
+ endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
+
+-target_link_libraries(bpftrace_test arch ast parser resources)
++target_link_libraries(bpftrace_test bpftracearch bpftraceast bpftraceparser
++ bpftraceresources)
+
+ target_link_libraries(bpftrace_test ${LIBBCC_LIBRARIES})
+ if (STATIC_LINKING)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2020-03-09 6:01 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2020-03-09 6:01 UTC (permalink / raw
To: gentoo-commits
commit: a283a68e01eee195c32fb3fe69808ff5111ed6c5
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 9 06:01:14 2020 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Mon Mar 9 06:01:30 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a283a68e
dev-util/bpftrace-0.9.4: Fix build with llvm-10
Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.9.4.ebuild | 1 +
.../bpftrace/files/bpftrace-0.9.4-llvm-10.patch | 144 +++++++++++++++++++++
2 files changed, 145 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.9.4.ebuild b/dev-util/bpftrace/bpftrace-0.9.4.ebuild
index 0afc8a9890f..ad25d1221e1 100644
--- a/dev-util/bpftrace/bpftrace-0.9.4.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.9.4.ebuild
@@ -40,6 +40,7 @@ S="${WORKDIR}/${PN}-${MY_PV}"
QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
PATCHES=(
+ "${FILESDIR}/bpftrace-0.9.4-llvm-10.patch"
"${FILESDIR}/bpftrace-0.9.4-install-libs.patch"
"${FILESDIR}/bpftrace-mandir.patch"
)
diff --git a/dev-util/bpftrace/files/bpftrace-0.9.4-llvm-10.patch b/dev-util/bpftrace/files/bpftrace-0.9.4-llvm-10.patch
new file mode 100644
index 00000000000..c2131cbbc30
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.9.4-llvm-10.patch
@@ -0,0 +1,144 @@
+diff --git a/src/ast/codegen_llvm.cpp b/src/ast/codegen_llvm.cpp
+index f81906c..bcc2c7d 100644
+--- a/src/ast/codegen_llvm.cpp
++++ b/src/ast/codegen_llvm.cpp
+@@ -41,7 +41,7 @@ void CodegenLLVM::visit(PositionalParameter ¶m)
+ {
+ Constant *const_str = ConstantDataArray::getString(module_->getContext(), pstr, true);
+ AllocaInst *buf = b_.CreateAllocaBPF(ArrayType::get(b_.getInt8Ty(), pstr.length() + 1), "str");
+- b_.CreateMemSet(buf, b_.getInt8(0), pstr.length() + 1, 1);
++ b_.CREATE_MEMSET(buf, b_.getInt8(0), pstr.length() + 1, 1);
+ b_.CreateStore(const_str, buf);
+ expr_ = buf;
+ }
+@@ -156,7 +156,7 @@ void CodegenLLVM::visit(Builtin &builtin)
+ {
+ AllocaInst *buf = b_.CreateAllocaBPF(builtin.type, "comm");
+ // initializing memory needed for older kernels:
+- b_.CreateMemSet(buf, b_.getInt8(0), builtin.type.size, 1);
++ b_.CREATE_MEMSET(buf, b_.getInt8(0), builtin.type.size, 1);
+ b_.CreateGetCurrentComm(buf, builtin.type.size);
+ expr_ = buf;
+ }
+@@ -189,7 +189,7 @@ void CodegenLLVM::visit(Builtin &builtin)
+ if (builtin.type.type == Type::usym)
+ {
+ AllocaInst *buf = b_.CreateAllocaBPF(builtin.type, "func");
+- b_.CreateMemSet(buf, b_.getInt8(0), builtin.type.size, 1);
++ b_.CREATE_MEMSET(buf, b_.getInt8(0), builtin.type.size, 1);
+ Value *pid = b_.CreateLShr(b_.CreateGetPidTgid(), 32);
+ Value *addr_offset = b_.CreateGEP(buf, b_.getInt64(0));
+ Value *pid_offset = b_.CreateGEP(buf, {b_.getInt64(0), b_.getInt64(8)});
+@@ -444,7 +444,7 @@ void CodegenLLVM::visit(Call &call)
+ else if (call.func == "str")
+ {
+ AllocaInst *strlen = b_.CreateAllocaBPF(b_.getInt64Ty(), "strlen");
+- b_.CreateMemSet(strlen, b_.getInt8(0), sizeof(uint64_t), 1);
++ b_.CREATE_MEMSET(strlen, b_.getInt8(0), sizeof(uint64_t), 1);
+ if (call.vargs->size() > 1) {
+ call.vargs->at(1)->accept(*this);
+ Value *proposed_strlen = b_.CreateAdd(expr_, b_.getInt64(1)); // add 1 to accommodate probe_read_str's null byte
+@@ -462,7 +462,7 @@ void CodegenLLVM::visit(Call &call)
+ b_.CreateStore(b_.getInt64(bpftrace_.strlen_), strlen);
+ }
+ AllocaInst *buf = b_.CreateAllocaBPF(bpftrace_.strlen_, "str");
+- b_.CreateMemSet(buf, b_.getInt8(0), bpftrace_.strlen_, 1);
++ b_.CREATE_MEMSET(buf, b_.getInt8(0), bpftrace_.strlen_, 1);
+ call.vargs->front()->accept(*this);
+ b_.CreateProbeReadStr(buf, b_.CreateLoad(strlen), expr_);
+ b_.CreateLifetimeEnd(strlen);
+@@ -541,7 +541,7 @@ void CodegenLLVM::visit(Call &call)
+ {
+ // store uint64_t[2] with: [0]: (uint64_t)addr, [1]: (uint64_t)pid
+ AllocaInst *buf = b_.CreateAllocaBPF(call.type, "usym");
+- b_.CreateMemSet(buf, b_.getInt8(0), call.type.size, 1);
++ b_.CREATE_MEMSET(buf, b_.getInt8(0), call.type.size, 1);
+ Value *pid = b_.CreateLShr(b_.CreateGetPidTgid(), 32);
+ Value *addr_offset = b_.CreateGEP(buf, b_.getInt64(0));
+ Value *pid_offset = b_.CreateGEP(buf, {b_.getInt64(0), b_.getInt64(8)});
+@@ -592,7 +592,7 @@ void CodegenLLVM::visit(Call &call)
+ b_.CreateStore(af_type, af_offset);
+
+ Value *inet_offset = b_.CreateGEP(buf, {b_.getInt32(0), b_.getInt32(1)});
+- b_.CreateMemSet(inet_offset, b_.getInt8(0), 16, 1);
++ b_.CREATE_MEMSET(inet_offset, b_.getInt8(0), 16, 1);
+
+ inet->accept(*this);
+ if (inet->type.type == Type::array)
+@@ -663,7 +663,7 @@ void CodegenLLVM::visit(Call &call)
+ auto &map = static_cast<Map&>(arg);
+ Constant *const_str = ConstantDataArray::getString(module_->getContext(), map.ident, true);
+ AllocaInst *str_buf = b_.CreateAllocaBPF(ArrayType::get(b_.getInt8Ty(), map.ident.length() + 1), "str");
+- b_.CreateMemSet(str_buf, b_.getInt8(0), map.ident.length() + 1, 1);
++ b_.CREATE_MEMSET(str_buf, b_.getInt8(0), map.ident.length() + 1, 1);
+ b_.CreateStore(const_str, str_buf);
+ ArrayType *perfdata_type = ArrayType::get(b_.getInt8Ty(), sizeof(uint64_t) + 2 * sizeof(uint64_t) + map.ident.length() + 1);
+ AllocaInst *perfdata = b_.CreateAllocaBPF(perfdata_type, "perfdata");
+@@ -707,7 +707,7 @@ void CodegenLLVM::visit(Call &call)
+ auto &map = static_cast<Map&>(arg);
+ Constant *const_str = ConstantDataArray::getString(module_->getContext(), map.ident, true);
+ AllocaInst *str_buf = b_.CreateAllocaBPF(ArrayType::get(b_.getInt8Ty(), map.ident.length() + 1), "str");
+- b_.CreateMemSet(str_buf, b_.getInt8(0), map.ident.length() + 1, 1);
++ b_.CREATE_MEMSET(str_buf, b_.getInt8(0), map.ident.length() + 1, 1);
+ b_.CreateStore(const_str, str_buf);
+ ArrayType *perfdata_type = ArrayType::get(b_.getInt8Ty(), sizeof(uint64_t) + map.ident.length() + 1);
+ AllocaInst *perfdata = b_.CreateAllocaBPF(perfdata_type, "perfdata");
+@@ -1204,7 +1204,7 @@ void CodegenLLVM::visit(FieldAccess &acc)
+ {
+ AllocaInst *dst = b_.CreateAllocaBPF(field.type, type.cast_type + "." + acc.field);
+ // memset so verifier doesn't complain about reading uninitialized stack
+- b_.CreateMemSet(dst, b_.getInt8(0), field.type.size, 1);
++ b_.CREATE_MEMSET(dst, b_.getInt8(0), field.type.size, 1);
+ b_.CreateProbeRead(dst, field.bitfield.read_bytes, src);
+ Value *raw = b_.CreateLoad(dst);
+ Value *shifted = b_.CreateLShr(raw, field.bitfield.access_rshift);
+@@ -1906,7 +1906,7 @@ void CodegenLLVM::createFormatStringCall(Call &call, int &id, CallArgs &call_arg
+ }
+
+ AllocaInst *fmt_args = b_.CreateAllocaBPF(fmt_struct, call_name + "_args");
+- b_.CreateMemSet(fmt_args, b_.getInt8(0), struct_size, 1);
++ b_.CREATE_MEMSET(fmt_args, b_.getInt8(0), struct_size, 1);
+
+ Value *id_offset = b_.CreateGEP(fmt_args, {b_.getInt32(0), b_.getInt32(0)});
+ b_.CreateStore(b_.getInt64(id + asyncactionint(async_action)), id_offset);
+diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
+index eb84f7b..5dd72d0 100644
+--- a/src/ast/irbuilderbpf.cpp
++++ b/src/ast/irbuilderbpf.cpp
+@@ -82,7 +82,7 @@ AllocaInst *IRBuilderBPF::CreateAllocaBPFInit(const SizedType &stype, const std:
+ }
+ else
+ {
+- CreateMemSet(alloca, getInt64(0), stype.size, 1);
++ CREATE_MEMSET(alloca, getInt64(0), stype.size, 1);
+ }
+
+ restoreIP(ip);
+@@ -226,7 +226,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(int mapfd, AllocaInst *key, SizedType &
+
+ SetInsertPoint(lookup_failure_block);
+ if (is_array)
+- CreateMemSet(value, getInt8(0), type.size, 1);
++ CREATE_MEMSET(value, getInt8(0), type.size, 1);
+ else
+ CreateStore(getInt64(0), value);
+ CreateBr(lookup_merge_block);
+diff --git a/src/ast/irbuilderbpf.h b/src/ast/irbuilderbpf.h
+index 58e6882..6b2e7f1 100644
+--- a/src/ast/irbuilderbpf.h
++++ b/src/ast/irbuilderbpf.h
+@@ -18,6 +18,14 @@
+ #error Unsupported LLVM version
+ #endif
+
++#if LLVM_VERSION_MAJOR >= 10
++#define CREATE_MEMSET(ptr, val, size, align) \
++ CreateMemSet((ptr), (val), (size), MaybeAlign((align)))
++#else
++#define CREATE_MEMSET(ptr, val, size, align) \
++ CreateMemSet((ptr), (val), (size), (align))
++#endif
++
+ namespace bpftrace {
+ namespace ast {
+
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2019-11-21 18:29 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2019-11-21 18:29 UTC (permalink / raw
To: gentoo-commits
commit: 924df95fef37df58ebba2b4a162a66c5408dcfe9
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Thu Nov 21 18:29:20 2019 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Thu Nov 21 18:29:20 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=924df95f
dev-util/bpftrace: remove old
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 2 -
dev-util/bpftrace/bpftrace-0.9-r1.ebuild | 66 ------------
dev-util/bpftrace/bpftrace-0.9.1.ebuild | 68 -------------
dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch | 30 ------
.../bpftrace-0.9_pre20190311-install-libs.patch | 111 ---------------------
5 files changed, 277 deletions(-)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
index 2b07beb3911..f81c8a38367 100644
--- a/dev-util/bpftrace/Manifest
+++ b/dev-util/bpftrace/Manifest
@@ -1,4 +1,2 @@
-DIST bpftrace-0.9.1.tar.gz 704365 BLAKE2B 03c73eac9cc116df916536239124a6a649aa1a390c97848baedaf5b329f5eda8752c9e39053e741a485d623240954f6659099f0c0ab65cc4bbf00fc6e52d0b46 SHA512 e813c598b3acb85d94e1cb02f75b5fa849f10ee1cc39fb73e843a797946d7642463bcc3d083ff377d68b9e2a1aabb56995ab4ebe2be822f4f393448c7f02ca4b
DIST bpftrace-0.9.2.tar.gz 715019 BLAKE2B 1f20998bd379b91cb46d7e856a5d892e0de7ad6d9f85cb657fcf6a0c879167c0931d28c78e4be98adab349144fe0bc99871cf70556dd1998e5b8f918fa1702e3 SHA512 5c6ee5fec690a907c370ed0bed85906d304215d7f97b99a2cae90453061f522fa6369627c9524a5a24e97c6cbb595a880a2a1b1d71095fffb693a4cef172a6f0
DIST bpftrace-0.9.3.tar.gz 743506 BLAKE2B d00708bcebaf7f039788dfc52f4a0bb501bb3c52e8b789060f824652b3917ea3950d77dbc7bee04da013f4b552338251bda9781d19a03ec227208b943fded232 SHA512 49b12735fe2fbf4f72d3d0c0372a7a570c7abc92d1f626624d591a863009c8bfabdf86825f133885800c7ea293773651be66e4c792f9cd397f82d250a7af83be
-DIST bpftrace-0.9.tar.gz 668655 BLAKE2B 650756ed7334cb92a64adc36a0bd86fff5c16c53fb94d57cc570dd3cd893d467e754da80c98da36c1ec1d14327fa6025b194d963e4a2d1bec99ebb868555b6bc SHA512 771c412a6b1ee7a7d5bba9e0910633056c6f5523e5d1efd9d7ccb5b9f9b462b7bda8d170c5ed0653f3c1bfd5cc77fce2fd552f12eb8222a8747620b3dc9b49f8
diff --git a/dev-util/bpftrace/bpftrace-0.9-r1.ebuild b/dev-util/bpftrace/bpftrace-0.9-r1.ebuild
deleted file mode 100644
index 74351e85e8c..00000000000
--- a/dev-util/bpftrace/bpftrace-0.9-r1.ebuild
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit toolchain-funcs linux-info cmake-utils
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-
-if [[ ${PV} =~ 9{4,} ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/iovisor/${PN}"
- BDEPEND=""
-else
- SRC_URI="https://github.com/iovisor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
- KEYWORDS="~amd64 ~arm64 ~x86"
- BDEPEND="app-arch/xz-utils "
-fi
-
-LICENSE="Apache-2.0"
-SLOT="0"
-IUSE="test"
-
-COMMON_DEPEND="sys-devel/clang:=
- dev-libs/libbpf:=
- >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)]
- >=dev-util/bcc-0.9.0:=
- virtual/libelf"
-DEPEND="${COMMON_DEPEND}
- test? ( dev-cpp/gtest )"
-RDEPEND="${COMMON_DEPEND}"
-BDEPEND+="dev-util/cmake
- sys-devel/flex
- sys-devel/bison"
-
-QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.9_pre20190311-install-libs.patch"
- "${FILESDIR}/bpftrace-mandir.patch"
- "${FILESDIR}/bpftrace-0.9-llvm-8.patch"
-)
-
-# lots of fixing needed
-RESTRICT="test"
-
-pkg_pretend() {
- local CONFIG_CHECK="~BPF ~BPF_SYSCALL ~BPF_JIT ~BPF_EVENTS"
-
- check_extra_config
-}
-
-src_prepare() {
- cmake-utils_src_prepare
-}
-
-src_configure() {
- local -a mycmakeargs
- mycmakeargs=(
- "-DSTATIC_LINKING:BOOL=OFF"
- "-DBUILD_TESTING:BOOL=OFF"
- )
-
- cmake-utils_src_configure
-}
diff --git a/dev-util/bpftrace/bpftrace-0.9.1.ebuild b/dev-util/bpftrace/bpftrace-0.9.1.ebuild
deleted file mode 100644
index 5fcb41040f5..00000000000
--- a/dev-util/bpftrace/bpftrace-0.9.1.ebuild
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright 2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit toolchain-funcs linux-info cmake-utils
-
-DESCRIPTION="High-level tracing language for eBPF"
-HOMEPAGE="https://github.com/iovisor/bpftrace"
-
-if [[ ${PV} =~ 9{4,} ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/iovisor/${PN}"
- BDEPEND=""
-else
- MY_PV="${PV//_/}"
- SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
- KEYWORDS="~amd64 ~arm64 ~x86"
- BDEPEND="app-arch/xz-utils "
-fi
-
-LICENSE="Apache-2.0"
-SLOT="0"
-IUSE="test"
-
-COMMON_DEPEND="dev-util/systemtap
- sys-devel/clang:=
- dev-libs/libbpf:=
- >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)]
- >=dev-util/bcc-0.10.0:=
- virtual/libelf"
-DEPEND="${COMMON_DEPEND}
- test? ( dev-cpp/gtest )"
-RDEPEND="${COMMON_DEPEND}"
-BDEPEND+="dev-util/cmake
- sys-devel/flex
- sys-devel/bison"
-
-S="${WORKDIR}/${PN}-${MY_PV}"
-QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
-
-PATCHES=(
- "${FILESDIR}/bpftrace-0.10_pre20190614-install-libs.patch"
- "${FILESDIR}/bpftrace-mandir.patch"
-)
-
-# lots of fixing needed
-RESTRICT="test"
-
-pkg_pretend() {
- local CONFIG_CHECK="~BPF ~BPF_SYSCALL ~BPF_JIT ~BPF_EVENTS"
-
- check_extra_config
-}
-
-src_prepare() {
- cmake-utils_src_prepare
-}
-
-src_configure() {
- local -a mycmakeargs
- mycmakeargs=(
- "-DSTATIC_LINKING:BOOL=OFF"
- "-DBUILD_TESTING:BOOL=OFF"
- )
-
- cmake-utils_src_configure
-}
diff --git a/dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch b/dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch
deleted file mode 100644
index 14d6a167a86..00000000000
--- a/dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/src/bpforc.h b/src/bpforc.h
-index a6ee583..8d0e579 100644
---- a/src/bpforc.h
-+++ b/src/bpforc.h
-@@ -80,8 +80,13 @@ class BpfOrc
- ExecutionSession ES;
- std::unique_ptr<TargetMachine> TM;
- std::shared_ptr<SymbolResolver> Resolver;
-+#if LLVM_VERSION_MAJOR >= 8
-+ LegacyRTDyldObjectLinkingLayer ObjectLayer;
-+ LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
-+#else
- RTDyldObjectLinkingLayer ObjectLayer;
- IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
-+#endif
-
- public:
- std::map<std::string, std::tuple<uint8_t *, uintptr_t>> sections_;
-@@ -91,7 +96,11 @@ class BpfOrc
- Resolver(createLegacyLookupResolver(ES,
- [](const std::string &Name __attribute__((unused))) -> JITSymbol { return nullptr; },
- [](Error Err) { cantFail(std::move(Err), "lookup failed"); })),
-+#if LLVM_VERSION_MAJOR >= 8
-+ ObjectLayer(ES, [this](VModuleKey) { return LegacyRTDyldObjectLinkingLayer::Resources{std::make_shared<MemoryManager>(sections_), Resolver}; }),
-+#else
- ObjectLayer(ES, [this](VModuleKey) { return RTDyldObjectLinkingLayer::Resources{std::make_shared<MemoryManager>(sections_), Resolver}; }),
-+#endif
- CompileLayer(ObjectLayer, SimpleCompiler(*TM)) {}
-
- void compileModule(std::unique_ptr<Module> M) {
diff --git a/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch
deleted file mode 100644
index 68bd8255944..00000000000
--- a/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8ff6e1f..a276ba2 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -43,9 +43,10 @@ find_package(FLEX REQUIRED)
- bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc)
- flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
- add_flex_bison_dependency(flex_lexer bison_parser)
--add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
--target_compile_options(parser PRIVATE "-w")
--target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
-+add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
-+target_compile_options(bpftraceparser PRIVATE "-w")
-+target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
-+install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- include(CheckSymbolExists)
- set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
-diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
-index b8b0d96..0803c1e 100644
---- a/resources/CMakeLists.txt
-+++ b/resources/CMakeLists.txt
-@@ -1,6 +1,7 @@
--add_library(resources headers.cpp)
-+add_library(bpftraceresources headers.cpp)
-
--target_include_directories(resources PUBLIC ../src)
-+target_include_directories(bpftraceresources PUBLIC ../src)
-+install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- function(embed_headers output)
- file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index b47f66d..36de26b 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -27,7 +27,8 @@ endif(HAVE_BCC_CREATE_MAP)
- if(HAVE_GET_CURRENT_CGROUP_ID)
- target_compile_definitions(bpftrace PRIVATE HAVE_GET_CURRENT_CGROUP_ID)
- endif(HAVE_GET_CURRENT_CGROUP_ID)
--target_link_libraries(bpftrace arch ast parser resources)
-+target_link_libraries(bpftrace bpftracearch bpftraceast bpftraceparser
-+ bpftraceresources)
-
- if (STATIC_LINKING)
- target_link_libraries(bpftrace ${LIBBCC_LIBRARIES})
-diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
-index 425926e..13b5d31 100644
---- a/src/arch/CMakeLists.txt
-+++ b/src/arch/CMakeLists.txt
-@@ -1,5 +1,7 @@
- if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
-- add_library(arch aarch64.cpp)
-+ add_library(bpftracearch aarch64.cpp)
- else()
-- add_library(arch x86_64.cpp)
-+ add_library(bpftracearch x86_64.cpp)
- endif()
-+
-+install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
-index 64db7b9..1a2eb6e 100644
---- a/src/ast/CMakeLists.txt
-+++ b/src/ast/CMakeLists.txt
-@@ -1,4 +1,4 @@
--add_library(ast
-+add_library(bpftraceast
- ast.cpp
- codegen_llvm.cpp
- irbuilderbpf.cpp
-@@ -6,12 +6,13 @@ add_library(ast
- semantic_analyser.cpp
- )
-
--target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src)
--target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
--target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR})
--target_link_libraries(ast arch)
-+target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src)
-+target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
-+target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR})
-+target_link_libraries(bpftraceast bpftracearch)
-
--add_dependencies(ast parser)
-+add_dependencies(bpftraceast bpftraceparser)
-+install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- if (STATIC_LINKING)
- set(clang_libs
-@@ -31,16 +32,16 @@ if (STATIC_LINKING)
- clangSerialization
- clangToolingCore)
- llvm_map_components_to_libnames(llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD})
-- target_link_libraries(ast ${clang_libs})
-- target_link_libraries(ast ${llvm_libs})
-+ target_link_libraries(bpftraceast ${clang_libs})
-+ target_link_libraries(bpftraceast ${llvm_libs})
- else()
- find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
- if(found_LLVM)
-- target_link_libraries(ast 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(ast ${llvm_libs})
-+ target_link_libraries(bpftraceast ${llvm_libs})
- endif()
-- target_link_libraries(ast libclang)
-+ target_link_libraries(bpftraceast libclang)
- endif()
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2019-03-20 21:27 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2019-03-20 21:27 UTC (permalink / raw
To: gentoo-commits
commit: 57cdeba2f33699aa5b5914165130776d8230b71f
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Wed Mar 20 21:27:23 2019 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Wed Mar 20 21:27:46 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57cdeba2
dev-util/bpftrace: Fix compilation with llvm-8 in 0.9
Patch taken from upstream PR:
https://github.com/iovisor/bpftrace/pull/210
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/bpftrace-0.9.ebuild | 1 +
dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch | 30 +++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/dev-util/bpftrace/bpftrace-0.9.ebuild b/dev-util/bpftrace/bpftrace-0.9.ebuild
index b483aed0116..1f481b0f3e2 100644
--- a/dev-util/bpftrace/bpftrace-0.9.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.9.ebuild
@@ -38,6 +38,7 @@ QA_DT_NEEDED="/usr/lib.*/libbpftraceresources.so"
PATCHES=(
"${FILESDIR}/bpftrace-0.9_pre20190311-install-libs.patch"
"${FILESDIR}/bpftrace-mandir.patch"
+ "${FILESDIR}/bpftrace-0.9-llvm-8.patch"
)
# lots of fixing needed
diff --git a/dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch b/dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch
new file mode 100644
index 00000000000..14d6a167a86
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.9-llvm-8.patch
@@ -0,0 +1,30 @@
+diff --git a/src/bpforc.h b/src/bpforc.h
+index a6ee583..8d0e579 100644
+--- a/src/bpforc.h
++++ b/src/bpforc.h
+@@ -80,8 +80,13 @@ class BpfOrc
+ ExecutionSession ES;
+ std::unique_ptr<TargetMachine> TM;
+ std::shared_ptr<SymbolResolver> Resolver;
++#if LLVM_VERSION_MAJOR >= 8
++ LegacyRTDyldObjectLinkingLayer ObjectLayer;
++ LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
++#else
+ RTDyldObjectLinkingLayer ObjectLayer;
+ IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
++#endif
+
+ public:
+ std::map<std::string, std::tuple<uint8_t *, uintptr_t>> sections_;
+@@ -91,7 +96,11 @@ class BpfOrc
+ Resolver(createLegacyLookupResolver(ES,
+ [](const std::string &Name __attribute__((unused))) -> JITSymbol { return nullptr; },
+ [](Error Err) { cantFail(std::move(Err), "lookup failed"); })),
++#if LLVM_VERSION_MAJOR >= 8
++ ObjectLayer(ES, [this](VModuleKey) { return LegacyRTDyldObjectLinkingLayer::Resources{std::make_shared<MemoryManager>(sections_), Resolver}; }),
++#else
+ ObjectLayer(ES, [this](VModuleKey) { return RTDyldObjectLinkingLayer::Resources{std::make_shared<MemoryManager>(sections_), Resolver}; }),
++#endif
+ CompileLayer(ObjectLayer, SimpleCompiler(*TM)) {}
+
+ void compileModule(std::unique_ptr<Module> M) {
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
@ 2019-03-12 2:16 Patrick McLean
0 siblings, 0 replies; 22+ messages in thread
From: Patrick McLean @ 2019-03-12 2:16 UTC (permalink / raw
To: gentoo-commits
commit: 8ba9e3e616b62ef293d2223b347e2cea6e25b1eb
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Tue Mar 12 02:15:59 2019 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Tue Mar 12 02:15:59 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ba9e3e6
dev-util/bpftrace: New package
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-util/bpftrace/Manifest | 1 +
dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild | 58 +++++++++++
dev-util/bpftrace/bpftrace-9999.ebuild | 58 +++++++++++
.../files/bpftrace-0.9_pre20190311-bcc-0.9.patch | 13 +++
.../bpftrace-0.9_pre20190311-install-libs.patch | 111 +++++++++++++++++++++
dev-util/bpftrace/files/bpftrace-mandir.patch | 22 ++++
dev-util/bpftrace/metadata.xml | 10 ++
7 files changed, 273 insertions(+)
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest
new file mode 100644
index 00000000000..fbf71324c93
--- /dev/null
+++ b/dev-util/bpftrace/Manifest
@@ -0,0 +1 @@
+DIST bpftrace-0.9_pre20190311.tar.xz 613856 BLAKE2B 7f670647305e61d9a11a87be44bc2228fee6b474bd920b460ecd6375f23d371e2cc8b0bb22eb4473807b92fc44c4f13eb3be72d048f75f3f59e814c201eddba6 SHA512 7091b16ef1dafdc75dd8e6f172da68ea31d0a89ad42192dc86ced6d22a3c200a385a3e63f5a829cfad42ee5ba44e806b50ac450d17a96ef438ed5668d5b0c55f
diff --git a/dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild b/dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild
new file mode 100644
index 00000000000..1f874815e93
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild
@@ -0,0 +1,58 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs cmake-utils
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+
+if [[ ${PV} =~ 9{4,} ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/iovisor/${PN}"
+ BDEPEND=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+ #SRC_URI="https://github.com/iovisor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ BDEPEND="app-arch/xz-utils "
+fi
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="test"
+
+COMMON_DEPEND="sys-devel/clang:=
+ >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)]
+ >=dev-util/bcc-0.9.0:=
+ virtual/libelf"
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-cpp/gtest )"
+RDEPEND="${COMMON_DEPEND}"
+BDEPEND+="dev-util/cmake
+ sys-devel/flex
+ sys-devel/bison"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.9_pre20190311-bcc-0.9.patch"
+ "${FILESDIR}/bpftrace-0.9_pre20190311-install-libs.patch"
+ "${FILESDIR}/bpftrace-mandir.patch"
+)
+
+# lots of fixing needed
+RESTRICT="test"
+
+src_prepare() {
+ cmake-utils_src_prepare
+}
+
+src_configure() {
+ local -a mycmakeargs
+ mycmakeargs=(
+ "-DSTATIC_LINKING:BOOL=OFF"
+ "-DBUILD_TESTING:BOOL=OFF"
+ )
+
+ cmake-utils_src_configure
+}
diff --git a/dev-util/bpftrace/bpftrace-9999.ebuild b/dev-util/bpftrace/bpftrace-9999.ebuild
new file mode 100644
index 00000000000..1f874815e93
--- /dev/null
+++ b/dev-util/bpftrace/bpftrace-9999.ebuild
@@ -0,0 +1,58 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs cmake-utils
+
+DESCRIPTION="High-level tracing language for eBPF"
+HOMEPAGE="https://github.com/iovisor/bpftrace"
+
+if [[ ${PV} =~ 9{4,} ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/iovisor/${PN}"
+ BDEPEND=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+ #SRC_URI="https://github.com/iovisor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ BDEPEND="app-arch/xz-utils "
+fi
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="test"
+
+COMMON_DEPEND="sys-devel/clang:=
+ >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)]
+ >=dev-util/bcc-0.9.0:=
+ virtual/libelf"
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-cpp/gtest )"
+RDEPEND="${COMMON_DEPEND}"
+BDEPEND+="dev-util/cmake
+ sys-devel/flex
+ sys-devel/bison"
+
+PATCHES=(
+ "${FILESDIR}/bpftrace-0.9_pre20190311-bcc-0.9.patch"
+ "${FILESDIR}/bpftrace-0.9_pre20190311-install-libs.patch"
+ "${FILESDIR}/bpftrace-mandir.patch"
+)
+
+# lots of fixing needed
+RESTRICT="test"
+
+src_prepare() {
+ cmake-utils_src_prepare
+}
+
+src_configure() {
+ local -a mycmakeargs
+ mycmakeargs=(
+ "-DSTATIC_LINKING:BOOL=OFF"
+ "-DBUILD_TESTING:BOOL=OFF"
+ )
+
+ cmake-utils_src_configure
+}
diff --git a/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch
new file mode 100644
index 00000000000..0f3706fadf5
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch
@@ -0,0 +1,13 @@
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index d7905cd..adbd40c 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -376,7 +376,7 @@ void AttachedProbe::load_prog()
+ void AttachedProbe::attach_kprobe()
+ {
+ int perf_event_fd = bpf_attach_kprobe(progfd_, attachtype(probe_.type),
+- eventname().c_str(), probe_.attach_point.c_str(), 0);
++ eventname().c_str(), probe_.attach_point.c_str(), 0, -1);
+
+ if (perf_event_fd < 0) {
+ if (probe_.orig_name != probe_.name) {
diff --git a/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch
new file mode 100644
index 00000000000..68bd8255944
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch
@@ -0,0 +1,111 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8ff6e1f..a276ba2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -43,9 +43,10 @@ find_package(FLEX REQUIRED)
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc)
+ flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+ add_flex_bison_dependency(flex_lexer bison_parser)
+-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+-target_compile_options(parser PRIVATE "-w")
+-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
++target_compile_options(bpftraceparser PRIVATE "-w")
++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR})
++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
+index b8b0d96..0803c1e 100644
+--- a/resources/CMakeLists.txt
++++ b/resources/CMakeLists.txt
+@@ -1,6 +1,7 @@
+-add_library(resources headers.cpp)
++add_library(bpftraceresources headers.cpp)
+
+-target_include_directories(resources PUBLIC ../src)
++target_include_directories(bpftraceresources PUBLIC ../src)
++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ function(embed_headers output)
+ file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index b47f66d..36de26b 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -27,7 +27,8 @@ endif(HAVE_BCC_CREATE_MAP)
+ if(HAVE_GET_CURRENT_CGROUP_ID)
+ target_compile_definitions(bpftrace PRIVATE HAVE_GET_CURRENT_CGROUP_ID)
+ endif(HAVE_GET_CURRENT_CGROUP_ID)
+-target_link_libraries(bpftrace arch ast parser resources)
++target_link_libraries(bpftrace bpftracearch bpftraceast bpftraceparser
++ bpftraceresources)
+
+ if (STATIC_LINKING)
+ target_link_libraries(bpftrace ${LIBBCC_LIBRARIES})
+diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt
+index 425926e..13b5d31 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,5 +1,7 @@
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ else()
+- add_library(arch x86_64.cpp)
++ add_library(bpftracearch x86_64.cpp)
+ endif()
++
++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index 64db7b9..1a2eb6e 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-add_library(ast
++add_library(bpftraceast
+ ast.cpp
+ codegen_llvm.cpp
+ irbuilderbpf.cpp
+@@ -6,12 +6,13 @@ add_library(ast
+ semantic_analyser.cpp
+ )
+
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src)
+-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
+-target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR})
+-target_link_libraries(ast arch)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast)
++target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR})
++target_link_libraries(bpftraceast bpftracearch)
+
+-add_dependencies(ast parser)
++add_dependencies(bpftraceast bpftraceparser)
++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ if (STATIC_LINKING)
+ set(clang_libs
+@@ -31,16 +32,16 @@ if (STATIC_LINKING)
+ clangSerialization
+ clangToolingCore)
+ llvm_map_components_to_libnames(llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD})
+- target_link_libraries(ast ${clang_libs})
+- target_link_libraries(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${clang_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ else()
+ find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS})
+ if(found_LLVM)
+- target_link_libraries(ast 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(ast ${llvm_libs})
++ target_link_libraries(bpftraceast ${llvm_libs})
+ endif()
+- target_link_libraries(ast libclang)
++ target_link_libraries(bpftraceast libclang)
+ endif()
diff --git a/dev-util/bpftrace/files/bpftrace-mandir.patch b/dev-util/bpftrace/files/bpftrace-mandir.patch
new file mode 100644
index 00000000000..d18c1e2f321
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-mandir.patch
@@ -0,0 +1,22 @@
+diff --git a/man/man8/CMakeLists.txt b/man/man8/CMakeLists.txt
+index 45cfe5d..d13229e 100644
+--- a/man/man8/CMakeLists.txt
++++ b/man/man8/CMakeLists.txt
+@@ -1,12 +1,12 @@
+-find_program(GZIP gzip)
++find_program(CAT cat)
+ file(GLOB FILES *.8)
+ set(GZFILES "")
+ foreach(FIL ${FILES})
+ get_filename_component(NAME ${FIL} NAME)
+- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
+- COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
++ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}
++ COMMAND ${CAT} ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}
+ DEPENDS ${FIL})
+- list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz")
++ list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}")
+ endforeach()
+ add_custom_target(man ALL DEPENDS ${GZFILES})
+-install(FILES ${GZFILES} DESTINATION man/man8)
++install(FILES ${GZFILES} DESTINATION share/man/man8)
diff --git a/dev-util/bpftrace/metadata.xml b/dev-util/bpftrace/metadata.xml
new file mode 100644
index 00000000000..777f99f832c
--- /dev/null
+++ b/dev-util/bpftrace/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>chutzpah@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">iovisor/bpftrace</remote-id>
+ </upstream>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2023-08-31 18:35 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31 18:35 [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/ Patrick McLean
-- strict thread matches above, loose matches on Subject: below --
2023-05-15 19:34 Patrick McLean
2023-05-15 19:34 Patrick McLean
2023-03-19 17:34 Michał Górny
2023-02-06 2:04 Patrick McLean
2023-01-26 18:57 Patrick McLean
2022-09-17 21:46 Sam James
2022-08-29 17:40 Patrick McLean
2022-05-24 17:47 Patrick McLean
2021-12-02 18:02 Patrick McLean
2021-12-02 17:30 Patrick McLean
2021-11-07 20:59 Jakov Smolić
2021-10-26 22:07 Patrick McLean
2021-07-09 17:11 Patrick McLean
2021-04-19 23:50 Patrick McLean
2020-11-27 19:01 Patrick McLean
2020-06-20 19:23 Patrick McLean
2020-04-14 2:07 Patrick McLean
2020-03-09 6:01 Patrick McLean
2019-11-21 18:29 Patrick McLean
2019-03-20 21:27 Patrick McLean
2019-03-12 2:16 Patrick McLean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox