From 71546f58e88a291773ab962d5dcd75b87420f51c Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 8 Sep 2021 16:19:30 +0900 Subject: testing/pahole: upgrade to 1.22 LIBBPF_EMBEDDED patch has been merged back the other musl incompatibilities have also been fixed. hurray! --- ...vert-libbpf-allow-to-use-packaged-version.patch | 229 --------------------- testing/pahole/0002-Build-on-musl.patch | 177 ---------------- testing/pahole/APKBUILD | 12 +- 3 files changed, 3 insertions(+), 415 deletions(-) delete mode 100644 testing/pahole/0001-Revert-Revert-libbpf-allow-to-use-packaged-version.patch delete mode 100644 testing/pahole/0002-Build-on-musl.patch diff --git a/testing/pahole/0001-Revert-Revert-libbpf-allow-to-use-packaged-version.patch b/testing/pahole/0001-Revert-Revert-libbpf-allow-to-use-packaged-version.patch deleted file mode 100644 index 6408e6731e8..00000000000 --- a/testing/pahole/0001-Revert-Revert-libbpf-allow-to-use-packaged-version.patch +++ /dev/null @@ -1,229 +0,0 @@ -From b9decb69138020fb88e2d85a040ad15445e98d6b Mon Sep 17 00:00:00 2001 -From: Dominique Martinet -Date: Wed, 17 Mar 2021 14:31:57 +0900 -Subject: [PATCH 1/2] Revert "Revert "libbpf: allow to use packaged version"" - -This reverts commit 7943374ac574b94b00c1c1d30fd106bdf2230140. - -The original patch has been an ongoing effort from debian that got -merged once and reverted just before 1.20 release; this will probably -be droppable soon. -See https://www.spinics.net/lists/dwarves/msg00732.html - ---- - CMakeLists.txt | 43 ++++++++++++++++++++++++++++++------------- - btf_encoder.c | 4 ++-- - btf_loader.c | 2 +- - lib/include/bpf | 1 + - libbtf.c | 7 +++---- - libbtf.h | 2 +- - pahole.c | 2 +- - pahole_strings.h | 2 +- - strings.c | 2 +- - 9 files changed, 41 insertions(+), 24 deletions(-) - create mode 120000 lib/include/bpf - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7f72c7a5823c..03aba23a8f71 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2,9 +2,24 @@ project(pahole C) - cmake_minimum_required(VERSION 2.8.12) - cmake_policy(SET CMP0005 NEW) - -+option(LIBBPF_EMBEDDED "Use the embedded version of libbpf instead of searching it via pkg-config" ON) -+if (NOT LIBBPF_EMBEDDED) -+ find_package(PkgConfig) -+ if(PKGCONFIG_FOUND) -+ pkg_check_modules(LIBBPF libbpf>=0.3.0) -+ endif() -+endif() -+ - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} -- ${CMAKE_CURRENT_SOURCE_DIR} -- ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) -+ ${CMAKE_CURRENT_SOURCE_DIR}) -+if(NOT LIBBPF_FOUND) -+ # Allows to use 'system' style #include with both embedded and system libbpf -+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lib/include) -+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) -+else() -+ INCLUDE_DIRECTORIES(${LIBBPF_INCLUDE_DIRS}) -+ LINK_DIRECTORIES(${LIBBPF_LIBRARY_DIRS}) -+endif() - - # Try to parse this later, Helio just showed me a KDE4 example to support - # x86-64 builds. -@@ -56,7 +71,7 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") - endif() - endif() - endif() --if(NOT EXISTS "${PROJECT_SOURCE_DIR}/lib/bpf/src/btf.h") -+if(NOT LIBBPF_FOUND AND NOT EXISTS "${PROJECT_SOURCE_DIR}/lib/bpf/src/btf.h") - message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") - endif() - -@@ -81,22 +96,24 @@ endif() - - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64") - --file(GLOB libbpf_sources "lib/bpf/src/*.c") --add_library(bpf OBJECT ${libbpf_sources}) --set_property(TARGET bpf PROPERTY POSITION_INDEPENDENT_CODE 1) --target_include_directories(bpf PRIVATE -- ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include -- ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) -+if (NOT LIBBPF_FOUND) -+ file(GLOB libbpf_sources "lib/bpf/src/*.c") -+ add_library(bpf OBJECT ${libbpf_sources}) -+ set_property(TARGET bpf PROPERTY POSITION_INDEPENDENT_CODE 1) -+ target_include_directories(bpf PRIVATE -+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include) -+endif() - - set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings - ctf_encoder.c ctf_loader.c libctf.c btf_encoder.c btf_loader.c libbtf.c - dwarf_loader.c dutil.c elf_symtab.c rbtree.c) --add_library(dwarves SHARED ${dwarves_LIB_SRCS} $) -+if (NOT LIBBPF_FOUND) -+ list(APPEND dwarves_LIB_SRCS $) -+endif() -+add_library(dwarves SHARED ${dwarves_LIB_SRCS}) - set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1) - set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "") --target_include_directories(dwarves PRIVATE -- ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) --target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES}) -+target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBBPF_LIBRARIES}) - - set(dwarves_emit_LIB_SRCS dwarves_emit.c) - add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS}) -diff --git a/btf_encoder.c b/btf_encoder.c -index b124ec20a689..fadc48d0e300 100644 ---- a/btf_encoder.c -+++ b/btf_encoder.c -@@ -11,12 +11,12 @@ - - #include "dwarves.h" - #include "libbtf.h" --#include "lib/bpf/include/uapi/linux/btf.h" --#include "lib/bpf/src/libbpf.h" - #include "hash.h" - #include "elf_symtab.h" - #include "btf_encoder.h" - -+#include -+#include - #include /* for isalpha() and isalnum() */ - #include /* for qsort() and bsearch() */ - #include -diff --git a/btf_loader.c b/btf_loader.c -index ec286f413f36..fa85d0632299 100644 ---- a/btf_loader.c -+++ b/btf_loader.c -@@ -20,12 +20,12 @@ - #include - #include - #include -+#include - #include - - #include - - #include "libbtf.h" --#include "lib/bpf/include/uapi/linux/btf.h" - #include "dutil.h" - #include "dwarves.h" - -diff --git a/lib/include/bpf b/lib/include/bpf -new file mode 120000 -index 000000000000..4c41b7148c6e ---- /dev/null -+++ b/lib/include/bpf -@@ -0,0 +1 @@ -+../bpf/src -\ No newline at end of file -diff --git a/libbtf.c b/libbtf.c -index 9f7628304495..81b1b36b3956 100644 ---- a/libbtf.c -+++ b/libbtf.c -@@ -16,12 +16,11 @@ - #include - #include - #include -+#include -+#include -+#include - - #include "libbtf.h" --#include "lib/bpf/include/uapi/linux/btf.h" --#include "lib/bpf/include/linux/err.h" --#include "lib/bpf/src/btf.h" --#include "lib/bpf/src/libbpf.h" - #include "dutil.h" - #include "gobuffer.h" - #include "dwarves.h" -diff --git a/libbtf.h b/libbtf.h -index 191f5862a695..0b997670c8bc 100644 ---- a/libbtf.h -+++ b/libbtf.h -@@ -11,7 +11,7 @@ - - #include - #include --#include "lib/bpf/src/btf.h" -+#include - - struct btf_elf { - void *priv; -diff --git a/pahole.c b/pahole.c -index 4a34ba5263b6..68dd16670300 100644 ---- a/pahole.c -+++ b/pahole.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - #include "dwarves_reorganize.h" - #include "dwarves.h" -@@ -23,7 +24,6 @@ - #include "ctf_encoder.h" - #include "btf_encoder.h" - #include "libbtf.h" --#include "lib/bpf/src/libbpf.h" - - static bool btf_encode; - static bool ctf_encode; -diff --git a/pahole_strings.h b/pahole_strings.h -index 522fbf21de0d..657701be3587 100644 ---- a/pahole_strings.h -+++ b/pahole_strings.h -@@ -6,7 +6,7 @@ - Copyright (C) 2008 Arnaldo Carvalho de Melo - */ - --#include "lib/bpf/src/btf.h" -+#include - - typedef unsigned int strings_t; - -diff --git a/strings.c b/strings.c -index d37f49d77548..8244c49cf2bd 100644 ---- a/strings.c -+++ b/strings.c -@@ -13,9 +13,9 @@ - #include - #include - #include -+#include - - #include "dutil.h" --#include "lib/bpf/src/libbpf.h" - - struct strings *strings__new(void) - { --- -2.30.2 - diff --git a/testing/pahole/0002-Build-on-musl.patch b/testing/pahole/0002-Build-on-musl.patch deleted file mode 100644 index 13ffb4a2918..00000000000 --- a/testing/pahole/0002-Build-on-musl.patch +++ /dev/null @@ -1,177 +0,0 @@ -From b3c9e14b6de521f4ec08f90e4433e94d30480f71 Mon Sep 17 00:00:00 2001 -From: Dominique Martinet -Date: Wed, 17 Mar 2021 15:12:54 +0900 -Subject: [PATCH 2/2] Build on musl - -- add -lobstack / -largp when required -- change __always_inline to inline -- add missing limits.h / sys/user.h include -- protect _SC_LEVEL1_DCACHE_LINESIZE by ifdef - -At least the first part of this patch is not upstreamable as is ---- - CMakeLists.txt | 16 ++++++++-------- - dutil.h | 8 ++++---- - dwarves.c | 1 + - dwarves_fprintf.c | 2 ++ - hash.h | 1 + - pahole.c | 1 + - 6 files changed, 17 insertions(+), 12 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 03aba23a8f71..ddc784073322 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -113,7 +113,7 @@ endif() - add_library(dwarves SHARED ${dwarves_LIB_SRCS}) - set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1) - set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "") --target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBBPF_LIBRARIES}) -+target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBBPF_LIBRARIES} -lobstack) - - set(dwarves_emit_LIB_SRCS dwarves_emit.c) - add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS}) -@@ -127,11 +127,11 @@ target_link_libraries(dwarves_reorganize dwarves) - - set(codiff_SRCS codiff.c) - add_executable(codiff ${codiff_SRCS}) --target_link_libraries(codiff dwarves) -+target_link_libraries(codiff dwarves -largp) - - set(ctracer_SRCS ctracer.c) - add_executable(ctracer ${ctracer_SRCS}) --target_link_libraries(ctracer dwarves dwarves_emit dwarves_reorganize ${ELF_LIBRARY}) -+target_link_libraries(ctracer dwarves dwarves_emit dwarves_reorganize ${ELF_LIBRARY} -largp) - - set(dtagnames_SRCS dtagnames.c) - add_executable(dtagnames ${dtagnames_SRCS}) -@@ -139,19 +139,19 @@ target_link_libraries(dtagnames dwarves) - - set(pahole_SRCS pahole.c) - add_executable(pahole ${pahole_SRCS}) --target_link_libraries(pahole dwarves dwarves_reorganize) -+target_link_libraries(pahole dwarves dwarves_reorganize -largp) - - set(pdwtags_SRCS pdwtags.c) - add_executable(pdwtags ${pdwtags_SRCS}) --target_link_libraries(pdwtags dwarves) -+target_link_libraries(pdwtags dwarves -largp) - - set(pglobal_SRCS pglobal.c) - add_executable(pglobal ${pglobal_SRCS}) --target_link_libraries(pglobal dwarves) -+target_link_libraries(pglobal dwarves -largp) - - set(pfunct_SRCS pfunct.c) - add_executable(pfunct ${pfunct_SRCS}) --target_link_libraries(pfunct dwarves dwarves_emit ${ELF_LIBRARY}) -+target_link_libraries(pfunct dwarves dwarves_emit ${ELF_LIBRARY} -largp) - - set(prefcnt_SRCS prefcnt.c) - add_executable(prefcnt ${prefcnt_SRCS}) -@@ -163,7 +163,7 @@ target_link_libraries(scncopy dwarves ${ELF_LIBRARY}) - - set(syscse_SRCS syscse.c) - add_executable(syscse ${syscse_SRCS}) --target_link_libraries(syscse dwarves) -+target_link_libraries(syscse dwarves -largp) - - install(TARGETS codiff ctracer dtagnames pahole pdwtags - pfunct pglobal prefcnt scncopy syscse RUNTIME DESTINATION -diff --git a/dutil.h b/dutil.h -index 0838dff2d679..df633ad831b4 100644 ---- a/dutil.h -+++ b/dutil.h -@@ -42,7 +42,7 @@ static inline __attribute__((const)) bool is_power_of_2(unsigned long n) - * This is defined the same way as ffs. - * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. - */ --static __always_inline int fls(int x) -+static inline int fls(int x) - { - return x ? sizeof(x) * 8 - __builtin_clz(x) : 0; - } -@@ -59,7 +59,7 @@ static __always_inline int fls(int x) - * at position 64. - */ - #if BITS_PER_LONG == 32 --static __always_inline int fls64(uint64_t x) -+static inline int fls64(uint64_t x) - { - uint32_t h = x >> 32; - if (h) -@@ -73,7 +73,7 @@ static __always_inline int fls64(uint64_t x) - * - * Undefined if no set bit exists, so code should check against 0 first. - */ --static __always_inline unsigned long __fls(unsigned long word) -+static inline unsigned long __fls(unsigned long word) - { - int num = BITS_PER_LONG - 1; - -@@ -104,7 +104,7 @@ static __always_inline unsigned long __fls(unsigned long word) - return num; - } - --static __always_inline int fls64(uint64_t x) -+static inline int fls64(uint64_t x) - { - if (x == 0) - return 0; -diff --git a/dwarves.c b/dwarves.c -index 4aa2cd7dcf90..e4637541896a 100644 ---- a/dwarves.c -+++ b/dwarves.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - -diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c -index c96a6fb0df5a..670b431dc93c 100644 ---- a/dwarves_fprintf.c -+++ b/dwarves_fprintf.c -@@ -1956,11 +1956,13 @@ void cus__print_error_msg(const char *progname, const struct cus *cus, - void dwarves__fprintf_init(uint16_t user_cacheline_size) - { - if (user_cacheline_size == 0) { -+#ifdef _SC_LEVEL1_DCACHE_LINESIZE - long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); - - if (sys_cacheline_size > 0) - cacheline_size = sys_cacheline_size; - else -+#endif - cacheline_size = 64; /* Fall back to a sane value */ - } else - cacheline_size = user_cacheline_size; -diff --git a/hash.h b/hash.h -index d3aa41636126..a984a672aa4f 100644 ---- a/hash.h -+++ b/hash.h -@@ -15,6 +15,7 @@ - */ - - #include -+#include - - /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ - #define GOLDEN_RATIO_PRIME_32 0x9e370001UL -diff --git a/pahole.c b/pahole.c -index 68dd16670300..1791e2b4e37c 100644 ---- a/pahole.c -+++ b/pahole.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - - #include "dwarves_reorganize.h" --- -2.30.2 - diff --git a/testing/pahole/APKBUILD b/testing/pahole/APKBUILD index 446c4c79af7..e37d3d74765 100644 --- a/testing/pahole/APKBUILD +++ b/testing/pahole/APKBUILD @@ -1,7 +1,7 @@ # Contributor: Dominique Martinet # Maintainer: Dominique Martinet pkgname=pahole -pkgver=1.21 +pkgver=1.22 pkgrel=0 pkgdesc="dwarf manipulation utilities" url="https://git.kernel.org/pub/scm/devel/pahole/pahole.git" @@ -11,9 +11,7 @@ options="!check" # no test makedepends="cmake elfutils-dev libdwarf-dev zlib-dev libbpf-dev linux-headers musl-obstack-dev argp-standalone" subpackages="$pkgname-doc" -source="https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-v$pkgver.tar.gz - 0001-Revert-Revert-libbpf-allow-to-use-packaged-version.patch - 0002-Build-on-musl.patch" +source="https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-v$pkgver.tar.gz" builddir="$srcdir/$pkgname-v$pkgver" build() { @@ -31,8 +29,4 @@ package() { } -sha512sums=" -77a576d4a6797f017c42a59177083f16dd68d31fcf30d272a9ac9560f22f73e00c6671f239c26c98913a157d57c6e28d07181c855515aeb5c2cd43894bd977eb pahole-v1.21.tar.gz -bc706e1bcf0b8a7cc56b21785d9fc8ccd6b0649dd4135b8da690f06974f5ec106ce89d5627fd7c3d9e3a63e78cec071457453a73175ca51edb8cea9ad5d9fa21 0001-Revert-Revert-libbpf-allow-to-use-packaged-version.patch -f7b95259c16459d26b98a8f622a5866afe2a5fdb9153c377e783fc57cc706b255c693b1becc6de2185e4f44b1a8e3cf92fe2e6e8c3c51d5421e1e897ad2423d8 0002-Build-on-musl.patch -" +sha512sums="9fd2b4eca47997a4018700fe3f55a0cdd8db7ffa3a56bb77738a52be057ef600a288e2ba7acdff005cd08c094df8f0a8ea411e3d1ff2cf8b1051f1e93f44df00 pahole-v1.22.tar.gz" -- cgit v1.2.3