summaryrefslogtreecommitdiff
path: root/dev-libs
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2016-12-03 01:46:08 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2016-12-03 01:46:08 -0600
commit20969e06a3ecfac7efc9817cdf2f1b45d2bf7554 (patch)
tree1a4e2d29120e5a86314b3aa24ddabe5b2b695470 /dev-libs
parentee93d8900b12ecb556aaf7f11dac5ec9660d5f1f (diff)
downloadpackages-20969e06a3ecfac7efc9817cdf2f1b45d2bf7554.tar.gz
packages-20969e06a3ecfac7efc9817cdf2f1b45d2bf7554.tar.bz2
packages-20969e06a3ecfac7efc9817cdf2f1b45d2bf7554.tar.xz
packages-20969e06a3ecfac7efc9817cdf2f1b45d2bf7554.zip
dev-libs/elfutils: new package
Diffstat (limited to 'dev-libs')
-rw-r--r--dev-libs/elfutils/Manifest1
-rw-r--r--dev-libs/elfutils/elfutils-0.167.ebuild87
-rw-r--r--dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch26
-rw-r--r--dev-libs/elfutils/files/elfutils-0.164-fix-uninitialised.patch11
-rw-r--r--dev-libs/elfutils/files/elfutils-0.164-musl-combined.patch366
-rw-r--r--dev-libs/elfutils/files/elfutils-0.166-makefile.patch38
-rw-r--r--dev-libs/elfutils/files/elfutils-0.167-makefile.patch39
-rw-r--r--dev-libs/elfutils/files/error.h27
8 files changed, 595 insertions, 0 deletions
diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest
new file mode 100644
index 000000000..76b77a516
--- /dev/null
+++ b/dev-libs/elfutils/Manifest
@@ -0,0 +1 @@
+DIST elfutils-0.167.tar.bz2 6456047 SHA256 3f300087c42b6f35591163b48246b4098ce39c4c6f5d55a83023c903c5776553 SHA512 855b27b7b2785265e095a5c28518b9765238bbcdc8aefede11453e9727156b71360a4b0e2634f2c3813d4b632d3be7079b2d952701bf0455a9c2c19f7facdc91 WHIRLPOOL 1eccbdf65e75c36d7e7704e34eb824d8f54aa4d5879c8df174a1121889fd796cd0aaf5e727f07f361da301659f23d7167e5e59e6a039003def0411d0d01a570e
diff --git a/dev-libs/elfutils/elfutils-0.167.ebuild b/dev-libs/elfutils/elfutils-0.167.ebuild
new file mode 100644
index 000000000..5ae01d793
--- /dev/null
+++ b/dev-libs/elfutils/elfutils-0.167.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools 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-with-exceptions"
+SLOT="0"
+KEYWORDS="alpha arm ~arm64 hppa ~mips ppc ppc64 ~sparc64 x86 x86_64"
+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
+ !elibc_glibc? (
+ sys-libs/argp-standalone
+ sys-libs/fts-standalone
+ )
+ elibc_musl? ( sys-libs/musl-obstack )
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r11
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+# We need to require a newer glibc for its elf.h defs. #571814
+DEPEND="${RDEPEND}
+ !<sys-libs/glibc-2.22
+ nls? ( sys-devel/gettext )
+ >=sys-devel/flex-2.5.4a
+ sys-devel/m4"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.118-PaX-support.patch"
+ "${FILESDIR}/${PN}-0.164-fix-uninitialised.patch"
+ "${FILESDIR}/${PN}-0.164-musl-combined.patch"
+ "${FILESDIR}/${PN}-0.167-makefile.patch"
+)
+
+src_prepare() {
+ eapply -p0 ${PATCHES[@]}
+ eapply_user
+ 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 {} +
+ cp "${FILESDIR}/error.h" "${S}"/lib/
+ cp "${FILESDIR}/error.h" "${S}"/src/
+ eautoreconf
+}
+
+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 \
+ $(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/files/elfutils-0.118-PaX-support.patch b/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch
new file mode 100644
index 000000000..083f32ff8
--- /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.164-fix-uninitialised.patch b/dev-libs/elfutils/files/elfutils-0.164-fix-uninitialised.patch
new file mode 100644
index 000000000..6ab15e50e
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.164-fix-uninitialised.patch
@@ -0,0 +1,11 @@
+
+--- libcpu/i386_disasm.c 2015-08-21 14:22:37.000000000 +0200
++++ libcpu/i386_disasm.c 2015-11-20 06:30:59.250629957 +0100
+@@ -710,6 +710,7 @@
+
+ case 'm':
+ /* Mnemonic. */
++ str = mnebuf;
+
+ if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
+ {
diff --git a/dev-libs/elfutils/files/elfutils-0.164-musl-combined.patch b/dev-libs/elfutils/files/elfutils-0.164-musl-combined.patch
new file mode 100644
index 000000000..ca8f47566
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.164-musl-combined.patch
@@ -0,0 +1,366 @@
+--- src/strip.c 2015-10-12 12:22:58.000000000 +0200
++++ src/strip.c 2015-11-20 07:44:13.626287111 +0100
+@@ -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. */
+--- libdwfl/dwfl_build_id_find_elf.c 2015-10-12 12:22:58.000000000 +0200
++++ libdwfl/dwfl_build_id_find_elf.c 2015-11-20 05:13:10.972994172 +0100
+@@ -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;
+--- libdwfl/find-debuginfo.c 2015-10-12 12:22:58.000000000 +0200
++++ libdwfl/find-debuginfo.c 2015-11-20 05:18:56.990967176 +0100
+@@ -372,7 +372,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,
+--- libelf/elf.h 2015-08-21 14:22:37.000000000 +0200
++++ libelf/elf.h 2015-11-20 04:54:33.948081321 +0100
+@@ -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. */
+--- lib/fixedsizehash.h 2015-08-21 14:22:37.000000000 +0200
++++ lib/fixedsizehash.h 2015-11-20 05:05:45.648028916 +0100
+@@ -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:
+
+--- configure.ac 2015-10-15 15:16:57.000000000 +0200
++++ configure.ac 2015-11-20 05:32:57.723901582 +0100
+@@ -305,6 +305,62 @@
+ 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 The directories with content.
+
+ dnl Documentation.
+--- libdw/Makefile.am.orig 2016-04-02 12:20:57.174729538 +0200
++++ libdw/Makefile.am 2016-04-02 12:23:05.422736154 +0200
+@@ -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)
+
+--- libdw/libdw.h 2015-08-21 14:22:37.000000000 +0200
++++ libdw/libdw.h 2015-11-20 08:31:14.160067056 +0100
+@@ -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__)))
+--- src/arlib.h 2015-08-21 14:22:37.000000000 +0200
++++ src/arlib.h 2015-11-20 08:02:55.153199611 +0100
+@@ -29,6 +29,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+
++#if !defined(ACCESSPERMS)
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++#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;
+--- src/elfcompress.c.orig 2016-04-02 12:51:26.903848894 +0200
++++ src/elfcompress.c 2016-04-02 12:55:15.076996338 +0200
+@@ -35,6 +35,14 @@
+ #include <gelf.h>
+ #include "system.h"
+
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH 0
++#endif
++
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++
+ /* Name and version of program. */
+ static void print_version (FILE *stream, struct argp_state *state);
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+--- src/nm.c 2015-08-21 14:22:37.000000000 +0200
++++ src/nm.c 2015-11-20 07:31:20.508347429 +0100
+@@ -46,6 +46,21 @@
+ #include <system.h>
+ #include "../libebl/libeblP.h"
+
++#if !defined(__GLIBC__)
++static int obstack_printf(struct obstack *obst, const char *fmt, ...)
++{
++ char buf[1024];
++ va_list ap;
++ int len;
++
++ va_start(ap, fmt);
++ len = vsnprintf(buf, sizeof(buf), fmt, ap);
++ obstack_grow(obst, buf, len);
++ va_end(ap);
++
++ return len;
++}
++#endif
+
+ /* Name and version of program. */
+ static void print_version (FILE *stream, struct argp_state *state);
+--- src/readelf.c 2015-10-12 12:22:58.000000000 +0200
++++ src/readelf.c 2015-11-20 08:11:32.945159213 +0100
+@@ -4366,10 +4366,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;
+
+@@ -4385,21 +4386,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);
+ }
+ }
+
+@@ -4464,9 +4465,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
+--- libdwfl/dwfl_error.c 2015-09-29 17:18:51.000000000 +0200
++++ libdwfl/dwfl_error.c 2015-11-20 05:11:29.889002058 +0100
+@@ -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):
+--- lib/system.h 2015-08-21 14:22:37.000000000 +0200
++++ lib/system.h 2015-11-20 04:36:49.563164363 +0100
+@@ -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 +50,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__));
+--- libelf/elf_getarsym.c 2015-10-12 12:22:58.000000000 +0200
++++ libelf/elf_getarsym.c 2015-11-20 05:01:57.762046695 +0100
+@@ -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. */
+--- lib/eu-config.h.old 2016-03-31 09:59:09.000000000 +0100
++++ lib/eu-config.h 2016-11-01 13:36:53.505447313 +0100
+@@ -34,7 +34,7 @@
+ # include <assert.h>
+ # define rwlock_define(class,name) class pthread_rwlock_t name
+ # define RWLOCK_CALL(call) \
+- ({ int _err = pthread_rwlock_ ## call; assert_perror (_err); })
++ ({ int _err = pthread_rwlock_ ## call; assert (_err == 0); })
+ # define rwlock_init(lock) RWLOCK_CALL (init (&lock, NULL))
+ # define rwlock_fini(lock) RWLOCK_CALL (destroy (&lock))
+ # define rwlock_rdlock(lock) RWLOCK_CALL (rdlock (&lock))
diff --git a/dev-libs/elfutils/files/elfutils-0.166-makefile.patch b/dev-libs/elfutils/files/elfutils-0.166-makefile.patch
new file mode 100644
index 000000000..f0e13b428
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.166-makefile.patch
@@ -0,0 +1,38 @@
+--- src/Makefile.am.old 2016-01-12 13:49:19.000000000 +0100
++++ src/Makefile.am 2016-11-01 10:20:21.733441154 +0100
+@@ -67,21 +67,21 @@
+ 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
++size_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+-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
++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) -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)
++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)
+
+ installcheck-binPROGRAMS: $(bin_PROGRAMS)
diff --git a/dev-libs/elfutils/files/elfutils-0.167-makefile.patch b/dev-libs/elfutils/files/elfutils-0.167-makefile.patch
new file mode 100644
index 000000000..0c075d0c2
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.167-makefile.patch
@@ -0,0 +1,39 @@
+--- src/Makefile.am.old 2016-08-03 17:19:47.000000000 +0100
++++ src/Makefile.am 2016-11-23 20:05:52.065592970 +0100
+@@ -67,22 +67,22 @@
+ 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) $(libdw) $(libeu) $(argp_LDADD) -ldl
+-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
++size_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
++strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
++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) -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)
++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)
+
+ installcheck-binPROGRAMS: $(bin_PROGRAMS)
+ bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
diff --git a/dev-libs/elfutils/files/error.h b/dev-libs/elfutils/files/error.h
new file mode 100644
index 000000000..ef06827a0
--- /dev/null
+++ b/dev-libs/elfutils/files/error.h
@@ -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_ */