commit: f94fed4c98ad99c6c064929872ec4cf2766b1efb Author: Jory Pratt <anarchy <AT> gentoo <DOT> org> AuthorDate: Mon Sep 7 14:18:52 2020 +0000 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> CommitDate: Mon Sep 7 14:18:52 2020 +0000 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=f94fed4c
dev-libs/elfutils: Sync with ::gentoo Closes: https://github.com/gentoo/musl/issues/340 Package-Manager: Portage-3.0.5, Repoman-3.0.1 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org> dev-libs/elfutils/Manifest | 4 +- dev-libs/elfutils/elfutils-0.176-r1.ebuild | 80 ---- dev-libs/elfutils/elfutils-0.177.ebuild | 80 ---- ...elfutils-0.178.ebuild => elfutils-0.180.ebuild} | 55 ++- .../elfutils/files/elfutils-0.173-reorder.patch | 37 -- .../files/elfutils-0.176-dwarf_fregs.patch | 36 -- .../files/elfutils-0.176-portability-fixes.patch | 415 -------------------- .../files/elfutils-0.177-portability-fixes.patch | 416 --------------------- .../files/elfutils-0.179-CC-in-tests.patch | 45 +++ ...port.patch => elfutils-0.180-PaX-support.patch} | 10 +- .../elfutils/files/elfutils-0.180-readelf.patch | 23 ++ 11 files changed, 111 insertions(+), 1090 deletions(-) diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest index 0e02e5c..f8c5896 100644 --- a/dev-libs/elfutils/Manifest +++ b/dev-libs/elfutils/Manifest @@ -1,3 +1 @@ -DIST elfutils-0.176.tar.bz2 8646075 BLAKE2B 7f23d59b7f5d74946fea928a7fada7764c1f96a5eefefc4a3a382090eb7cad07c80419218300d853ccbef8f4e2288eb443ff06b3e64bf4511d9fa7aa84f5b794 SHA512 7f032913be363a43229ded85d495dcf7542b3c85974aaaba0d984228dc9ac1721da3dc388d3fa02325a80940161db7e9ad2c9e4521a424ad8a7d050c0902915b -DIST elfutils-0.177.tar.bz2 8852413 BLAKE2B 03f432342651f7646d73b7847325bd14b722ce34d85df01b1ad072b916af9b9da2d0d119cd24e952073bd584ec76b027ba9b6c7d45fb057372b3e700b1f5741a SHA512 2779987463a22ed220759e25a09c9a1eb84c0f36db37675136e59aa55c7f8f90b7a7d34ffc4e6a4291d7fa73692a1bd1a303a74270b11d1623b4f9868d19498f -DIST elfutils-0.178.tar.bz2 9007557 BLAKE2B 241b611dbfac37f35a670fbe80096c21b870e4b26fcddc8af26fba0373c9cd72eae42aabae2803b7b16c3bf649aeda036b1ea1b40952b43c4021ed23fcb51e80 SHA512 356656ad0db8f6877b461de1a11280de16a9cc5d8dde4381a938a212e828e32755135e5e3171d311c4c9297b728fbd98123048e2e8fbf7fe7de68976a2daabe5 +DIST elfutils-0.180.tar.bz2 9079640 BLAKE2B bd7863b82a71d2932a23c9d125d5eb6485977a3256a8a0b25980183d33f7345c3d9fae78277de5c955eb0ceeb955f8fa71d209f4f39bcf6dd49e46a8bbd7efcf SHA512 62e96035ccfe8928baca2285decbe8b8703a2daa956df81ece18fecf643272fb68955806b3e807a514141a7a9bf44520bf09461672aa580bd6807485fb604d25 diff --git a/dev-libs/elfutils/elfutils-0.176-r1.ebuild b/dev-libs/elfutils/elfutils-0.176-r1.ebuild deleted file mode 100644 index b057018..0000000 --- a/dev-libs/elfutils/elfutils-0.176-r1.ebuild +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit autotools 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="amd64 arm arm64 ~mips ppc ppc64 x86" -IUSE="bzip2 lzma nls static-libs test +threads +utils" -RESTRICT="!test? ( test )" - -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_musl? ( - sys-libs/argp-standalone - sys-libs/fts-standalone - sys-libs/obstack-standalone - )" -DEPEND="${RDEPEND} - nls? ( sys-devel/gettext ) - >=sys-devel/flex-2.5.4a" - -PATCHES=( - "${FILESDIR}"/${PN}-0.118-PaX-support.patch - "${FILESDIR}"/${PN}-0.175-disable-biarch-test-PR24158.patch - "${FILESDIR}"/${PN}-0.173-reorder.patch - "${FILESDIR}"/${PN}-0.176-portability-fixes.patch - "${FILESDIR}"/${PN}-0.176-dwarf_fregs.patch -) - -src_prepare() { - default - - eautoreconf - - if ! use static-libs; then - sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die - fi - # https://sourceware.org/PR23914 - sed -i 's:-Werror::' */Makefile.in || die -} - -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 VERBOSE=1 -} - -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. - if ! use utils; then - rm -rf "${ED}"/usr/bin || die - fi -} diff --git a/dev-libs/elfutils/elfutils-0.177.ebuild b/dev-libs/elfutils/elfutils-0.177.ebuild deleted file mode 100644 index e5e911f..0000000 --- a/dev-libs/elfutils/elfutils-0.177.ebuild +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit autotools 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="amd64 arm arm64 ~mips ppc x86" -IUSE="bzip2 lzma nls static-libs test +threads +utils" -RESTRICT="!test? ( test )" - -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_musl? ( - sys-libs/argp-standalone - sys-libs/fts-standalone - sys-libs/obstack-standalone - )" -DEPEND="${RDEPEND} - nls? ( sys-devel/gettext ) - >=sys-devel/flex-2.5.4a" - -PATCHES=( - "${FILESDIR}"/${PN}-0.118-PaX-support.patch - "${FILESDIR}"/${PN}-0.175-disable-biarch-test-PR24158.patch - "${FILESDIR}"/${PN}-0.176-dwarf_fregs.patch - "${FILESDIR}"/${PN}-0.177-disable-large.patch - "${FILESDIR}"/${PN}-0.177-portability-fixes.patch -) - -src_prepare() { - default - - eautoreconf - - if ! use static-libs; then - sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die - fi - # https://sourceware.org/PR23914 - sed -i 's:-Werror::' */Makefile.in || die -} - -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 VERBOSE=1 -} - -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. - if ! use utils; then - rm -rf "${ED}"/usr/bin || die - fi -} diff --git a/dev-libs/elfutils/elfutils-0.178.ebuild b/dev-libs/elfutils/elfutils-0.180.ebuild similarity index 58% rename from dev-libs/elfutils/elfutils-0.178.ebuild rename to dev-libs/elfutils/elfutils-0.180.ebuild index 5de6511..a4da76a 100644 --- a/dev-libs/elfutils/elfutils-0.178.ebuild +++ b/dev-libs/elfutils/elfutils-0.180.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 2003-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 -inherit autotools flag-o-matic multilib-minimal +inherit autotools flag-o-matic multilib-minimal toolchain-funcs DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)" HOMEPAGE="http://elfutils.org/" @@ -11,12 +11,12 @@ SRC_URI="https://sourceware.org/elfutils/ftp/${PV}/${P}.tar.bz2" LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )" SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86" +KEYWORDS="~alpha amd64 arm arm64 ~mips ppc ppc64" IUSE="bzip2 lzma nls static-libs test +threads +utils valgrind" -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}] ) +RDEPEND=">=sys-libs/zlib-1.2.8-r1[static-libs?,${MULTILIB_USEDEP}] + bzip2? ( >=app-arch/bzip2-1.0.6-r4[static-libs?,${MULTILIB_USEDEP}] ) + lzma? ( >=app-arch/xz-utils-5.0.5-r1[static-libs?,${MULTILIB_USEDEP}] ) elibc_musl? ( sys-libs/argp-standalone sys-libs/fts-standalone @@ -28,24 +28,27 @@ DEPEND="${RDEPEND} " BDEPEND="nls? ( sys-devel/gettext ) >=sys-devel/flex-2.5.4a - sys-devel/m4 - elibc_musl? ( dev-libs/libbsd )" + sys-devel/m4" RESTRICT="!test? ( test )" PATCHES=( - "${FILESDIR}"/${PN}-0.118-PaX-support.patch "${FILESDIR}"/${PN}-0.175-disable-biarch-test-PR24158.patch "${FILESDIR}"/${PN}-0.177-disable-large.patch - "${FILESDIR}"/${PV}/fix-aarch64_fregs.patch - "${FILESDIR}"/${PV}/musl-asm_ptrace_h.patch - "${FILESDIR}"/${PV}/musl-cdefs.patch - "${FILESDIR}"/${PV}/musl-macros.patch - "${FILESDIR}"/${PV}/musl-fts-obstack.patch - "${FILESDIR}"/${PV}/musl-qsort_r.patch - "${FILESDIR}"/${PV}/musl-strerror_r.patch - "${FILESDIR}"/${PV}/musl-strndupa.patch - "${FILESDIR}"/${PV}/musl-error_h.patch + "${FILESDIR}"/${PN}-0.180-PaX-support.patch + "${FILESDIR}"/${PN}-0.179-CC-in-tests.patch + "${FILESDIR}"/${PN}-0.180-readelf.patch + + # Musl Patches + "${FILESDIR}"/0.178/fix-aarch64_fregs.patch + "${FILESDIR}"/0.178/musl-asm_ptrace_h.patch + "${FILESDIR}"/0.178/musl-cdefs.patch + "${FILESDIR}"/0.178/musl-macros.patch + "${FILESDIR}"/0.178/musl-fts-obstack.patch + "${FILESDIR}"/0.178/musl-qsort_r.patch + "${FILESDIR}"/0.178/musl-strerror_r.patch + "${FILESDIR}"/0.178/musl-strndupa.patch + "${FILESDIR}"/0.178/musl-error_h.patch ) src_prepare() { @@ -58,10 +61,24 @@ src_prepare() { fi # https://sourceware.org/PR23914 sed -i 's:-Werror::' */Makefile.in || die + + if use elibc_musl; then + cat > lib/libintl.h <<-EOF + #ifndef LIBINTL_H + #define LIBINTL_H + #define _(x) (x) + #endif + EOF + fi } src_configure() { use test && append-flags -g #407135 + + # Symbol aliases are implemented as asm statements. + # Will require porting: https://gcc.gnu.org/PR48200 + filter-flags '-flto*' + multilib-minimal_src_configure } @@ -78,8 +95,10 @@ multilib_src_configure() { } multilib_src_test() { + # CC is a workaround for tests using ${CC-gcc} env LD_LIBRARY_PATH="${BUILD_DIR}/libelf:${BUILD_DIR}/libebl:${BUILD_DIR}/libdw:${BUILD_DIR}/libasm" \ LC_ALL="C" \ + CC="$(tc-getCC)" \ emake check VERBOSE=1 } diff --git a/dev-libs/elfutils/files/elfutils-0.173-reorder.patch b/dev-libs/elfutils/files/elfutils-0.173-reorder.patch deleted file mode 100644 index fd3dede..0000000 --- a/dev-libs/elfutils/files/elfutils-0.173-reorder.patch +++ /dev/null @@ -1,37 +0,0 @@ -https://bugs.gentoo.org/666954 -https://github.com/rpm-software-management/rpm/issues/423 -https://sourceware.org/ml/elfutils-devel/2019-q2/msg00077.html - -From: Mark Wielaard <mark at klomp dot org> -Subject: [PATCH] libelf: Mark shdr_flags dirty if offset or size changes during update. -Date: Mon, 13 May 2019 00:13:42 +0200 -Message-Id: <[email protected]> - -We forgot to mark the shdr_flags dirty when only the sh_size or -sh_offset changed during elf_update (). This meant that if there were -no other shdr changes we only wrote out the section data, but didn't -write out the shdr table to the file. - -Signed-off-by: Mark Wielaard <[email protected]> ---- - libelf/elf32_updatenull.c | 5 +- - ---- a/libelf/elf32_updatenull.c -+++ b/libelf/elf32_updatenull.c -@@ -366,12 +366,15 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) - } - - /* See whether the section size is correct. */ -+ int size_changed = 0; - update_if_changed (shdr->sh_size, (GElf_Word) offset, -- changed); -+ size_changed); -+ changed |= size_changed; - - if (shdr->sh_type != SHT_NOBITS) - size += offset; - -+ scn->shdr_flags |= (offset_changed | size_changed); - scn->flags |= changed; - } - diff --git a/dev-libs/elfutils/files/elfutils-0.176-dwarf_fregs.patch b/dev-libs/elfutils/files/elfutils-0.176-dwarf_fregs.patch deleted file mode 100644 index 3a4204c..0000000 --- a/dev-libs/elfutils/files/elfutils-0.176-dwarf_fregs.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/backends/aarch64_initreg.c b/backends/aarch64_initreg.c -index daf6f37..6445276 100644 ---- a/backends/aarch64_initreg.c -+++ b/backends/aarch64_initreg.c -@@ -33,7 +33,7 @@ - #include "system.h" - #include <assert.h> - #if defined(__aarch64__) && defined(__linux__) --# include <linux/uio.h> -+# include <sys/uio.h> - # include <sys/user.h> - # include <sys/ptrace.h> - /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ -@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), - - Dwarf_Word dwarf_fregs[32]; - for (int r = 0; r < 32; r++) -- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF; -+ dwarf_fregs[r] = (unsigned int)fregs.vregs[r] & 0xFFFFFFFF; - - if (! setfunc (64, 32, dwarf_fregs, arg)) - return false; -diff --git a/backends/arm_initreg.c b/backends/arm_initreg.c -index efcabaf..062bb9e 100644 ---- a/backends/arm_initreg.c -+++ b/backends/arm_initreg.c -@@ -38,7 +38,7 @@ - #endif - - #ifdef __aarch64__ --# include <linux/uio.h> -+# include <sys/uio.h> - # include <sys/user.h> - # include <sys/ptrace.h> - /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ - \ No newline at end of file diff --git a/dev-libs/elfutils/files/elfutils-0.176-portability-fixes.patch b/dev-libs/elfutils/files/elfutils-0.176-portability-fixes.patch deleted file mode 100644 index 9aecf57..0000000 --- a/dev-libs/elfutils/files/elfutils-0.176-portability-fixes.patch +++ /dev/null @@ -1,415 +0,0 @@ -From de94a67137e483db97efd40e7d13f0148e43e95c Mon Sep 17 00:00:00 2001 -From: -Date: Thu, 11 Apr 2019 22:58:38 -0500 -Subject: [PATCH] portability fixes - -Voidlinux fixes combined and modified for use in gentoo. ---- - configure.ac | 56 ++++++++++++++++++++++++++++++++++++++++++++ - lib/error.h | 27 +++++++++++++++++++++ - lib/fixedsizehash.h | 1 - - libdw/Makefile.am | 2 +- - libdwfl/dwfl_error.c | 9 +++++++ - libelf/elf.h | 11 +++++++++ - src/Makefile.am | 28 +++++++++++----------- - src/arlib.h | 10 ++++++++ - src/elfcompress.c | 8 +++++++ - src/error.h | 27 +++++++++++++++++++++ - src/readelf.c | 21 ++++++++++------- - src/strip.c | 8 +++++++ - src/unstrip.c | 9 +++++++ - 13 files changed, 192 insertions(+), 25 deletions(-) - create mode 100644 lib/error.h - create mode 100644 src/error.h - -diff --git a/configure.ac b/configure.ac -index b4e012d..27e6152 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -494,6 +494,62 @@ else - 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. -diff --git a/lib/error.h b/lib/error.h -new file mode 100644 -index 0000000..ef06827 ---- /dev/null -+++ b/lib/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_ */ -diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h -index dac2a5f..43016fc 100644 ---- a/lib/fixedsizehash.h -+++ b/lib/fixedsizehash.h -@@ -30,7 +30,6 @@ - #include <errno.h> - #include <stdlib.h> - #include <string.h> --#include <sys/cdefs.h> - - #include <system.h> - -diff --git a/libdw/Makefile.am b/libdw/Makefile.am -index 7a3d532..646fbd0 100644 ---- a/libdw/Makefile.am -+++ b/libdw/Makefile.am -@@ -108,7 +108,7 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) - libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \ - ../libdwfl/libdwfl_pic.a ../libebl/libebl.a - libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so --libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS) - libdw_so_SOURCES = - libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) - # The rpath is necessary for libebl because its $ORIGIN use will -diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c -index 7bcf61c..ff25ebb 100644 ---- a/libdwfl/dwfl_error.c -+++ b/libdwfl/dwfl_error.c -@@ -154,7 +154,16 @@ dwfl_errmsg (int error) - 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 --git a/libelf/elf.h b/libelf/elf.h -index 75043bc..da1598a 100644 ---- a/libelf/elf.h -+++ b/libelf/elf.h -@@ -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 --git a/src/Makefile.am b/src/Makefile.am -index 2b1c0dc..ad05977 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -67,22 +67,22 @@ ranlib_no_Wstack_usage = yes - 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) $(libeu) $(argp_LDADD) --addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib) --elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(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) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -+addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(demanglelib) -+elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(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/src/arlib.h b/src/arlib.h -index e117166..c66a5c9 100644 ---- a/src/arlib.h -+++ b/src/arlib.h -@@ -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; -diff --git a/src/elfcompress.c b/src/elfcompress.c -index 6ba6af4..f7d032b 100644 ---- a/src/elfcompress.c -+++ b/src/elfcompress.c -@@ -37,6 +37,14 @@ - #include "libeu.h" - #include "printversion.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. */ - ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; - -diff --git a/src/error.h b/src/error.h -new file mode 100644 -index 0000000..ef06827 ---- /dev/null -+++ b/src/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_ */ -diff --git a/src/readelf.c b/src/readelf.c -index 33706bd..da6624b 100644 ---- a/src/readelf.c -+++ b/src/readelf.c -@@ -4792,10 +4792,11 @@ listptr_base (struct listptr *p) - return cudie_base (&cu); - } - -+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; - -@@ -4811,21 +4812,21 @@ compare_listptr (const void *a, const void *b, void *arg) - 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); - } - if (p1->attr != p2 ->attr) - { -@@ -4833,7 +4834,7 @@ compare_listptr (const void *a, const void *b, void *arg) - error (0, 0, - gettext ("%s %#" PRIx64 - " used with different attribute %s and %s"), -- name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), -+ listptr_name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), - dwarf_attr_name (p2->attr)); - } - } -@@ -4904,9 +4905,11 @@ notice_listptr (enum section_e section, struct listptr_table *table, - 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 --git a/src/strip.c b/src/strip.c -index a73009d..c6ed590 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -46,6 +46,14 @@ - #include <system.h> - #include <printversion.h> - -+#if !defined(FNM_EXTMATCH) -+# define FNM_EXTMATCH 0 -+#endif -+ -+#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/src/unstrip.c b/src/unstrip.c -index 3495b1d..0754717 100644 ---- a/src/unstrip.c -+++ b/src/unstrip.c -@@ -56,6 +56,15 @@ - # define _(str) gettext (str) - #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 -+ - /* Name and version of program. */ - ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; - --- -2.21.0 - diff --git a/dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch b/dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch deleted file mode 100644 index e903c62..0000000 --- a/dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch +++ /dev/null @@ -1,416 +0,0 @@ -From 5da3662ec16c0df64bbf8ffcf7e1d09c0782714c Mon Sep 17 00:00:00 2001 -From: Jory Pratt <[email protected]> -Date: Wed, 21 Aug 2019 17:02:59 -0500 -Subject: [PATCH] Portability fixes for musl - ---- - configure.ac | 56 ++++++++++++++++++++++++++++++++++++++++++++ - lib/error.h | 27 +++++++++++++++++++++ - lib/fixedsizehash.h | 1 - - libdw/Makefile.am | 2 +- - libdwfl/dwfl_error.c | 9 +++++++ - libelf/elf.h | 11 +++++++++ - src/Makefile.am | 30 ++++++++++++------------ - src/arlib.h | 10 ++++++++ - src/elfcompress.c | 8 +++++++ - src/error.h | 27 +++++++++++++++++++++ - src/readelf.c | 21 ++++++++++------- - src/strip.c | 8 +++++++ - src/unstrip.c | 9 +++++++ - 13 files changed, 193 insertions(+), 26 deletions(-) - create mode 100644 lib/error.h - create mode 100644 src/error.h - -diff --git a/configure.ac b/configure.ac -index c443fa3..1e54c54 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -494,6 +494,62 @@ else - 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. -diff --git a/lib/error.h b/lib/error.h -new file mode 100644 -index 0000000..ef06827 ---- /dev/null -+++ b/lib/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_ */ -diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h -index dac2a5f..43016fc 100644 ---- a/lib/fixedsizehash.h -+++ b/lib/fixedsizehash.h -@@ -30,7 +30,6 @@ - #include <errno.h> - #include <stdlib.h> - #include <string.h> --#include <sys/cdefs.h> - - #include <system.h> - -diff --git a/libdw/Makefile.am b/libdw/Makefile.am -index 7a3d532..646fbd0 100644 ---- a/libdw/Makefile.am -+++ b/libdw/Makefile.am -@@ -108,7 +108,7 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) - libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \ - ../libdwfl/libdwfl_pic.a ../libebl/libebl.a - libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so --libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS) - libdw_so_SOURCES = - libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) - # The rpath is necessary for libebl because its $ORIGIN use will -diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c -index 7bcf61c..ff25ebb 100644 ---- a/libdwfl/dwfl_error.c -+++ b/libdwfl/dwfl_error.c -@@ -154,7 +154,16 @@ dwfl_errmsg (int error) - 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 --git a/libelf/elf.h b/libelf/elf.h -index 01648bd..9ab66f1 100644 ---- a/libelf/elf.h -+++ b/libelf/elf.h -@@ -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 --git a/src/Makefile.am b/src/Makefile.am -index 69ac4db..9ab822e 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -68,23 +68,23 @@ ranlib_no_Wstack_usage = yes - 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) $(libeu) $(argp_LDADD) --addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib) --elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(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) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -+addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(demanglelib) -+elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(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) --elfclassify_LDADD = $(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) -+elfclassify_LDADD = $(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/src/arlib.h b/src/arlib.h -index e117166..c66a5c9 100644 ---- a/src/arlib.h -+++ b/src/arlib.h -@@ -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; -diff --git a/src/elfcompress.c b/src/elfcompress.c -index 6ba6af4..f7d032b 100644 ---- a/src/elfcompress.c -+++ b/src/elfcompress.c -@@ -37,6 +37,14 @@ - #include "libeu.h" - #include "printversion.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. */ - ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; - -diff --git a/src/error.h b/src/error.h -new file mode 100644 -index 0000000..ef06827 ---- /dev/null -+++ b/src/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_ */ -diff --git a/src/readelf.c b/src/readelf.c -index 2084fb1..af72bce 100644 ---- a/src/readelf.c -+++ b/src/readelf.c -@@ -4813,10 +4813,11 @@ listptr_base (struct listptr *p) - return cudie_base (&cu); - } - -+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; - -@@ -4832,21 +4833,21 @@ compare_listptr (const void *a, const void *b, void *arg) - 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); - } - if (p1->attr != p2 ->attr) - { -@@ -4854,7 +4855,7 @@ compare_listptr (const void *a, const void *b, void *arg) - error (0, 0, - gettext ("%s %#" PRIx64 - " used with different attribute %s and %s"), -- name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), -+ listptr_name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), - dwarf_attr_name (p2->attr)); - } - } -@@ -4925,9 +4926,11 @@ notice_listptr (enum section_e section, struct listptr_table *table, - 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 --git a/src/strip.c b/src/strip.c -index 48792a7..d2f0c60 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -46,6 +46,14 @@ - #include <system.h> - #include <printversion.h> - -+#if !defined(FNM_EXTMATCH) -+# define FNM_EXTMATCH 0 -+#endif -+ -+#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/src/unstrip.c b/src/unstrip.c -index fc87832..aab7caf 100644 ---- a/src/unstrip.c -+++ b/src/unstrip.c -@@ -56,6 +56,15 @@ - # define _(str) gettext (str) - #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 -+ - /* Name and version of program. */ - ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; - --- -2.23.0 - diff --git a/dev-libs/elfutils/files/elfutils-0.179-CC-in-tests.patch b/dev-libs/elfutils/files/elfutils-0.179-CC-in-tests.patch new file mode 100644 index 0000000..aa58862 --- /dev/null +++ b/dev-libs/elfutils/files/elfutils-0.179-CC-in-tests.patch @@ -0,0 +1,45 @@ +https://bugs.gentoo.org/718872 +--- a/tests/run-disasm-x86-64.sh ++++ b/tests/run-disasm-x86-64.sh +@@ -22,7 +22,7 @@ case "`uname -m`" in + x86_64) + tempfiles testfile45.o + testfiles testfile45.S testfile45.expect +- gcc -m64 -c -o testfile45.o testfile45.S ++ ${CC-gcc} -m64 -c -o testfile45.o testfile45.S + testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < testfile45.expect + ;; + esac +--- a/tests/run-disasm-x86.sh ++++ b/tests/run-disasm-x86.sh +@@ -22,7 +22,7 @@ case "`uname -m`" in + x86_64 | i?86 ) + tempfiles testfile44.o + testfiles testfile44.S testfile44.expect +- gcc -m32 -c -o testfile44.o testfile44.S ++ ${CC-gcc} -m32 -c -o testfile44.o testfile44.S + testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < testfile44.expect + ;; + esac +--- a/tests/run-strip-g.sh ++++ b/tests/run-strip-g.sh +@@ -25,7 +25,7 @@ + tempfiles a.out strip.out debug.out readelf.out + + echo Create debug a.out. +-echo "int main() { return 1; }" | gcc -g -xc - ++echo "int main() { return 1; }" | ${CC-gcc} -g -xc - + + echo strip -g to file with debug file + testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out || +--- a/tests/run-strip-nothing.sh ++++ b/tests/run-strip-nothing.sh +@@ -23,7 +23,7 @@ + tempfiles a.out strip.out debug.out + + # Create no-debug a.out. +-echo "int main() { return 1; }" | gcc -s -xc - ++echo "int main() { return 1; }" | ${CC-gcc} -s -xc - + + # strip to file + testrun ${abs_top_builddir}/src/strip -g -o strip.out || diff --git a/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch b/dev-libs/elfutils/files/elfutils-0.180-PaX-support.patch similarity index 71% rename from dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch rename to dev-libs/elfutils/files/elfutils-0.180-PaX-support.patch index 0ae359f..2d44c75 100644 --- a/dev-libs/elfutils/files/elfutils-0.118-PaX-support.patch +++ b/dev-libs/elfutils/files/elfutils-0.180-PaX-support.patch @@ -6,21 +6,21 @@ http://bugs.gentoo.org/115100 --- a/libelf/elf.h +++ b/libelf/elf.h -@@ -568,6 +568,7 @@ - #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ +@@ -722,6 +722,7 @@ typedef struct #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_GNU_PROPERTY 0x6474e553 /* GNU property */ ++#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 */ --- a/src/elflint.c +++ b/src/elflint.c -@@ -3187,6 +3187,7 @@ +@@ -4493,6 +4493,7 @@ only executables, shared objects, and core files can have program headers\n")); 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 + && phdr->p_type != PT_GNU_PROPERTY /* 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.180-readelf.patch b/dev-libs/elfutils/files/elfutils-0.180-readelf.patch new file mode 100644 index 0000000..a347d03 --- /dev/null +++ b/dev-libs/elfutils/files/elfutils-0.180-readelf.patch @@ -0,0 +1,23 @@ +Use tool-prefixed readelf. +--- a/configure.ac ++++ b/configure.ac +@@ -200,7 +200,7 @@ fi + # We really want build-ids. Warn and force generating them if gcc was + # configure without --enable-linker-build-id + AC_CACHE_CHECK([whether the compiler generates build-ids], ac_cv_buildid, [dnl +-AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; readelf -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))]) ++AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; $READELF -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))]) + if test "$ac_cv_buildid" = "no"; then + AC_MSG_WARN([compiler doesn't generate build-id by default]) + LDFLAGS="$LDFLAGS -Wl,--build-id" +--- a/configure ++++ b/configure +@@ -5343,7 +5343,7 @@ main () + } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_buildid=yes; readelf -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no ++ ac_cv_buildid=yes; $READELF -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
