From: "Aric Belsito" <lluixhi@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/musl:master commit in: dev-libs/elfutils/files/, dev-libs/elfutils/
Date: Sat, 21 Jan 2017 20:08:12 +0000 (UTC) [thread overview]
Message-ID: <1485029267.92b34c99e4c36d2328ffbd66e485fb7d433aa7c9.lluixhi@gentoo> (raw)
commit: 92b34c99e4c36d2328ffbd66e485fb7d433aa7c9
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Sat Jan 21 20:07:04 2017 +0000
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Sat Jan 21 20:07:47 2017 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=92b34c99
dev-libs/elfutils: Add stable and unstable
A long time coming because of the numerous breakout packages necessary.
Needs to be unmasked in order to build.
dev-libs/elfutils/Manifest | 12 ++
dev-libs/elfutils/elfutils-0.166.ebuild | 83 ++++++++
dev-libs/elfutils/elfutils-0.168.ebuild | 73 +++++++
.../files/elfutils-0.118-PaX-support.patch | 26 +++
.../elfutils/files/elfutils-0.166-musl-libs.patch | 218 +++++++++++++++++++++
.../files/elfutils-0.166-musl-obstack-fts.patch | 124 ++++++++++++
.../elfutils/files/elfutils-0.166-musl-utils.patch | 183 +++++++++++++++++
.../elfutils/files/elfutils-0.168-musl-libs.patch | 173 ++++++++++++++++
.../files/elfutils-0.168-musl-obstack-fts.patch | 102 ++++++++++
.../elfutils/files/elfutils-0.168-musl-utils.patch | 122 ++++++++++++
dev-libs/elfutils/metadata.xml | 13 ++
11 files changed, 1129 insertions(+)
diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest
new file mode 100644
index 0000000..1a5b6bb
--- /dev/null
+++ b/dev-libs/elfutils/Manifest
@@ -0,0 +1,12 @@
+AUX elfutils-0.118-PaX-support.patch 954 SHA256 e769e1168dc645ce99655f984f5c19a54d765210cacd098556b6b68743b877fa SHA512 d2b27b1715908ebc68c304a32b29e5bdebede5d4c9819b552617b3e3fd00f21570fa2346ec0e01b9b8028e9139eea629e0e70bee2f509ebfdacd31bbcd3bea0d WHIRLPOOL 47b537a5a01b9a1240b0e922eeef7e5e0e00b04cb474dbb0728849deba4a50c13e6a56b9b5476121771dab25a61641091deefd2cf94bb7cdcf4858f1b6222670
+AUX elfutils-0.166-musl-libs.patch 7954 SHA256 733db8f0d362910fa83fb32df6ee0ca6f460c4050c2d53a197c31d468bb71531 SHA512 e3ea9335fbc42e849aec80b4249effe9303066a7d569c999adb03436ec2b78c5a4fff61abba422da7f4c73967956c403d16c359f7ca9da6df64c3bce6eeff2ac WHIRLPOOL 0fb81171ae6102b85ba7bea3c876e0bcc09cc9f2a4ee3ee7ccfa7c35d0745b89cf423730da59d1eef45c885fa44626dfd68faadb12156b41d9902104c0dfd61f
+AUX elfutils-0.166-musl-obstack-fts.patch 5276 SHA256 e6cd808c69c26907d13ad3e53f67a47f0a4e6a73a419421f021334338d64f5fc SHA512 7715375677001efc89c18cd11804fa21423331c831a10d24ebf1d591e9c66de56d965b244ea9fbc45cd7bf5236bd59bfcd8e684683871235153f1f2ef11e4d3d WHIRLPOOL d1d8aeb391d9eb7a5c967274606fe85d59fbeb5af9c5de7504bf901972634e5835d5056115c8eb6e59b6971b0db9f5d9456b26f13512a3783a869cf459c59406
+AUX elfutils-0.166-musl-utils.patch 5703 SHA256 a8d7e456abe29e5ade35832d872eb56eaf29de0571ab0c38bc4cc7d5212b47ce SHA512 df0bafd47c46e2da7cd60e2063823a531c5ec5507207ca14d02f3f7cd1ee2bb21a77daf01b6f63decc9b55db25424375b05d04495a347c6c17f6ec32d8d62824 WHIRLPOOL d2a7809ef296ab9b83a4bf45aefb2ae8f916eab6c5276aef8bbe5f99af59c2f1cea847713d22be2f2c674f0e53fa36564a705121c512a51cc6cca2ac31933391
+AUX elfutils-0.168-musl-libs.patch 5959 SHA256 b61b43897db3f1a76d1f2721c13a888dbeafcbc6ed4f469ffb520d2ac38a0ef0 SHA512 bdaeb3962cfec49d33078bc9f02e0cf48c7459e4c4bd3efa5a899a2a4e40cbc4cbc530b53738a97a633c4852edd5377d95ae80619fa2642f182ba6b7f696fce9 WHIRLPOOL c4677fde127b01c4e6aee7124fdf984fa5b181e9ab6e9f8ee71668c03a62eb16904847ef015ed963feffee21db70be51632343e4eb3a5397d76cdd09907fe499
+AUX elfutils-0.168-musl-obstack-fts.patch 3866 SHA256 f3f0993948744f4d18f2618b221edfb1bdb5e44afb25d84fb8017115acd7970d SHA512 a93faea92bcdc9bff7fffabc35626213b8efa7003b893753480250fab7295aabd415fbf947f09ebd9e0ab8037582e4fe5a689e2910845223b2f00eabb2f529c1 WHIRLPOOL ee8745e65281f9cd2aae1bfee9d6e9f9e20677ac4f013f79436f8749f43ed897a98744d78e090de6561737b2af26063743e93d8b7686fef02cc5792fdc3754bd
+AUX elfutils-0.168-musl-utils.patch 3833 SHA256 5f939b8e9c19ed84239ca30715c5117e42a8a0b46e854311440dcad5508bfb46 SHA512 b3ab2c6f8e04507580feedddaf7c0a260c70d96550d7befb4e060f1b7619c69ceddff43dae407fd677be939c48556bfd253d5bedd619e85fd8418a6fdcab0b01 WHIRLPOOL 22751e586c78479bc087a16668fcd4f0bb37c019795fbfd4eb52fb7cc5784259868252a48b70429339a659e97815050717ed34cf7dee61661b0cb26925efdd4b
+DIST elfutils-0.166.tar.bz2 6496225 SHA256 3c056914c8a438b210be0d790463b960fc79d234c3f05ce707cbff80e94cba30 SHA512 543e8f9fbebbef86c40b1d6dc93da04a8431071aad636b70e7a1b9536450990b237d100d354c29fd0c3605074b7a0621f5bdaab4c2664be42b2912ad283bc614 WHIRLPOOL 4de083bbb397235dd46c2ba6e0cbb615825c13d7e8413015d5ff08d72deae1d9a508c0f6e5f90e27cc709870064bc53a51b2a681f2a9b80e1f658bb7dc475f8d
+DIST elfutils-0.168.tar.bz2 6840399 SHA256 b88d07893ba1373c7dd69a7855974706d05377766568a7d9002706d5de72c276 SHA512 c8f2077ffe6877ad9e9d2f553bf0576361799c601d246f53e1d99a6f7046794c5916e1087b97ad1d1e5f59f9debc20384f864d507ef6c4c75a8e767d15d6eb91 WHIRLPOOL 281e6917ad243c4f28dad48801d43c29b503da0198f1cd882b6e378b9016e0843088185a39909db75295484f28b963b711f68b80dc6cc810b3027a2ea5cce556
+EBUILD elfutils-0.166.ebuild 2541 SHA256 67c6a8b7aa2de1a7a03f6171e5608bcca22dfd9aff155dfc14a1797a6fbb5d0e SHA512 9cdf98e10533991996301355b4a9a03bb09b1afd0be5a0454a3a3ae09d559adb38d780db0d9ed8f29a8eab3dba01e5ba432a626084be0f30931fa9130cfbd8f1 WHIRLPOOL a4e427fb15611427e6b431f52d1f6324db97cd890553d87ac8a93c75c2740bc79db60860315ba0f6c25f7119f649dd452aca00c61cb585e75d3501a8f74a6528
+EBUILD elfutils-0.168.ebuild 2077 SHA256 c9cfc5b872bc5bfde37f0149d5129515eb9171925e08107218dfef4fd86e2f87 SHA512 baf7deed876788a7d21d126b1058c605612437b7114d517e39053e9c4ca1f3600fb41a73f991099b0d0b957213b81a84fc27471efdace9abd3e3a2ce6fde24f5 WHIRLPOOL 3754e1aa43f02c5e90b798c9ac97868c47c8b9e68e9e7133a49a24abf9f3279e29dac3c479deca76e10b029a4bc7b495c67dd8d111699ae0c630f0b5c286776b
+MISC metadata.xml 536 SHA256 c3a1800d65f3a779757015fa973588785610daa943a0f5781faf854792ef6993 SHA512 ad625d13a4e5411db4423030760ac51dd44e8da599409bff3e5607c02ed158421e90d7cec8c0b4c0228049b975d3c65a7dbebef78eedd7aca700d38612873cac WHIRLPOOL 4f06288344e8654c048b3ed2aaee8353e0f76a1623eb6936564f65954d52247db57903bdc70f50cd7465681887279024bad5ddd6c9d9c4297a17ef758bd1cf43
diff --git a/dev-libs/elfutils/elfutils-0.166.ebuild b/dev-libs/elfutils/elfutils-0.166.ebuild
new file mode 100644
index 0000000..9ed5b3f
--- /dev/null
+++ b/dev-libs/elfutils/elfutils-0.166.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools eutils flag-o-matic multilib-minimal
+
+DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)"
+HOMEPAGE="https://fedorahosted.org/elfutils/"
+SRC_URI="https://fedorahosted.org/releases/e/l/${PN}/${PV}/${P}.tar.bz2"
+
+LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="bzip2 lzma nls static-libs test +threads +utils"
+
+# This pkg does not actually seem to compile currently in a uClibc
+# environment (xrealloc errs), but we need to ensure that glibc never
+# gets pulled in as a dep since this package does not respect virtual/libc
+RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
+ bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] )
+ !dev-libs/libelf
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r11
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ >=sys-devel/flex-2.5.4a
+ sys-devel/m4
+ elibc_musl? (
+ sys-libs/argp-standalone
+ sys-libs/fts-standalone
+ sys-libs/obstack-standalone
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.118-PaX-support.patch
+
+ # Add MUSL patches
+ epatch "${FILESDIR}"/${P}-musl-obstack-fts.patch
+ epatch "${FILESDIR}"/${P}-musl-libs.patch
+ epatch "${FILESDIR}"/${P}-musl-utils.patch
+
+ eautoreconf
+
+ use static-libs || sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in
+ sed -i 's:-Werror::' */Makefile.in
+ # some patches touch both configure and configure.ac
+ find -type f -exec touch -r configure {} +
+}
+
+src_configure() {
+ use test && append-flags -g #407135
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE="${S}" econf \
+ $(use_enable nls) \
+ $(use_enable threads thread-safety) \
+ --program-prefix="eu-" \
+ --with-zlib \
+ --disable-symbol-versioning \
+ $(use_with bzip2 bzlib) \
+ $(use_with lzma)
+}
+
+multilib_src_test() {
+ env LD_LIBRARY_PATH="${BUILD_DIR}/libelf:${BUILD_DIR}/libebl:${BUILD_DIR}/libdw:${BUILD_DIR}/libasm" \
+ LC_ALL="C" \
+ emake check || die
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc NOTES
+ # These build quick, and are needed for most tests, so don't
+ # disable their building when the USE flag is disabled.
+ use utils || rm -rf "${ED}"/usr/bin
+}
diff --git a/dev-libs/elfutils/elfutils-0.168.ebuild b/dev-libs/elfutils/elfutils-0.168.ebuild
new file mode 100644
index 0000000..37e1f9c
--- /dev/null
+++ b/dev-libs/elfutils/elfutils-0.168.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit autotools eutils flag-o-matic multilib-minimal
+
+DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)"
+HOMEPAGE="http://elfutils.org/"
+SRC_URI="https://sourceware.org/elfutils/ftp/${PV}/${P}.tar.bz2"
+
+LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="bzip2 lzma nls static-libs test +threads +utils"
+
+RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
+ bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] )
+ !dev-libs/libelf"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ >=sys-devel/flex-2.5.4a
+ sys-devel/m4
+ elibc_musl? (
+ sys-libs/argp-standalone
+ sys-libs/fts-standalone
+ sys-libs/obstack-standalone
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.118-PaX-support.patch
+
+ # Add MUSL patches
+ epatch "${FILESDIR}"/${P}-musl-obstack-fts.patch
+ epatch "${FILESDIR}"/${P}-musl-libs.patch
+ epatch "${FILESDIR}"/${P}-musl-utils.patch
+
+ eautoreconf
+
+ use static-libs || sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in
+ sed -i 's:-Werror::' */Makefile.in
+}
+
+src_configure() {
+ use test && append-flags -g #407135
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE="${S}" econf \
+ $(use_enable nls) \
+ $(use_enable threads thread-safety) \
+ --program-prefix="eu-" \
+ --with-zlib \
+ --disable-symbol-versioning \
+ $(use_with bzip2 bzlib) \
+ $(use_with lzma)
+}
+
+multilib_src_test() {
+ env LD_LIBRARY_PATH="${BUILD_DIR}/libelf:${BUILD_DIR}/libebl:${BUILD_DIR}/libdw:${BUILD_DIR}/libasm" \
+ LC_ALL="C" \
+ emake check
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc NOTES
+ # These build quick, and are needed for most tests, so don't
+ # disable their building when the USE flag is disabled.
+ use utils || rm -rf "${ED}"/usr/bin
+}
diff --git a/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch b/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch
new file mode 100644
index 0000000..083f32f
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch
@@ -0,0 +1,26 @@
+Add support for PaX ELF markings
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+
+http://bugs.gentoo.org/115100
+
+--- libelf/elf.h
++++ libelf/elf.h
+@@ -568,6 +568,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+--- src/elflint.c
++++ src/elflint.c
+@@ -3187,6 +3187,7 @@
+
+ if (phdr->p_type >= PT_NUM && phdr->p_type != PT_GNU_EH_FRAME
+ && phdr->p_type != PT_GNU_STACK && phdr->p_type != PT_GNU_RELRO
++ && phdr->p_type != PT_PAX_FLAGS
+ /* Check for a known machine-specific type. */
+ && ebl_segment_type_name (ebl, phdr->p_type, NULL, 0) == NULL)
+ ERROR (gettext ("\
diff --git a/dev-libs/elfutils/files/elfutils-0.166-musl-libs.patch b/dev-libs/elfutils/files/elfutils-0.166-musl-libs.patch
new file mode 100644
index 0000000..645ebdd
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.166-musl-libs.patch
@@ -0,0 +1,218 @@
+diff -Naur elfutils-0.166.orig/lib/error.h elfutils-0.166/lib/error.h
+--- elfutils-0.166.orig/lib/error.h 1969-12-31 16:00:00.000000000 -0800
++++ elfutils-0.166/lib/error.h 2016-11-15 12:26:59.352320431 -0800
+@@ -0,0 +1,27 @@
++#ifndef _ERROR_H_
++#define _ERROR_H_
++
++#include <stdarg.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++
++static unsigned int error_message_count = 0;
++
++static inline void error(int status, int errnum, const char* format, ...)
++{
++ va_list ap;
++ fprintf(stderr, "%s: ", program_invocation_name);
++ va_start(ap, format);
++ vfprintf(stderr, format, ap);
++ va_end(ap);
++ if (errnum)
++ fprintf(stderr, ": %s", strerror(errnum));
++ fprintf(stderr, "\n");
++ error_message_count++;
++ if (status)
++ exit(status);
++}
++
++#endif /* _ERROR_H_ */
+diff -Naur elfutils-0.166.orig/lib/fixedsizehash.h elfutils-0.166/lib/fixedsizehash.h
+--- elfutils-0.166.orig/lib/fixedsizehash.h 2016-11-15 12:19:07.101952241 -0800
++++ elfutils-0.166/lib/fixedsizehash.h 2016-11-15 12:26:59.355320459 -0800
+@@ -30,12 +30,12 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/cdefs.h>
+ #include <sys/param.h>
+
+ #include <system.h>
+
+-#define CONCAT(t1,t2) __CONCAT (t1,t2)
++#define CONCAT1(x,y) x##y
++#define CONCAT(x,y) CONCAT1(x,y)
+
+ /* Before including this file the following macros must be defined:
+
+diff -Naur elfutils-0.166.orig/lib/system.h elfutils-0.166/lib/system.h
+--- elfutils-0.166.orig/lib/system.h 2016-11-15 12:19:07.100952231 -0800
++++ elfutils-0.166/lib/system.h 2016-11-15 12:26:59.356320468 -0800
+@@ -35,6 +35,7 @@
+ #include <endian.h>
+ #include <byteswap.h>
+ #include <unistd.h>
++#include <fcntl.h>
+
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ # define LE32(n) (n)
+@@ -50,6 +51,20 @@
+ # error "Unknown byte order"
+ #endif
+
++#if !defined(__GLIBC__)
++
++/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
++ set to EINTR. */
++
++# define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++
++#endif
++
+ extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+ extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
+ extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
+diff -Naur elfutils-0.166.orig/libcpu/i386_disasm.c elfutils-0.166/libcpu/i386_disasm.c
+--- elfutils-0.166.orig/libcpu/i386_disasm.c 2016-11-15 12:19:07.098952213 -0800
++++ elfutils-0.166/libcpu/i386_disasm.c 2016-11-15 12:26:59.357320477 -0800
+@@ -1,4 +1,4 @@
+-/* Disassembler for x86.
++/* Disassembler for x86.
+ Copyright (C) 2007, 2008, 2009, 2011 Red Hat, Inc.
+ This file is part of elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2007.
+@@ -710,6 +710,7 @@
+
+ case 'm':
+ /* Mnemonic. */
++ str = mnebuf;
+
+ if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
+ {
+diff -Naur elfutils-0.166.orig/libdw/libdw.h elfutils-0.166/libdw/libdw.h
+--- elfutils-0.166.orig/libdw/libdw.h 2016-11-15 12:19:07.142952620 -0800
++++ elfutils-0.166/libdw/libdw.h 2016-11-15 12:26:59.357320477 -0800
+@@ -33,7 +33,27 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <stdint.h>
++#include <unistd.h>
++#include <alloca.h>
++#include <string.h>
+
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
++#ifndef strndupa
++#define strndupa(s, n) \
++ (__extension__ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif
+
+ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+ # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
+diff -Naur elfutils-0.166.orig/libdwfl/dwfl_build_id_find_elf.c elfutils-0.166/libdwfl/dwfl_build_id_find_elf.c
+--- elfutils-0.166.orig/libdwfl/dwfl_build_id_find_elf.c 2016-11-15 12:19:07.125952463 -0800
++++ elfutils-0.166/libdwfl/dwfl_build_id_find_elf.c 2016-11-15 12:26:59.358320487 -0800
+@@ -94,7 +94,7 @@
+ {
+ if (*file_name != NULL)
+ free (*file_name);
+- *file_name = canonicalize_file_name (name);
++ *file_name = realpath (name, NULL);
+ if (*file_name == NULL)
+ {
+ *file_name = name;
+diff -Naur elfutils-0.166.orig/libdwfl/dwfl_error.c elfutils-0.166/libdwfl/dwfl_error.c
+--- elfutils-0.166.orig/libdwfl/dwfl_error.c 2016-11-15 12:19:07.119952407 -0800
++++ elfutils-0.166/libdwfl/dwfl_error.c 2016-11-15 12:26:59.358320487 -0800
+@@ -154,7 +154,16 @@
+ switch (error &~ 0xffff)
+ {
+ case OTHER_ERROR (ERRNO):
++#if defined(__GLIBC__)
+ return strerror_r (error & 0xffff, "bad", 0);
++#else
++ {
++ static __thread char buf[128] = "";
++ if (0 == strerror_r(error & 0xffff, buf, sizeof(buf)))
++ return buf;
++ }
++ return "strerror_r() failed";
++#endif
+ case OTHER_ERROR (LIBELF):
+ return elf_errmsg (error & 0xffff);
+ case OTHER_ERROR (LIBDW):
+diff -Naur elfutils-0.166.orig/libdwfl/find-debuginfo.c elfutils-0.166/libdwfl/find-debuginfo.c
+--- elfutils-0.166.orig/libdwfl/find-debuginfo.c 2016-11-15 12:19:07.122952435 -0800
++++ elfutils-0.166/libdwfl/find-debuginfo.c 2016-11-15 12:26:59.358320487 -0800
+@@ -385,7 +385,7 @@
+ /* If FILE_NAME is a symlink, the debug file might be associated
+ with the symlink target name instead. */
+
+- char *canon = canonicalize_file_name (file_name);
++ char *canon = realpath (file_name, NULL);
+ if (canon != NULL && strcmp (file_name, canon))
+ fd = find_debuginfo_in_path (mod, canon,
+ debuglink_file, debuglink_crc,
+diff -Naur elfutils-0.166.orig/libebl/eblwstrtab.c elfutils-0.166/libebl/eblwstrtab.c
+--- elfutils-0.166.orig/libebl/eblwstrtab.c 2016-11-15 12:19:07.227953406 -0800
++++ elfutils-0.166/libebl/eblwstrtab.c 2016-11-15 12:26:59.359320496 -0800
+@@ -305,7 +305,7 @@
+
+ /* Process the current node. */
+ nodep->offset = *offsetp;
+- *freep = wmempcpy (*freep, nodep->string, nodep->len);
++ *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
+ *offsetp += nodep->len * sizeof (wchar_t);
+
+ for (subs = nodep->next; subs != NULL; subs = subs->next)
+diff -Naur elfutils-0.166.orig/libelf/elf.h elfutils-0.166/libelf/elf.h
+--- elfutils-0.166.orig/libelf/elf.h 2016-11-15 12:19:07.094952176 -0800
++++ elfutils-0.166/libelf/elf.h 2016-11-15 12:26:59.361320514 -0800
+@@ -21,6 +21,17 @@
+
+ #include <features.h>
+
++#if !defined(__GLIBC__)
++/* C++ needs to know that types and declarations are C, not C++. */
++#ifdef __cplusplus
++# define __BEGIN_DECLS extern "C" {
++# define __END_DECLS }
++#else
++# define __BEGIN_DECLS
++# define __END_DECLS
++#endif
++#endif
++
+ __BEGIN_DECLS
+
+ /* Standard ELF types. */
+diff -Naur elfutils-0.166.orig/libelf/elf_getarsym.c elfutils-0.166/libelf/elf_getarsym.c
+--- elfutils-0.166.orig/libelf/elf_getarsym.c 2016-11-15 12:19:07.089952130 -0800
++++ elfutils-0.166/libelf/elf_getarsym.c 2016-11-15 12:26:59.361320514 -0800
+@@ -297,7 +297,7 @@
+ arsym[cnt].as_off = (*u32)[cnt];
+
+ arsym[cnt].as_hash = _dl_elf_hash (str_data);
+- str_data = rawmemchr (str_data, '\0') + 1;
++ str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
+ }
+
+ /* At the end a special entry. */
diff --git a/dev-libs/elfutils/files/elfutils-0.166-musl-obstack-fts.patch b/dev-libs/elfutils/files/elfutils-0.166-musl-obstack-fts.patch
new file mode 100644
index 0000000..0d0a468
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.166-musl-obstack-fts.patch
@@ -0,0 +1,124 @@
+diff -Naur elfutils-0.166.orig/configure.ac elfutils-0.166/configure.ac
+--- elfutils-0.166.orig/configure.ac 2016-11-15 12:19:07.231953443 -0800
++++ elfutils-0.166/configure.ac 2016-11-15 12:20:59.299990043 -0800
+@@ -361,6 +361,60 @@
+ fi
+ AC_SUBST([argp_LDADD])
+
++dnl Check if we have fts available from our libc
++AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#if !defined(__x86_64__)
++ #undef _FILE_OFFSET_BITS
++ #define _FILE_OFFSET_BITS 32
++ #endif
++ #include <fts.h>],
++ [FTS* fts = 0; return fts_close(fts); return 0;]
++ )],
++ [libc_has_fts="true"],
++ [libc_has_fts="false"]
++)
++
++dnl If our libc doesn't provide fts, then test for libfts
++if test "$libc_has_fts" = "false" ; then
++ AC_MSG_WARN("libc does not have fts")
++ AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
++
++ if test "$have_fts" = "false"; then
++ AC_MSG_ERROR("no libfts found")
++ else
++ fts_LDADD="-lfts"
++ fi
++else
++ fts_LDADD=""
++fi
++AC_SUBST([fts_LDADD])
++
++dnl Check if we have obstack available from our libc
++AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#include <obstack.h>],
++ [_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
++ )],
++ [libc_has_obstack="true"],
++ [libc_has_obstack="false"]
++)
++
++dnl If our libc doesn't provide obstack, then test for libobstack
++if test "$libc_has_obstack" = "false" ; then
++ AC_MSG_WARN("libc does not have obstack")
++ AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
++
++ if test "$have_obstack" = "false"; then
++ AC_MSG_ERROR("no libobstack found")
++ else
++ obstack_LDADD="-lobstack"
++ fi
++else
++ obstack_LDADD=""
++fi
++AC_SUBST([obstack_LDADD])
++
+ dnl The directories with content.
+
+ dnl Documentation.
+diff -Naur elfutils-0.166.orig/libdw/Makefile.am elfutils-0.166/libdw/Makefile.am
+--- elfutils-0.166.orig/libdw/Makefile.am 2016-11-15 12:19:07.142952620 -0800
++++ elfutils-0.166/libdw/Makefile.am 2016-11-15 12:20:59.299990043 -0800
+@@ -112,7 +112,7 @@
+ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ -Wl,--version-script,$<,--no-undefined \
+ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+- -ldl -lz $(argp_LDADD) $(zip_LIBS)
++ -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS)
+ @$(textrel_check)
+ $(AM_V_at)ln -fs $@ $@.$(VERSION)
+
+diff -Naur elfutils-0.166.orig/src/Makefile.am elfutils-0.166/src/Makefile.am
+--- elfutils-0.166.orig/src/Makefile.am 2016-11-15 12:19:07.072951972 -0800
++++ elfutils-0.166/src/Makefile.am 2016-11-15 12:20:59.299990043 -0800
+@@ -104,28 +104,28 @@
+ ar_no_Wstack_usage = yes
+ unstrip_no_Wstack_usage = yes
+
+-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
++readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl \
+ $(demanglelib)
+-size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
+-strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
++size_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+ if NATIVE_LD
+ # -ldl is always needed for libebl.
+ ld_LDADD += libld_elf.a
+ endif
+ ld_LDFLAGS = -rdynamic
+-elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD)
+-addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(demanglelib)
+-elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) -ldl
+-objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
+-strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
+-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
+-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
+-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib)
+-elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
++elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(demanglelib)
++elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl $(demanglelib)
++elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
+
+ ldlex.o: ldscript.c
+ ldlex_no_Werror = yes
diff --git a/dev-libs/elfutils/files/elfutils-0.166-musl-utils.patch b/dev-libs/elfutils/files/elfutils-0.166-musl-utils.patch
new file mode 100644
index 0000000..c65ee7b
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.166-musl-utils.patch
@@ -0,0 +1,183 @@
+diff -Naur elfutils-0.166.orig/src/arlib.h elfutils-0.166/src/arlib.h
+--- elfutils-0.166.orig/src/arlib.h 2016-11-15 12:44:09.296103178 -0800
++++ elfutils-0.166/src/arlib.h 2016-11-15 12:44:34.238342067 -0800
+@@ -29,6 +29,12 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(DEFFILEMODE)
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
++#endif
+
+ /* State of -D/-U flags. */
+ extern bool arlib_deterministic_output;
+diff -Naur elfutils-0.166.orig/src/elfcompress.c elfutils-0.166/src/elfcompress.c
+--- elfutils-0.166.orig/src/elfcompress.c 2016-11-15 12:44:09.297103187 -0800
++++ elfutils-0.166/src/elfcompress.c 2016-11-15 12:44:34.243342115 -0800
+@@ -35,6 +35,13 @@
+ #include <gelf.h>
+ #include "system.h"
+
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH ( 1 << 5)
++#endif
++
+ /* Name and version of program. */
+ static void print_version (FILE *stream, struct argp_state *state);
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+diff -Naur elfutils-0.166.orig/src/error.h elfutils-0.166/src/error.h
+--- elfutils-0.166.orig/src/error.h 1969-12-31 16:00:00.000000000 -0800
++++ elfutils-0.166/src/error.h 2016-11-15 12:44:34.243342115 -0800
+@@ -0,0 +1,27 @@
++#ifndef _ERROR_H_
++#define _ERROR_H_
++
++#include <stdarg.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++
++static unsigned int error_message_count = 0;
++
++static inline void error(int status, int errnum, const char* format, ...)
++{
++ va_list ap;
++ fprintf(stderr, "%s: ", program_invocation_name);
++ va_start(ap, format);
++ vfprintf(stderr, format, ap);
++ va_end(ap);
++ if (errnum)
++ fprintf(stderr, ": %s", strerror(errnum));
++ fprintf(stderr, "\n");
++ error_message_count++;
++ if (status)
++ exit(status);
++}
++
++#endif /* _ERROR_H_ */
+diff -Naur elfutils-0.166.orig/src/ld.h elfutils-0.166/src/ld.h
+--- elfutils-0.166.orig/src/ld.h 2016-11-15 12:44:09.298103197 -0800
++++ elfutils-0.166/src/ld.h 2016-11-15 12:44:34.244342124 -0800
+@@ -24,6 +24,16 @@
+ #include <stdio.h>
+ #include "xelf.h"
+
++#if !defined(DL_CALL_FCT)
++# define DL_CALL_FCT(fctp, args) (*fctp) args
++#endif /* !defined(DL_CALL_FCT) */
++
++#if !defined(ACCESSPERMS)
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++#if !defined(DEFFILEMODE)
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
++#endif
+
+ /* Recommended size of the buffer passed to ld_strerror. */
+ #define ERRBUFSIZE (512)
+diff -Naur elfutils-0.166.orig/src/ldgeneric.c elfutils-0.166/src/ldgeneric.c
+--- elfutils-0.166.orig/src/ldgeneric.c 2016-11-15 12:44:09.296103178 -0800
++++ elfutils-0.166/src/ldgeneric.c 2016-11-15 12:44:34.246342143 -0800
+@@ -2628,12 +2628,12 @@
+ }
+
+
+-/* Callback function registered with on_exit to make sure the temporary
++/* Callback function registered with atexit to make sure the temporary
+ files gets removed if something goes wrong. */
+ static void
+-remove_tempfile (int status, void *arg)
++remove_tempfile (void)
+ {
+- if (status != 0 && ld_state.tempfname != NULL)
++ if (error_message_count != 0 && ld_state.tempfname != NULL)
+ unlink (ld_state.tempfname);
+ }
+
+@@ -2680,7 +2680,7 @@
+
+ /* Make sure we remove the temporary file in case something goes
+ wrong. */
+- on_exit (remove_tempfile, NULL);
++ atexit (remove_tempfile);
+
+ /* Create the ELF file data for the output file. */
+ Elf *elf = ld_state.outelf = elf_begin (fd,
+diff -Naur elfutils-0.166.orig/src/readelf.c elfutils-0.166/src/readelf.c
+--- elfutils-0.166.orig/src/readelf.c 2016-11-15 12:44:09.301103225 -0800
++++ elfutils-0.166/src/readelf.c 2016-11-15 12:44:49.816491269 -0800
+@@ -4487,10 +4487,11 @@
+ return base;
+ }
+
++static const char *listptr_name;
++
+ static int
+-compare_listptr (const void *a, const void *b, void *arg)
++compare_listptr (const void *a, const void *b)
+ {
+- const char *name = arg;
+ struct listptr *p1 = (void *) a;
+ struct listptr *p2 = (void *) b;
+
+@@ -4506,21 +4507,21 @@
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different address sizes"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ if (p1->dwarf64 != p2->dwarf64)
+ {
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different offset sizes"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ if (listptr_base (p1) != listptr_base (p2))
+ {
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different base addresses"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ }
+
+@@ -4585,9 +4586,11 @@
+ static void
+ sort_listptr (struct listptr_table *table, const char *name)
+ {
+- if (table->n > 0)
+- qsort_r (table->table, table->n, sizeof table->table[0],
+- &compare_listptr, (void *) name);
++ if (table->n > 0) {
++ listptr_name = name;
++ qsort (table->table, table->n, sizeof table->table[0],
++ &compare_listptr);
++ }
+ }
+
+ static bool
+diff -Naur elfutils-0.166.orig/src/strip.c elfutils-0.166/src/strip.c
+--- elfutils-0.166.orig/src/strip.c 2016-11-15 12:44:09.295103168 -0800
++++ elfutils-0.166/src/strip.c 2016-11-15 12:44:34.250342182 -0800
+@@ -44,6 +44,10 @@
+ #include <libebl.h>
+ #include <system.h>
+
++#if !defined(ACCESSPERMS)
++#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
++#endif
++
+ typedef uint8_t GElf_Byte;
+
+ /* Name and version of program. */
diff --git a/dev-libs/elfutils/files/elfutils-0.168-musl-libs.patch b/dev-libs/elfutils/files/elfutils-0.168-musl-libs.patch
new file mode 100644
index 0000000..047cb99
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.168-musl-libs.patch
@@ -0,0 +1,173 @@
+diff -Naur elfutils-0.168.orig/lib/error.h elfutils-0.168/lib/error.h
+--- elfutils-0.168.orig/lib/error.h 1969-12-31 16:00:00.000000000 -0800
++++ elfutils-0.168/lib/error.h 2016-12-28 11:32:13.814801412 -0800
+@@ -0,0 +1,27 @@
++#ifndef _ERROR_H_
++#define _ERROR_H_
++
++#include <stdarg.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++
++static unsigned int error_message_count = 0;
++
++static inline void error(int status, int errnum, const char* format, ...)
++{
++ va_list ap;
++ fprintf(stderr, "%s: ", program_invocation_name);
++ va_start(ap, format);
++ vfprintf(stderr, format, ap);
++ va_end(ap);
++ if (errnum)
++ fprintf(stderr, ": %s", strerror(errnum));
++ fprintf(stderr, "\n");
++ error_message_count++;
++ if (status)
++ exit(status);
++}
++
++#endif /* _ERROR_H_ */
+diff -Naur elfutils-0.168.orig/lib/fixedsizehash.h elfutils-0.168/lib/fixedsizehash.h
+--- elfutils-0.168.orig/lib/fixedsizehash.h 2016-12-28 10:56:21.563727556 -0800
++++ elfutils-0.168/lib/fixedsizehash.h 2016-12-28 11:32:13.815801422 -0800
+@@ -30,7 +30,6 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/cdefs.h>
+
+ #include <system.h>
+
+diff -Naur elfutils-0.168.orig/lib/libeu.h elfutils-0.168/lib/libeu.h
+--- elfutils-0.168.orig/lib/libeu.h 2016-12-28 10:56:21.562727546 -0800
++++ elfutils-0.168/lib/libeu.h 2016-12-28 11:32:13.816801431 -0800
+@@ -29,6 +29,7 @@
+ #ifndef LIBEU_H
+ #define LIBEU_H
+
++#include "system.h"
+ #include <stddef.h>
+ #include <stdint.h>
+
+diff -Naur elfutils-0.168.orig/lib/system.h elfutils-0.168/lib/system.h
+--- elfutils-0.168.orig/lib/system.h 2016-12-28 10:56:21.564727565 -0800
++++ elfutils-0.168/lib/system.h 2016-12-28 11:32:13.816801431 -0800
+@@ -81,7 +81,7 @@
+ do \
+ __res = expression; \
+ while (__res == -1 && errno == EINTR); \
+- __res; });
++ __res; })
+ #endif
+
+ static inline ssize_t __attribute__ ((unused))
+diff -Naur elfutils-0.168.orig/libdwfl/dwfl_build_id_find_elf.c elfutils-0.168/libdwfl/dwfl_build_id_find_elf.c
+--- elfutils-0.168.orig/libdwfl/dwfl_build_id_find_elf.c 2016-12-28 10:56:21.720729030 -0800
++++ elfutils-0.168/libdwfl/dwfl_build_id_find_elf.c 2016-12-28 11:32:13.816801431 -0800
+@@ -30,6 +30,7 @@
+ #include <inttypes.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include "system.h"
+
+
+ int
+@@ -94,7 +95,7 @@
+ {
+ if (*file_name != NULL)
+ free (*file_name);
+- *file_name = canonicalize_file_name (name);
++ *file_name = realpath (name, NULL);
+ if (*file_name == NULL)
+ {
+ *file_name = name;
+diff -Naur elfutils-0.168.orig/libdwfl/dwfl_error.c elfutils-0.168/libdwfl/dwfl_error.c
+--- elfutils-0.168.orig/libdwfl/dwfl_error.c 2016-12-28 10:56:21.714728974 -0800
++++ elfutils-0.168/libdwfl/dwfl_error.c 2016-12-28 11:34:41.712239116 -0800
+@@ -154,7 +154,16 @@
+ switch (error &~ 0xffff)
+ {
+ case OTHER_ERROR (ERRNO):
++#if defined(__GLIBC__)
+ return strerror_r (error & 0xffff, "bad", 0);
++#else
++ {
++ static __thread char buf[128] = "";
++ if (strerror_r (error & 0xffff, buf, sizeof(buf)) == 0)
++ return buf;
++ }
++ return "strerror_r() failed";
++#endif
+ case OTHER_ERROR (LIBELF):
+ return elf_errmsg (error & 0xffff);
+ case OTHER_ERROR (LIBDW):
+diff -Naur elfutils-0.168.orig/libdwfl/dwfl_module_getdwarf.c elfutils-0.168/libdwfl/dwfl_module_getdwarf.c
+--- elfutils-0.168.orig/libdwfl/dwfl_module_getdwarf.c 2016-12-28 10:56:21.710728936 -0800
++++ elfutils-0.168/libdwfl/dwfl_module_getdwarf.c 2016-12-28 11:32:13.817801441 -0800
+@@ -33,6 +33,7 @@
+ #include <unistd.h>
+ #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
+ #include "../libelf/libelfP.h"
++#include "system.h"
+
+ static inline Dwfl_Error
+ open_elf_file (Elf **elf, int *fd, char **name)
+diff -Naur elfutils-0.168.orig/libdwfl/find-debuginfo.c elfutils-0.168/libdwfl/find-debuginfo.c
+--- elfutils-0.168.orig/libdwfl/find-debuginfo.c 2016-12-28 10:56:21.716728992 -0800
++++ elfutils-0.168/libdwfl/find-debuginfo.c 2016-12-28 11:32:13.817801441 -0800
+@@ -385,7 +385,7 @@
+ /* If FILE_NAME is a symlink, the debug file might be associated
+ with the symlink target name instead. */
+
+- char *canon = canonicalize_file_name (file_name);
++ char *canon = realpath (file_name, NULL);
+ if (canon != NULL && strcmp (file_name, canon))
+ fd = find_debuginfo_in_path (mod, canon,
+ debuglink_file, debuglink_crc,
+diff -Naur elfutils-0.168.orig/libdwfl/libdwfl_crc32_file.c elfutils-0.168/libdwfl/libdwfl_crc32_file.c
+--- elfutils-0.168.orig/libdwfl/libdwfl_crc32_file.c 2016-12-28 10:56:21.710728936 -0800
++++ elfutils-0.168/libdwfl/libdwfl_crc32_file.c 2016-12-28 11:32:13.817801441 -0800
+@@ -31,6 +31,5 @@
+
+ #define crc32_file attribute_hidden __libdwfl_crc32_file
+ #define crc32 __libdwfl_crc32
+-#define LIB_SYSTEM_H 1
+ #include <libdwflP.h>
+ #include "../lib/crc32_file.c"
+diff -Naur elfutils-0.168.orig/libdwfl/linux-kernel-modules.c elfutils-0.168/libdwfl/linux-kernel-modules.c
+--- elfutils-0.168.orig/libdwfl/linux-kernel-modules.c 2016-12-28 10:56:21.717729002 -0800
++++ elfutils-0.168/libdwfl/linux-kernel-modules.c 2016-12-28 11:32:13.818801450 -0800
+@@ -45,6 +45,7 @@
+ #include <sys/utsname.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include "system.h"
+
+ /* If fts.h is included before config.h, its indirect inclusions may not
+ give us the right LFS aliases of these functions, so map them manually. */
+diff -Naur elfutils-0.168.orig/libelf/elf.h elfutils-0.168/libelf/elf.h
+--- elfutils-0.168.orig/libelf/elf.h 2016-12-28 10:56:21.585727762 -0800
++++ elfutils-0.168/libelf/elf.h 2016-12-28 11:32:13.819801460 -0800
+@@ -21,7 +21,9 @@
+
+ #include <features.h>
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /* Standard ELF types. */
+
+@@ -3682,6 +3684,7 @@
+ #define R_BPF_NONE 0 /* No reloc */
+ #define R_BPF_MAP_FD 1 /* Map fd to pointer */
+
+-__END_DECLS
+-
++#ifdef __cplusplus
++}
++#endif
+ #endif /* elf.h */
diff --git a/dev-libs/elfutils/files/elfutils-0.168-musl-obstack-fts.patch b/dev-libs/elfutils/files/elfutils-0.168-musl-obstack-fts.patch
new file mode 100644
index 0000000..22c668e
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.168-musl-obstack-fts.patch
@@ -0,0 +1,102 @@
+diff -Naur elfutils-0.168.orig/configure.ac elfutils-0.168/configure.ac
+--- elfutils-0.168.orig/configure.ac 2016-12-28 10:56:21.720729030 -0800
++++ elfutils-0.168/configure.ac 2016-12-28 11:58:40.493268053 -0800
+@@ -355,6 +355,60 @@
+ fi
+ AC_SUBST([argp_LDADD])
+
++dnl Check if we have fts available from our libc
++AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#if !defined(__x86_64__)
++ #undef _FILE_OFFSET_BITS
++ #define _FILE_OFFSET_BITS 32
++ #endif
++ #include <fts.h>],
++ [FTS* fts = 0; return fts_close(fts); return 0;]
++ )],
++ [libc_has_fts="true"],
++ [libc_has_fts="false"]
++)
++
++dnl If our libc doesn't provide fts, then test for libfts
++if test "$libc_has_fts" = "false" ; then
++ AC_MSG_WARN("libc does not have fts")
++ AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
++
++ if test "$have_fts" = "false"; then
++ AC_MSG_ERROR("no libfts found")
++ else
++ fts_LDADD="-lfts"
++ fi
++else
++ fts_LDADD=""
++fi
++AC_SUBST([fts_LDADD])
++
++dnl Check if we have obstack available from our libc
++AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#include <obstack.h>],
++ [_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
++ )],
++ [libc_has_obstack="true"],
++ [libc_has_obstack="false"]
++)
++
++dnl If our libc doesn't provide obstack, then test for libobstack
++if test "$libc_has_obstack" = "false" ; then
++ AC_MSG_WARN("libc does not have obstack")
++ AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
++
++ if test "$have_obstack" = "false"; then
++ AC_MSG_ERROR("no libobstack found")
++ else
++ obstack_LDADD="-lobstack"
++ fi
++else
++ obstack_LDADD=""
++fi
++AC_SUBST([obstack_LDADD])
++
+ dnl Check if we have <linux/bpf.h> for EM_BPF disassembly.
+ AC_CHECK_HEADERS(linux/bpf.h)
+ AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "x$ac_cv_header_linux_bpf_h" = "xyes"])
+diff -Naur elfutils-0.168.orig/libdw/Makefile.am elfutils-0.168/libdw/Makefile.am
+--- elfutils-0.168.orig/libdw/Makefile.am 2016-12-28 10:56:21.700728842 -0800
++++ elfutils-0.168/libdw/Makefile.am 2016-12-28 11:58:40.494268063 -0800
+@@ -112,7 +112,7 @@
+ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ -Wl,--version-script,$<,--no-undefined \
+ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+- -ldl -lz $(argp_LDADD) $(zip_LIBS)
++ -ldl -lz $(argp_LDADD) $(fts_LDADD) $(zip_LIBS)
+ @$(textrel_check)
+ $(AM_V_at)ln -fs $@ $@.$(VERSION)
+
+diff -Naur elfutils-0.168.orig/src/Makefile.am elfutils-0.168/src/Makefile.am
+--- elfutils-0.168.orig/src/Makefile.am 2016-12-28 10:56:21.570727621 -0800
++++ elfutils-0.168/src/Makefile.am 2016-12-28 12:02:08.066297072 -0800
+@@ -68,8 +68,8 @@
+ unstrip_no_Wstack_usage = yes
+
+ readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
+- $(demanglelib)
++nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \
++ $(obstack_LDADD) -ldl $(demanglelib)
+ size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
+ strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
+ elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+@@ -77,9 +77,9 @@
+ addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
+ elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+ objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
++ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD)
+ strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
+-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
++ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD)
+ unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
+ stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib)
+ elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
diff --git a/dev-libs/elfutils/files/elfutils-0.168-musl-utils.patch b/dev-libs/elfutils/files/elfutils-0.168-musl-utils.patch
new file mode 100644
index 0000000..486f6e3
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.168-musl-utils.patch
@@ -0,0 +1,122 @@
+diff -Naur elfutils-0.168.orig/src/arlib.h elfutils-0.168/src/arlib.h
+--- elfutils-0.168.orig/src/arlib.h 2016-12-28 10:56:21.570727621 -0800
++++ elfutils-0.168/src/arlib.h 2016-12-28 11:51:27.643036959 -0800
+@@ -29,6 +29,12 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(DEFFILEMODE)
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
++#endif
+
+ /* State of -D/-U flags. */
+ extern bool arlib_deterministic_output;
+diff -Naur elfutils-0.168.orig/src/elfcompress.c elfutils-0.168/src/elfcompress.c
+--- elfutils-0.168.orig/src/elfcompress.c 2016-12-28 10:56:21.569727612 -0800
++++ elfutils-0.168/src/elfcompress.c 2016-12-28 11:53:53.587463560 -0800
+@@ -37,6 +37,13 @@
+ #include "libeu.h"
+ #include "system.h"
+
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH ( 1 << 5)
++#endif
++
+ /* Name and version of program. */
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+
+diff -Naur elfutils-0.168.orig/src/readelf.c elfutils-0.168/src/readelf.c
+--- elfutils-0.168.orig/src/readelf.c 2016-12-28 10:56:21.572727640 -0800
++++ elfutils-0.168/src/readelf.c 2016-12-28 11:45:38.460680025 -0800
+@@ -4490,10 +4490,11 @@
+ return base;
+ }
+
++static const char *listptr_name;
++
+ static int
+-compare_listptr (const void *a, const void *b, void *arg)
++compare_listptr (const void *a, const void *b)
+ {
+- const char *name = arg;
+ struct listptr *p1 = (void *) a;
+ struct listptr *p2 = (void *) b;
+
+@@ -4509,21 +4510,21 @@
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different address sizes"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ if (p1->dwarf64 != p2->dwarf64)
+ {
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different offset sizes"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ if (listptr_base (p1) != listptr_base (p2))
+ {
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different base addresses"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ }
+
+@@ -4589,8 +4590,11 @@
+ sort_listptr (struct listptr_table *table, const char *name)
+ {
+ if (table->n > 0)
+- qsort_r (table->table, table->n, sizeof table->table[0],
+- &compare_listptr, (void *) name);
++ {
++ listptr_name = name;
++ qsort (table->table, table->n, sizeof table->table[0],
++ &compare_listptr);
++ }
+ }
+
+ static bool
+diff -Naur elfutils-0.168.orig/src/strip.c elfutils-0.168/src/strip.c
+--- elfutils-0.168.orig/src/strip.c 2016-12-28 10:56:21.571727631 -0800
++++ elfutils-0.168/src/strip.c 2016-12-28 11:46:09.680979303 -0800
+@@ -45,6 +45,10 @@
+ #include <libeu.h>
+ #include <system.h>
+
++#if !defined(ACCESSPERMS)
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++
+ typedef uint8_t GElf_Byte;
+
+ /* Name and version of program. */
+diff -Naur elfutils-0.168.orig/src/unstrip.c elfutils-0.168/src/unstrip.c
+--- elfutils-0.168.orig/src/unstrip.c 2016-12-28 10:56:21.571727631 -0800
++++ elfutils-0.168/src/unstrip.c 2016-12-28 11:57:40.821684766 -0800
+@@ -56,6 +56,15 @@
+ # define _(str) gettext (str)
+ #endif
+
++#ifndef strndupa
++#define strndupa(s, n) \
++ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);})
++#endif
++
+ /* Name and version of program. */
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+
diff --git a/dev-libs/elfutils/metadata.xml b/dev-libs/elfutils/metadata.xml
new file mode 100644
index 0000000..14c09d8
--- /dev/null
+++ b/dev-libs/elfutils/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>toolchain@gentoo.org</email>
+ <name>Gentoo Toolchain Project</name>
+ </maintainer>
+ <use>
+ <flag name="lzma">Support automatic decompression of LZMA-compressed files and kernel images</flag>
+ <flag name="threads">Build the libraries with thread safe support</flag>
+ <flag name="utils">Install command-line utilities (all the eu-* programs)</flag>
+ </use>
+</pkgmetadata>
next reply other threads:[~2017-01-21 20:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-21 20:08 Aric Belsito [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-08-08 20:09 [gentoo-commits] proj/musl:master commit in: dev-libs/elfutils/files/, dev-libs/elfutils/ Aric Belsito
2018-06-11 17:24 Aric Belsito
2019-04-12 4:14 Jory Pratt
2019-08-21 22:42 Jory Pratt
2020-09-07 14:20 Jory Pratt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485029267.92b34c99e4c36d2328ffbd66e485fb7d433aa7c9.lluixhi@gentoo \
--to=lluixhi@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox