commit: 1f60892479e9e14d72f33c6ae9dfae7d9c67660d Author: Dan Robertson <dan <AT> dlrobertson <DOT> com> AuthorDate: Sun May 17 02:01:39 2020 +0000 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> CommitDate: Mon May 25 23:40:51 2020 +0000 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=1f608924
dev-util/dwarves: patch for musl build Signed-off-by: Dan Robertson <dan <AT> dlrobertson.com> Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> dev-util/dwarves/Manifest | 1 + dev-util/dwarves/dwarves-1.17.ebuild | 46 +++++ .../dwarves/files/dwarves-1.10-python-import.patch | 15 ++ dev-util/dwarves/files/dwarves-1.17-musl.patch | 190 +++++++++++++++++++++ dev-util/dwarves/metadata.xml | 5 + 5 files changed, 257 insertions(+) diff --git a/dev-util/dwarves/Manifest b/dev-util/dwarves/Manifest new file mode 100644 index 0000000..d9e3668 --- /dev/null +++ b/dev-util/dwarves/Manifest @@ -0,0 +1 @@ +DIST dwarves-1.17.tar.xz 309028 BLAKE2B 600d095359fa1ef208cc83655761505a07512faf9957144cc5fdd9e69bef98be3afc8b29a4c13aa0246aa43fdc9b4906de95f37c86fc6790ece52a79e3b13695 SHA512 8916ea24316efe1eb322d045fb2d81c230905f2fe33942eac641e9e0311f33a3bcf55be454eac32781799c255303bafacd8f1bd1b3ec08f0dae4d5f38d8186ba diff --git a/dev-util/dwarves/dwarves-1.17.ebuild b/dev-util/dwarves/dwarves-1.17.ebuild new file mode 100644 index 0000000..b507d41 --- /dev/null +++ b/dev-util/dwarves/dwarves-1.17.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python3_{6,7,8} ) +inherit multilib cmake-utils python-single-r1 + +DESCRIPTION="pahole (Poke-a-Hole) and other DWARF2 utilities" +HOMEPAGE="https://git.kernel.org/cgit/devel/pahole/pahole.git/" + +LICENSE="GPL-2" # only +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm64" +IUSE="debug" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND="${PYTHON_DEPS} + >=dev-libs/elfutils-0.178 + sys-libs/zlib" +DEPEND="${RDEPEND}" + +if [[ ${PV//_p} == ${PV} ]]; then + SRC_URI="http://fedorapeople.org/~acme/dwarves/${P}.tar.xz" +else + SRC_URI="https://dev.gentoo.org/~zzam/${PN}/${P}.tar.xz" +fi + +DOCS=( README README.ctracer NEWS ) + +PATCHES=( + "${FILESDIR}"/${PN}-1.10-python-import.patch + "${FILESDIR}"/${PN}-1.17-musl.patch + +) + +src_configure() { + local mycmakeargs=( "-D__LIB=$(get_libdir)" ) + cmake-utils_src_configure +} + +src_test() { :; } + +src_install() { + cmake-utils_src_install +} diff --git a/dev-util/dwarves/files/dwarves-1.10-python-import.patch b/dev-util/dwarves/files/dwarves-1.10-python-import.patch new file mode 100644 index 0000000..e308ac6 --- /dev/null +++ b/dev-util/dwarves/files/dwarves-1.10-python-import.patch @@ -0,0 +1,15 @@ +https://bugs.gentoo.org/show_bug.cgi?id=423817 + +--- dwarves-1.10/ostra/ostra-cg ++++ dwarves-1.10/ostra/ostra-cg +@@ -10,7 +10,9 @@ + # under the terms of version 2 of the GNU General Public License as + # published by the Free Software Foundation. + +-import sys, datetime, os, ostra ++import sys ++sys.path.insert(0, "/usr/share/dwarves/runtime/python") ++import datetime, os, ostra + + class_def = None + diff --git a/dev-util/dwarves/files/dwarves-1.17-musl.patch b/dev-util/dwarves/files/dwarves-1.17-musl.patch new file mode 100644 index 0000000..12dd516 --- /dev/null +++ b/dev-util/dwarves/files/dwarves-1.17-musl.patch @@ -0,0 +1,190 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2d23226..1798a96 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -74,6 +74,35 @@ if (NOT HAVE_REALLOCARRAY_SUPPORT) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOMPAT_NEED_REALLOCARRAY") + endif() + ++CHECK_C_SOURCE_COMPILES( ++" ++#include <obstack.h> ++int main(void) ++{ ++ _obstack_begin(0, 0, 0, NULL, NULL); ++ return 0; ++} ++" LIBC_IMPLEMENTS_OBSTACK) ++if (NOT LIBC_IMPLEMENTS_OBSTACK) ++ find_package(OBSTACK) ++endif() ++ ++CHECK_C_SOURCE_COMPILES( ++" ++#include <obstack.h> ++int main(void) ++{ ++ int argc=1; ++ char *argv[]={\"argp\"}; ++ argp_parse(0,argc,&argv,0,0,0); return 0; ++ return 0; ++} ++" LIBC_IMPLEMENTS_ARGP) ++ ++if (NOT LIBC_IMPLEMENTS_ARGP) ++ find_package(ARGP) ++endif() ++ + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64") + + file(GLOB libbpf_sources "lib/bpf/src/*.c") +@@ -91,7 +120,8 @@ 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} ++ ${ARGP_LIBRARY} ${OBSTACK_LIBRARY}) + + set(dwarves_emit_LIB_SRCS dwarves_emit.c) + add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS}) +diff --git a/cmake/modules/FindARGP.cmake b/cmake/modules/FindARGP.cmake +new file mode 100644 +index 0000000..aa7984f +--- /dev/null ++++ b/cmake/modules/FindARGP.cmake +@@ -0,0 +1,17 @@ ++# - Find argp ++# If argp_parse is not implemented by libc find ++# a standalone version. ++ ++message(STATUS "Checking availability of standalone argp library") ++ ++find_path(ARGP_INCLUDE_DIR argp.h ++ /usr/include ++ /usr/local/include ++ /usr/include/libdwarf ++ ~/usr/local/include ++) ++ ++find_library(ARGP_LIBRARY ++ NAMES argp ++ PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64 ++) +diff --git a/cmake/modules/FindOBSTACK.cmake b/cmake/modules/FindOBSTACK.cmake +new file mode 100644 +index 0000000..905fc4c +--- /dev/null ++++ b/cmake/modules/FindOBSTACK.cmake +@@ -0,0 +1,19 @@ ++# - Find obstack ++# If obstack is not implemented by libc find ++# a standalone version. ++ ++message(STATUS "Checking availability of standalone obstack library") ++ ++INCLUDE(CheckLibraryExists) ++ ++find_path(OBSTACK_INCLUDE_DIR obstack.h ++ /usr/include ++ /usr/local/include ++ /usr/include/libdwarf ++ ~/usr/local/include ++) ++ ++find_library(OBSTACK_LIBRARY ++ NAMES obstack ++ PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64 ++) +diff --git a/dtagnames.c b/dtagnames.c +index 0ffcbf7..1629fb3 100644 +--- a/dtagnames.c ++++ b/dtagnames.c +@@ -14,9 +14,11 @@ + + static void print_malloc_stats(void) + { ++#ifdef __GLIBC__ + struct mallinfo m = mallinfo(); + + fprintf(stderr, "size: %u\n", m.uordblks); ++#endif + } + + static int class__tag_name(struct tag *tag, struct cu *cu __unused, +diff --git a/dutil.h b/dutil.h +index 0f5f74a..3d771c4 100644 +--- a/dutil.h ++++ b/dutil.h +@@ -15,6 +15,7 @@ + #include <elf.h> + #include <gelf.h> + #include <asm/bitsperlong.h> ++#include <linux/stddef.h> + #include "rbtree.h" + + #define BITS_PER_LONG __BITS_PER_LONG +diff --git a/dwarves.c b/dwarves.c +index eb7885f..a437761 100644 +--- a/dwarves.c ++++ b/dwarves.c +@@ -14,6 +14,7 @@ + #include <fcntl.h> + #include <fnmatch.h> + #include <libelf.h> ++#include <limits.h> + #include <search.h> + #include <stdio.h> + #include <stdarg.h> +diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c +index b8124a1..310631e 100644 +--- a/dwarves_fprintf.c ++++ b/dwarves_fprintf.c +@@ -1910,7 +1910,11 @@ 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 __GLIBC__ + long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); ++#else ++ long sys_cacheline_size = 0; ++#endif + + if (sys_cacheline_size > 0) + cacheline_size = sys_cacheline_size; +diff --git a/dwarves_reorganize.c b/dwarves_reorganize.c +index bae5b6e..62616f3 100644 +--- a/dwarves_reorganize.c ++++ b/dwarves_reorganize.c +@@ -10,6 +10,7 @@ + #include "list.h" + #include "dwarves_reorganize.h" + #include "dwarves.h" ++#include "dutil.h" + + static void class__recalc_holes(struct class *class) + { +diff --git a/hash.h b/hash.h +index d3aa416..b1bd419 100644 +--- a/hash.h ++++ b/hash.h +@@ -15,6 +15,7 @@ + */ + + #include <stdint.h> ++#include <sys/reg.h> + + /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ + #define GOLDEN_RATIO_PRIME_32 0x9e370001UL +diff --git a/lib/bpf/src/libbpf.c b/lib/bpf/src/libbpf.c +index 514b1a5..b187734 100644 +--- a/lib/bpf/src/libbpf.c ++++ b/lib/bpf/src/libbpf.c +@@ -32,6 +32,7 @@ + #include <linux/filter.h> + #include <linux/list.h> + #include <linux/limits.h> ++#include <linux/stddef.h> + #include <linux/perf_event.h> + #include <linux/ring_buffer.h> + #include <linux/version.h> diff --git a/dev-util/dwarves/metadata.xml b/dev-util/dwarves/metadata.xml new file mode 100644 index 0000000..6f49eba --- /dev/null +++ b/dev-util/dwarves/metadata.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<!-- maintainer-needed --> +</pkgmetadata>