From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E4A7A138334 for ; Wed, 21 Aug 2019 22:42:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CB34FE0943; Wed, 21 Aug 2019 22:42:23 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A73A5E0943 for ; Wed, 21 Aug 2019 22:42:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 10B73349C3E for ; Wed, 21 Aug 2019 22:42:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9125173C for ; Wed, 21 Aug 2019 22:42:19 +0000 (UTC) From: "Jory Pratt" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jory Pratt" Message-ID: <1566427323.4b5e40fed4ed28c0abb3fc7d1c6cdeb98298b76c.anarchy@gentoo> Subject: [gentoo-commits] proj/musl:master commit in: dev-libs/elfutils/files/, dev-libs/elfutils/ X-VCS-Repository: proj/musl X-VCS-Files: dev-libs/elfutils/Manifest dev-libs/elfutils/elfutils-0.170-r1.ebuild dev-libs/elfutils/elfutils-0.172.ebuild dev-libs/elfutils/elfutils-0.173.ebuild dev-libs/elfutils/elfutils-0.176-r1.ebuild dev-libs/elfutils/elfutils-0.176.ebuild dev-libs/elfutils/elfutils-0.177.ebuild dev-libs/elfutils/files/elfutils-0.169-musl-libs.patch dev-libs/elfutils/files/elfutils-0.170-musl-obstack-fts.patch dev-libs/elfutils/files/elfutils-0.170-musl-utils.patch dev-libs/elfutils/files/elfutils-0.171-musl-libs.patch dev-libs/elfutils/files/elfutils-0.171-musl-utils.patch dev-libs/elfutils/files/elfutils-0.173-reorder.patch dev-libs/elfutils/files/elfutils-0.177-disable-large.patch dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch X-VCS-Directories: dev-libs/elfutils/files/ dev-libs/elfutils/ X-VCS-Committer: anarchy X-VCS-Committer-Name: Jory Pratt X-VCS-Revision: 4b5e40fed4ed28c0abb3fc7d1c6cdeb98298b76c X-VCS-Branch: master Date: Wed, 21 Aug 2019 22:42:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 63a538dc-c652-4def-9b02-3a2c55a1b294 X-Archives-Hash: 36651ed7786d030debdeb194dada05ff commit: 4b5e40fed4ed28c0abb3fc7d1c6cdeb98298b76c Author: Jory Pratt gentoo org> AuthorDate: Wed Aug 21 22:42:03 2019 +0000 Commit: Jory Pratt gentoo org> CommitDate: Wed Aug 21 22:42:03 2019 +0000 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=4b5e40fe dev-libs/elfutils: 0.177 update, 0.176 sync with changes from tree Package-Manager: Portage-2.3.72, Repoman-2.3.17 RepoMan-Options: --force Signed-off-by: Jory Pratt gentoo.org> dev-libs/elfutils/Manifest | 4 +- dev-libs/elfutils/elfutils-0.170-r1.ebuild | 78 ---- dev-libs/elfutils/elfutils-0.172.ebuild | 78 ---- ...utils-0.176.ebuild => elfutils-0.176-r1.ebuild} | 4 +- ...elfutils-0.173.ebuild => elfutils-0.177.ebuild} | 22 +- .../elfutils/files/elfutils-0.169-musl-libs.patch | 110 ------ .../files/elfutils-0.170-musl-obstack-fts.patch | 102 ----- .../elfutils/files/elfutils-0.170-musl-utils.patch | 125 ------- .../elfutils/files/elfutils-0.171-musl-libs.patch | 86 ----- .../elfutils/files/elfutils-0.171-musl-utils.patch | 134 ------- .../elfutils/files/elfutils-0.173-reorder.patch | 37 ++ .../files/elfutils-0.177-disable-large.patch | 14 + .../files/elfutils-0.177-portability-fixes.patch | 416 +++++++++++++++++++++ 13 files changed, 481 insertions(+), 729 deletions(-) diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest index 37dfc30..1e9d789 100644 --- a/dev-libs/elfutils/Manifest +++ b/dev-libs/elfutils/Manifest @@ -1,4 +1,2 @@ -DIST elfutils-0.170.tar.bz2 8358001 BLAKE2B 03ea3ba7d3feaac43065312c475f4a3cd9083a6c56c9982fa00c0ed02b28440f6a37bbeca4be18db13749647ea1c8a6f00dae7efcb1c70235110e60ad7d56d06 SHA512 aca0b5e271138eaf86e36505ffb101181207b151e833e6cd7c18986ac50678542a5ecd2250f8dd6923ca497142f197c8b08fd225e4130b16b6203c24013d6d28 -DIST elfutils-0.172.tar.bz2 8601066 BLAKE2B 7d4cb9944bfc258ba46312e8a4dde491f9d8fb4fa27837f6df0993107256f76e79ce02ea5872475a70ff9ebe9093e39bddf1c807be2af4bf0f6f5429f446a1ce SHA512 b2f491e976ef3067fe33ad22b3ef1952c47557571747899e94aee601bfeb95e8e1a91daad80a7950bee7feb42192769663db32eb65734ea5ffbc0b87cdad76b2 -DIST elfutils-0.173.tar.bz2 8684782 BLAKE2B c5905bb864059bdfb2699a0681a0ec576b6b8da444b0641e8184f58735084588910930bcca14583db6be75b24a0e374413911ded5ba2ca893798404fbe7374eb SHA512 7f38e4ce2098b685f15030bf01f0a66a74aa32fbfcead0304c1d0e0a929b348a72f99e685cd4605465f4337393382112f64b8847e6c2f7cc1a57a4fd03d03eb3 DIST elfutils-0.176.tar.bz2 8646075 BLAKE2B 7f23d59b7f5d74946fea928a7fada7764c1f96a5eefefc4a3a382090eb7cad07c80419218300d853ccbef8f4e2288eb443ff06b3e64bf4511d9fa7aa84f5b794 SHA512 7f032913be363a43229ded85d495dcf7542b3c85974aaaba0d984228dc9ac1721da3dc388d3fa02325a80940161db7e9ad2c9e4521a424ad8a7d050c0902915b +DIST elfutils-0.177.tar.bz2 8852413 BLAKE2B 03f432342651f7646d73b7847325bd14b722ce34d85df01b1ad072b916af9b9da2d0d119cd24e952073bd584ec76b027ba9b6c7d45fb057372b3e700b1f5741a SHA512 2779987463a22ed220759e25a09c9a1eb84c0f36db37675136e59aa55c7f8f90b7a7d34ffc4e6a4291d7fa73692a1bd1a303a74270b11d1623b4f9868d19498f diff --git a/dev-libs/elfutils/elfutils-0.170-r1.ebuild b/dev-libs/elfutils/elfutils-0.170-r1.ebuild deleted file mode 100644 index 732ee27..0000000 --- a/dev-libs/elfutils/elfutils-0.170-r1.ebuild +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -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="amd64 arm arm64 ia64 ~mips ppc sh sparc x86" -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 - )" - -PATCHES=("${FILESDIR}"/${PN}-0.118-PaX-support.patch) - -src_prepare() { - default - # Add MUSL patches - epatch "${FILESDIR}"/${P}-musl-obstack-fts.patch - epatch "${FILESDIR}"/${PN}-0.169-musl-libs.patch - epatch "${FILESDIR}"/${P}-musl-utils.patch - - eautoreconf - - if ! use static-libs; then - sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die - fi - 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 \ - --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. - if ! use utils; then - rm -rf "${ED}"/usr/bin || die - fi -} diff --git a/dev-libs/elfutils/elfutils-0.172.ebuild b/dev-libs/elfutils/elfutils-0.172.ebuild deleted file mode 100644 index 01620ca..0000000 --- a/dev-libs/elfutils/elfutils-0.172.ebuild +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -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="~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~sh ~sparc ~x86" -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 - )" - -PATCHES=("${FILESDIR}"/${PN}-0.118-PaX-support.patch) - -src_prepare() { - default - # Add MUSL patches - epatch "${FILESDIR}"/${PN}-0.170-musl-obstack-fts.patch - epatch "${FILESDIR}"/${PN}-0.171-musl-libs.patch - epatch "${FILESDIR}"/${PN}-0.171-musl-utils.patch - - eautoreconf - - if ! use static-libs; then - sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die - fi - 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 \ - --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. - if ! use utils; then - rm -rf "${ED}"/usr/bin || die - fi -} diff --git a/dev-libs/elfutils/elfutils-0.176.ebuild b/dev-libs/elfutils/elfutils-0.176-r1.ebuild similarity index 92% rename from dev-libs/elfutils/elfutils-0.176.ebuild rename to dev-libs/elfutils/elfutils-0.176-r1.ebuild index e80e341..7d8ad79 100644 --- a/dev-libs/elfutils/elfutils-0.176.ebuild +++ b/dev-libs/elfutils/elfutils-0.176-r1.ebuild @@ -11,7 +11,7 @@ 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 ~x86-linux" +KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86 ~amd64-linux ~x86-linux" IUSE="bzip2 lzma nls static-libs test +threads +utils" RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] @@ -21,7 +21,6 @@ RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] 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 @@ -31,6 +30,7 @@ DEPEND="${RDEPEND} 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 ) diff --git a/dev-libs/elfutils/elfutils-0.173.ebuild b/dev-libs/elfutils/elfutils-0.177.ebuild similarity index 77% rename from dev-libs/elfutils/elfutils-0.173.ebuild rename to dev-libs/elfutils/elfutils-0.177.ebuild index 97189fc..72a5084 100644 --- a/dev-libs/elfutils/elfutils-0.173.ebuild +++ b/dev-libs/elfutils/elfutils-0.177.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 +EAPI=7 -inherit autotools eutils flag-o-matic multilib-minimal +inherit autotools flag-o-matic multilib-minimal DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)" HOMEPAGE="http://elfutils.org/" @@ -11,7 +11,7 @@ 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 ~ia64 ~mips ~ppc ~sh ~sparc ~x86" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux" IUSE="bzip2 lzma nls static-libs test +threads +utils" RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] @@ -21,27 +21,28 @@ RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] 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 )" -PATCHES=("${FILESDIR}"/${PN}-0.118-PaX-support.patch) +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}"/${PN}-0.177-portability-fixes.patch +) src_prepare() { default - # Add MUSL patches - epatch "${FILESDIR}"/${PN}-0.170-musl-obstack-fts.patch - epatch "${FILESDIR}"/${PN}-0.171-musl-libs.patch - epatch "${FILESDIR}"/${PN}-0.171-musl-utils.patch 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 } @@ -56,7 +57,6 @@ multilib_src_configure() { $(use_enable threads thread-safety) \ --program-prefix="eu-" \ --with-zlib \ - --disable-symbol-versioning \ $(use_with bzip2 bzlib) \ $(use_with lzma) } diff --git a/dev-libs/elfutils/files/elfutils-0.169-musl-libs.patch b/dev-libs/elfutils/files/elfutils-0.169-musl-libs.patch deleted file mode 100644 index 0fcf72d..0000000 --- a/dev-libs/elfutils/files/elfutils-0.169-musl-libs.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff -Naur elfutils-0.169.orig/lib/error.h elfutils-0.169/lib/error.h ---- elfutils-0.169.orig/lib/error.h 1969-12-31 16:00:00.000000000 -0800 -+++ elfutils-0.169/lib/error.h 2017-05-22 11:46:56.303656762 -0700 -@@ -0,0 +1,27 @@ -+#ifndef _ERROR_H_ -+#define _ERROR_H_ -+ -+#include -+#include -+#include -+#include -+#include -+ -+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.169.orig/lib/fixedsizehash.h elfutils-0.169/lib/fixedsizehash.h ---- elfutils-0.169.orig/lib/fixedsizehash.h 2017-05-22 11:45:32.228023470 -0700 -+++ elfutils-0.169/lib/fixedsizehash.h 2017-05-22 11:47:08.380737748 -0700 -@@ -30,7 +30,6 @@ - #include - #include - #include --#include - - #include - -diff -Naur elfutils-0.169.orig/libdwfl/dwfl_build_id_find_elf.c elfutils-0.169/libdwfl/dwfl_build_id_find_elf.c ---- elfutils-0.169.orig/libdwfl/dwfl_build_id_find_elf.c 2017-05-22 11:45:32.397025345 -0700 -+++ elfutils-0.169/libdwfl/dwfl_build_id_find_elf.c 2017-05-22 11:48:25.398377146 -0700 -@@ -99,7 +99,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.169.orig/libdwfl/dwfl_error.c elfutils-0.169/libdwfl/dwfl_error.c ---- elfutils-0.169.orig/libdwfl/dwfl_error.c 2017-05-22 11:45:32.391025278 -0700 -+++ elfutils-0.169/libdwfl/dwfl_error.c 2017-05-22 11:48:49.678619010 -0700 -@@ -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.169.orig/libdwfl/find-debuginfo.c elfutils-0.169/libdwfl/find-debuginfo.c ---- elfutils-0.169.orig/libdwfl/find-debuginfo.c 2017-05-22 11:45:32.393025301 -0700 -+++ elfutils-0.169/libdwfl/find-debuginfo.c 2017-05-22 11:49:16.492886117 -0700 -@@ -389,7 +389,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.169.orig/libelf/elf.h elfutils-0.169/libelf/elf.h ---- elfutils-0.169.orig/libelf/elf.h 2017-05-22 11:45:32.267023903 -0700 -+++ elfutils-0.169/libelf/elf.h 2017-05-22 11:50:20.851532624 -0700 -@@ -21,7 +21,9 @@ - - #include - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /* Standard ELF types. */ - -@@ -3683,6 +3685,8 @@ - #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.170-musl-obstack-fts.patch b/dev-libs/elfutils/files/elfutils-0.170-musl-obstack-fts.patch deleted file mode 100644 index e2ba29a..0000000 --- a/dev-libs/elfutils/files/elfutils-0.170-musl-obstack-fts.patch +++ /dev/null @@ -1,102 +0,0 @@ -diff -Naur elfutils-0.170.orig/configure.ac elfutils-0.170/configure.ac ---- elfutils-0.170.orig/configure.ac 2017-08-08 12:51:02.675540308 -0700 -+++ elfutils-0.170/configure.ac 2017-08-08 13:00:47.322520736 -0700 -@@ -385,6 +385,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* 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_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.170.orig/libdw/Makefile.am elfutils-0.170/libdw/Makefile.am ---- elfutils-0.170.orig/libdw/Makefile.am 2017-08-08 12:51:02.725540814 -0700 -+++ elfutils-0.170/libdw/Makefile.am 2017-08-08 13:01:23.933848087 -0700 -@@ -105,7 +105,7 @@ - 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) $(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 -Naur elfutils-0.170.orig/src/Makefile.am elfutils-0.170/src/Makefile.am ---- elfutils-0.170.orig/src/Makefile.am 2017-08-08 12:51:02.768541249 -0700 -+++ elfutils-0.170/src/Makefile.am 2017-08-08 13:02:47.304579123 -0700 -@@ -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.170-musl-utils.patch b/dev-libs/elfutils/files/elfutils-0.170-musl-utils.patch deleted file mode 100644 index 5e00561..0000000 --- a/dev-libs/elfutils/files/elfutils-0.170-musl-utils.patch +++ /dev/null @@ -1,125 +0,0 @@ -diff -Naur elfutils-0.170.orig/src/arlib.h elfutils-0.170/src/arlib.h ---- elfutils-0.170.orig/src/arlib.h 2017-08-08 13:18:49.812978045 -0700 -+++ elfutils-0.170/src/arlib.h 2017-08-08 13:19:51.749654704 -0700 -@@ -29,6 +29,12 @@ - #include - #include - -+#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.170.orig/src/elfcompress.c elfutils-0.170/src/elfcompress.c ---- elfutils-0.170.orig/src/elfcompress.c 2017-08-08 13:18:49.810978023 -0700 -+++ elfutils-0.170/src/elfcompress.c 2017-08-08 13:19:51.752654737 -0700 -@@ -37,6 +37,13 @@ - #include "libeu.h" - #include "printversion.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.170.orig/src/readelf.c elfutils-0.170/src/readelf.c ---- elfutils-0.170.orig/src/readelf.c 2017-08-08 13:18:49.811978034 -0700 -+++ elfutils-0.170/src/readelf.c 2017-08-08 13:19:51.760654824 -0700 -@@ -4517,10 +4517,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; - -@@ -4536,21 +4537,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); - } - } - -@@ -4616,8 +4617,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.170.orig/src/strip.c elfutils-0.170/src/strip.c ---- elfutils-0.170.orig/src/strip.c 2017-08-08 13:18:49.812978045 -0700 -+++ elfutils-0.170/src/strip.c 2017-08-08 13:20:17.107931743 -0700 -@@ -47,6 +47,13 @@ - #include - #include - -+#if !defined(ACCESSPERMS) -+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ -+#endif -+#if !defined(FNM_EXTMATCH) -+# define FNM_EXTMATCH ( 1 << 5) -+#endif -+ - typedef uint8_t GElf_Byte; - - /* Name and version of program. */ -diff -Naur elfutils-0.170.orig/src/unstrip.c elfutils-0.170/src/unstrip.c ---- elfutils-0.170.orig/src/unstrip.c 2017-08-08 13:18:49.812978045 -0700 -+++ elfutils-0.170/src/unstrip.c 2017-08-08 13:19:51.765654879 -0700 -@@ -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/files/elfutils-0.171-musl-libs.patch b/dev-libs/elfutils/files/elfutils-0.171-musl-libs.patch deleted file mode 100644 index 80a5adb..0000000 --- a/dev-libs/elfutils/files/elfutils-0.171-musl-libs.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff -Naur elfutils-0.171.orig/lib/error.h elfutils-0.171/lib/error.h ---- elfutils-0.171.orig/lib/error.h 1969-12-31 16:00:00.000000000 -0800 -+++ elfutils-0.171/lib/error.h 2018-06-11 10:11:15.910181114 -0700 -@@ -0,0 +1,27 @@ -+#ifndef _ERROR_H_ -+#define _ERROR_H_ -+ -+#include -+#include -+#include -+#include -+#include -+ -+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.171.orig/lib/fixedsizehash.h elfutils-0.171/lib/fixedsizehash.h ---- elfutils-0.171.orig/lib/fixedsizehash.h 2018-06-11 10:11:02.222181359 -0700 -+++ elfutils-0.171/lib/fixedsizehash.h 2018-06-11 10:11:15.913181114 -0700 -@@ -30,7 +30,6 @@ - #include - #include - #include --#include - - #include - -diff -Naur elfutils-0.171.orig/libdwfl/dwfl_error.c elfutils-0.171/libdwfl/dwfl_error.c ---- elfutils-0.171.orig/libdwfl/dwfl_error.c 2018-06-11 10:11:02.245181359 -0700 -+++ elfutils-0.171/libdwfl/dwfl_error.c 2018-06-11 10:11:18.020181076 -0700 -@@ -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.171.orig/libelf/elf.h elfutils-0.171/libelf/elf.h ---- elfutils-0.171.orig/libelf/elf.h 2018-06-11 10:11:02.225181359 -0700 -+++ elfutils-0.171/libelf/elf.h 2018-06-11 10:11:19.036181058 -0700 -@@ -21,7 +21,9 @@ - - #include - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /* Standard ELF types. */ - -@@ -3912,6 +3914,8 @@ - #define R_METAG_TLS_LE_HI16 60 - #define R_METAG_TLS_LE_LO16 61 - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* elf.h */ diff --git a/dev-libs/elfutils/files/elfutils-0.171-musl-utils.patch b/dev-libs/elfutils/files/elfutils-0.171-musl-utils.patch deleted file mode 100644 index a6b9684..0000000 --- a/dev-libs/elfutils/files/elfutils-0.171-musl-utils.patch +++ /dev/null @@ -1,134 +0,0 @@ -diff -Naur elfutils-0.171.orig/src/arlib.h elfutils-0.171/src/arlib.h ---- elfutils-0.171.orig/src/arlib.h 2018-06-11 10:11:02.221181359 -0700 -+++ elfutils-0.171/src/arlib.h 2018-06-11 10:21:30.810170102 -0700 -@@ -29,6 +29,12 @@ - #include - #include - -+#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.171.orig/src/elfcompress.c elfutils-0.171/src/elfcompress.c ---- elfutils-0.171.orig/src/elfcompress.c 2018-06-11 10:11:02.221181359 -0700 -+++ elfutils-0.171/src/elfcompress.c 2018-06-11 10:21:30.813170102 -0700 -@@ -37,6 +37,13 @@ - #include "libeu.h" - #include "printversion.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.171.orig/src/readelf.c elfutils-0.171/src/readelf.c ---- elfutils-0.171.orig/src/readelf.c 2018-06-11 10:11:02.221181359 -0700 -+++ elfutils-0.171/src/readelf.c 2018-06-11 10:21:43.630169873 -0700 -@@ -4771,10 +4771,11 @@ - 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; - -@@ -4790,21 +4791,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); - } - if (p1->attr != p2 ->attr) - { -@@ -4812,7 +4813,7 @@ - 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)); - } - } -@@ -4884,8 +4885,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.171.orig/src/strip.c elfutils-0.171/src/strip.c ---- elfutils-0.171.orig/src/strip.c 2018-06-11 10:11:02.221181359 -0700 -+++ elfutils-0.171/src/strip.c 2018-06-11 10:21:30.818170102 -0700 -@@ -47,6 +47,13 @@ - #include - #include - -+#if !defined(ACCESSPERMS) -+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ -+#endif -+#if !defined(FNM_EXTMATCH) -+# define FNM_EXTMATCH ( 1 << 5) -+#endif -+ - typedef uint8_t GElf_Byte; - - /* Name and version of program. */ -diff -Naur elfutils-0.171.orig/src/unstrip.c elfutils-0.171/src/unstrip.c ---- elfutils-0.171.orig/src/unstrip.c 2018-06-11 10:11:02.221181359 -0700 -+++ elfutils-0.171/src/unstrip.c 2018-06-11 10:21:30.819170102 -0700 -@@ -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/files/elfutils-0.173-reorder.patch b/dev-libs/elfutils/files/elfutils-0.173-reorder.patch new file mode 100644 index 0000000..fd3dede --- /dev/null +++ b/dev-libs/elfutils/files/elfutils-0.173-reorder.patch @@ -0,0 +1,37 @@ +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 +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: <20190512221342.23383-1-mark@klomp.org> + +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 +--- + 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.177-disable-large.patch b/dev-libs/elfutils/files/elfutils-0.177-disable-large.patch new file mode 100644 index 0000000..7829585 --- /dev/null +++ b/dev-libs/elfutils/files/elfutils-0.177-disable-large.patch @@ -0,0 +1,14 @@ +getconf does not disable test on 64-kernel with CFLAGS=-m32 +--- a/tests/run-large-elf-file.sh ++++ b/tests/run-large-elf-file.sh +@@ -19,6 +19,10 @@ + + # Only run on 64bit systems, 32bit systems don't support > 4GB + # ELF files. ++ ++# this detection fails for 64-bit systems with -m32 ++exit 77 ++ + long_bit=$(getconf LONG_BIT) + echo "long_bit: $long_bit" + if test $long_bit -ne 64; then diff --git a/dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch b/dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch new file mode 100644 index 0000000..e903c62 --- /dev/null +++ b/dev-libs/elfutils/files/elfutils-0.177-portability-fixes.patch @@ -0,0 +1,416 @@ +From 5da3662ec16c0df64bbf8ffcf7e1d09c0782714c Mon Sep 17 00:00:00 2001 +From: Jory Pratt +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* 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_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 ++#include ++#include ++#include ++#include ++ ++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 + #include + #include +-#include + + #include + +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 + ++#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 + #include + ++#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 ++#include ++#include ++#include ++#include ++ ++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 + #include + ++#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 +