diff --git a/common/shlibs b/common/shlibs index 82cfd88ff1..82a0413e42 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3425,3 +3425,6 @@ libyang.so.0.16 libyang-0.16r3_1 libhtp.so.2 libhtp-0.5.30_1 libgedit-3.14.so gedit-3.32.0_1 libchewing.so.3 libchewing-0.5.1_1 +libdwarves.so.1 pahole-1.12_1 +libdwarves_emit.so.1 pahole-1.12_1 +libdwarves_reorganize.so.1 pahole-1.12_1 diff --git a/srcpkgs/pahole-devel b/srcpkgs/pahole-devel new file mode 120000 index 0000000000..dbbc0c101a --- /dev/null +++ b/srcpkgs/pahole-devel @@ -0,0 +1 @@ +pahole \ No newline at end of file diff --git a/srcpkgs/pahole/patches/fix_always_inline.patch b/srcpkgs/pahole/patches/fix_always_inline.patch new file mode 100644 index 0000000000..5e47f52112 --- /dev/null +++ b/srcpkgs/pahole/patches/fix_always_inline.patch @@ -0,0 +1,13 @@ +--- dutil.h.orig ++++ dutil.h +@@ -28,6 +28,10 @@ + #define __pure __attribute__ ((pure)) + #endif + ++#ifndef __always_inline ++#define __always_inline inline ++#endif ++ + #define roundup(x,y) ((((x) + ((y) - 1)) / (y)) * (y)) + + static inline __attribute__((const)) bool is_power_of_2(unsigned long n) diff --git a/srcpkgs/pahole/patches/fix_limits.patch b/srcpkgs/pahole/patches/fix_limits.patch new file mode 100644 index 0000000000..aad8159c5e --- /dev/null +++ b/srcpkgs/pahole/patches/fix_limits.patch @@ -0,0 +1,10 @@ +--- dwarves.c.orig ++++ dwarves.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include "config.h" + #include "list.h" diff --git a/srcpkgs/pahole/patches/fix_mallinfo.patch b/srcpkgs/pahole/patches/fix_mallinfo.patch new file mode 100644 index 0000000000..0c54d25a3f --- /dev/null +++ b/srcpkgs/pahole/patches/fix_mallinfo.patch @@ -0,0 +1,16 @@ +--- dtagnames.c.orig ++++ dtagnames.c +@@ -16,9 +16,13 @@ + + static void print_malloc_stats(void) + { ++#ifdef __GLIBC__ + struct mallinfo m = mallinfo(); + + fprintf(stderr, "size: %u\n", m.uordblks); ++#else ++ fprintf(stderr, "malloc stats not available\n"); ++#endif + } + + static int class__tag_name(struct tag *tag, struct cu *cu __unused, diff --git a/srcpkgs/pahole/patches/fix_sysconf.patch b/srcpkgs/pahole/patches/fix_sysconf.patch new file mode 100644 index 0000000000..30f3886865 --- /dev/null +++ b/srcpkgs/pahole/patches/fix_sysconf.patch @@ -0,0 +1,16 @@ +--- dwarves_fprintf.c.orig ++++ dwarves_fprintf.c +@@ -1683,11 +1683,13 @@ + 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/srcpkgs/pahole/patches/fix_wordsize.patch b/srcpkgs/pahole/patches/fix_wordsize.patch new file mode 100644 index 0000000000..a4447d8091 --- /dev/null +++ b/srcpkgs/pahole/patches/fix_wordsize.patch @@ -0,0 +1,12 @@ +--- hash.h.orig ++++ hash.h +@@ -16,6 +16,9 @@ + + #include + ++#undef __WORDSIZE ++#define __WORDSIZE 64 ++ + /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ + #define GOLDEN_RATIO_PRIME_32 0x9e370001UL + /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ diff --git a/srcpkgs/pahole/template b/srcpkgs/pahole/template new file mode 100644 index 0000000000..f8b412862b --- /dev/null +++ b/srcpkgs/pahole/template @@ -0,0 +1,31 @@ +# Template file for 'pahole' +pkgname=pahole +version=1.12 +revision=1 +build_style=cmake +configure_args="-D__LIB=lib" +makedepends="elfutils-devel zlib-devel" +short_desc="Various DWARF utils" +maintainer="Andrew Benson " +license="GPL-2.0-only" +homepage="http://git.kernel.org/?p=devel/pahole/pahole.git;a=summary" +distfiles="https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-${version}.tar.gz" +checksum=2452464cbfdbaece6187d7860000fe8ef24b7271f88122cf540d3e0ab4a644d1 + +case $XBPS_TARGET_MACHINE in + *-musl) makedepends+=" musl-obstack argp-standalone" +esac + +pre_configure() { + case $XBPS_TARGET_MACHINE in + *-musl) sed -i CMakeLists.txt -e "/^target_link_libraries/s/)/ obstack argp)/" + esac +} + +pahole-devel_package() { + short_desc+=" - development files" + pkg_install() { + vmove /usr/include + vmove "/usr/lib/*.so" + } +}