summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-libs/elfutils/elfutils-0.189-r3.ebuild124
-rw-r--r--dev-libs/elfutils/files/elfutils-0.189-PaX-support.patch26
-rw-r--r--dev-libs/elfutils/files/elfutils-0.189-musl-aarch64-regs.patch57
-rw-r--r--dev-libs/elfutils/files/elfutils-0.189-musl-macros.patch86
-rw-r--r--dev-libs/elfutils/files/elfutils-0.189-skip-DT_RELR-failing-tests.patch39
-rw-r--r--dev-libs/elfutils/files/elfutils-0.189-tests-run-lfs-symbols.sh-needs-gawk.patch41
6 files changed, 373 insertions, 0 deletions
diff --git a/dev-libs/elfutils/elfutils-0.189-r3.ebuild b/dev-libs/elfutils/elfutils-0.189-r3.ebuild
new file mode 100644
index 000000000000..51765e378976
--- /dev/null
+++ b/dev-libs/elfutils/elfutils-0.189-r3.ebuild
@@ -0,0 +1,124 @@
+# Copyright 2003-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/elfutils.gpg
+inherit autotools flag-o-matic multilib-minimal verify-sig
+
+DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)"
+HOMEPAGE="https://sourceware.org/elfutils/"
+SRC_URI="https://sourceware.org/elfutils/ftp/${PV}/${P}.tar.bz2"
+SRC_URI+=" verify-sig? ( https://sourceware.org/elfutils/ftp/${PV}/${P}.tar.bz2.sig )"
+
+LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 debuginfod lzma nls static-libs test +utils zstd"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ !dev-libs/libelf
+ >=sys-libs/zlib-1.2.8-r1[static-libs?,${MULTILIB_USEDEP}]
+ bzip2? ( >=app-arch/bzip2-1.0.6-r4[static-libs?,${MULTILIB_USEDEP}] )
+ debuginfod? (
+ app-arch/libarchive:=
+ dev-db/sqlite:3=
+ net-libs/libmicrohttpd:=
+
+ net-misc/curl[static-libs?,${MULTILIB_USEDEP}]
+ )
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1[static-libs?,${MULTILIB_USEDEP}] )
+ zstd? ( app-arch/zstd:=[static-libs?,${MULTILIB_USEDEP}] )
+ elibc_musl? (
+ dev-libs/libbsd
+ sys-libs/argp-standalone
+ sys-libs/fts-standalone
+ sys-libs/obstack-standalone
+ )
+"
+DEPEND="
+ ${RDEPEND}
+"
+BDEPEND="
+ >=sys-devel/flex-2.5.4a
+ sys-devel/m4
+ nls? ( sys-devel/gettext )
+ verify-sig? ( sec-keys/openpgp-keys-elfutils )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.189-PaX-support.patch
+ "${FILESDIR}"/${PN}-0.189-skip-DT_RELR-failing-tests.patch
+ "${FILESDIR}"/${PN}-0.189-tests-run-lfs-symbols.sh-needs-gawk.patch
+ "${FILESDIR}"/${PN}-0.189-musl-aarch64-regs.patch
+ "${FILESDIR}"/${PN}-0.189-musl-macros.patch
+ "${FILESDIR}"/${P}-configure-bashisms.patch
+ "${FILESDIR}"/${P}-clang16-tests.patch
+)
+
+src_prepare() {
+ default
+
+ # Only here for ${P}-configure-bashisms.patch, delete on next bump!
+ 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() {
+ # bug #407135
+ use test && append-flags -g
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ $(use_enable nls)
+ $(multilib_native_use_enable debuginfod)
+ $(use_enable debuginfod libdebuginfod)
+
+ # explicitly disable thread safety, it's not recommended by upstream
+ # doesn't build either on musl.
+ --disable-thread-safety
+
+ # Valgrind option is just for running tests under it; dodgy under sandbox
+ # and indeed even w/ glibc with newer instructions.
+ --disable-valgrind
+ --program-prefix="eu-"
+ --with-zlib
+ $(use_with bzip2 bzlib)
+ $(use_with lzma)
+ $(use_with zstd)
+ )
+
+ # Needed because sets alignment macro
+ is-flagq -fsanitize=address && myeconfargs+=( --enable-sanitize-address )
+ is-flagq -fsanitize=undefined && myeconfargs+=( --enable-sanitize-undefined )
+
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+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/files/elfutils-0.189-PaX-support.patch b/dev-libs/elfutils/files/elfutils-0.189-PaX-support.patch
new file mode 100644
index 000000000000..2d44c757711a
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.189-PaX-support.patch
@@ -0,0 +1,26 @@
+Add support for PaX ELF markings
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+
+http://bugs.gentoo.org/115100
+
+--- a/libelf/elf.h
++++ b/libelf/elf.h
+@@ -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_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
+@@ -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)
diff --git a/dev-libs/elfutils/files/elfutils-0.189-musl-aarch64-regs.patch b/dev-libs/elfutils/files/elfutils-0.189-musl-aarch64-regs.patch
new file mode 100644
index 000000000000..222c0527b689
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.189-musl-aarch64-regs.patch
@@ -0,0 +1,57 @@
+https://www.sourceware.org/bugzilla/show_bug.cgi?id=25832
+https://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/elfutils/files/0006-Fix-build-on-aarch64-musl.patch
+https://bugs.gentoo.org/693772
+
+Other variants/links:
+https://git.alpinelinux.org/aports/tree/main/elfutils/fix-aarch64_fregs.patch
+https://github.com/gentoo/musl/blob/6450482b9b4463b57ac249c63b7ed796e9874c40/dev-libs/elfutils/files/0.178/fix-aarch64_fregs.patch
+
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Tue, 15 Aug 2017 17:27:30 +0800
+Subject: [PATCH] Fix build on aarch64/musl
+
+Errors
+
+invalid operands to binary & (have 'long double' and 'unsigned int')
+
+error: redefinition
+ of 'struct iovec'
+ struct iovec { void *iov_base; size_t iov_len; };
+ ^
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Rebase to 0.170
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+
+--- 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;
+--- 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. */
diff --git a/dev-libs/elfutils/files/elfutils-0.189-musl-macros.patch b/dev-libs/elfutils/files/elfutils-0.189-musl-macros.patch
new file mode 100644
index 000000000000..97c6c1dcd62e
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.189-musl-macros.patch
@@ -0,0 +1,86 @@
+May not be required (or at least some hunks) with next release (0.186?)
+
+https://git.alpinelinux.org/aports/plain/main/elfutils/musl-macros.patch
+--- a/lib/libeu.h
++++ b/lib/libeu.h
+@@ -31,6 +31,27 @@
+
+ #include <stddef.h>
+ #include <stdint.h>
++#include <unistd.h>
++#include <alloca.h>
++#include <string.h>
++
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
++#ifndef strndupa
++#define strndupa(s, n) \
++ (__extension__ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif
+
+ extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+ extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
+--- 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;
+--- 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;
+
+--- a/src/strip.c
++++ b/src/strip.c
+@@ -45,6 +45,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/dev-libs/elfutils/files/elfutils-0.189-skip-DT_RELR-failing-tests.patch b/dev-libs/elfutils/files/elfutils-0.189-skip-DT_RELR-failing-tests.patch
new file mode 100644
index 000000000000..0ffe75d93d31
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.189-skip-DT_RELR-failing-tests.patch
@@ -0,0 +1,39 @@
+We know these tests fail with DT_RELR (https://sourceware.org/bugzilla/show_bug.cgi?id=28495)
+so skip for now.
+--- a/tests/run-elflint-self.sh
++++ b/tests/run-elflint-self.sh
+@@ -18,5 +18,8 @@
+
+ . $srcdir/test-subr.sh
+
++# XFAIL b/c no DT_RELR support yet (https://sourceware.org/bugzilla/show_bug.cgi?id=28495)
++exit 77
++
+ testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld
+ testrun_on_self_compressed ${abs_top_builddir}/src/elflint --quiet --gnu-ld
+--- a/tests/run-strip-strmerge.sh
++++ b/tests/run-strip-strmerge.sh
+@@ -17,6 +17,9 @@
+
+ . $srcdir/test-subr.sh
+
++# XFAIL b/c no DT_RELR support yet (https://sourceware.org/bugzilla/show_bug.cgi?id=28495)
++exit 77
++
+ # Generate a file with merged .shstrtab/.strtab table.
+ # strip and unstrip it. Check all files with elflint.
+
+diff --git a/tests/run-reverse-sections-self.sh b/tests/run-reverse-sections-self.sh
+index 71afd6a..87de933 100755
+--- a/tests/run-reverse-sections-self.sh
++++ b/tests/run-reverse-sections-self.sh
+@@ -17,6 +17,9 @@
+
+ . $srcdir/test-subr.sh
+
++# XFAIL b/c no DT_RELR support yet (https://sourceware.org/bugzilla/show_bug.cgi?id=28495)
++exit 77
++
+ test_reverse_self ()
+ {
+ in_file="$1"
diff --git a/dev-libs/elfutils/files/elfutils-0.189-tests-run-lfs-symbols.sh-needs-gawk.patch b/dev-libs/elfutils/files/elfutils-0.189-tests-run-lfs-symbols.sh-needs-gawk.patch
new file mode 100644
index 000000000000..c64a30ec03b6
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.189-tests-run-lfs-symbols.sh-needs-gawk.patch
@@ -0,0 +1,41 @@
+https://inbox.sourceware.org/elfutils-devel/20230719231639.1786109-1-sam@gentoo.org/T/#u
+
+From 7f607f9aba5c6fccb3d94776452b1cfa421df1f7 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Thu, 20 Jul 2023 00:15:10 +0100
+Subject: [PATCH] tests: run-lfs-symbols.sh needs gawk
+
+With awk=mawk, I get:
+```
+FAIL: run-lfs-symbols.sh
+
+First sanity-check that LFS detection works.
+checking ./testfile-nolfs
+awk: line 3: syntax error at or near /
+FAIL run-lfs-symbols.sh (exit status: 2)
+```
+
+ * tests/run-lfs-symbols.sh: Call 'gawk' instead of 'awk'.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/tests/run-lfs-symbols.sh
++++ b/tests/run-lfs-symbols.sh
+@@ -42,13 +42,13 @@ LFS_FORMAT='BEGIN {
+ LFS=$(printf "$LFS_FORMAT" "${abs_srcdir}/lfs-symbols")
+
+ makeprint() {
+- make print-$1 -C $2 |& awk -F= "/^$1=/{ print \$2 }"
++ make print-$1 -C $2 |& gawk -F= "/^$1=/{ print \$2 }"
+ }
+
+ testrun_lfs() {
+ echo "checking $1"
+ if [ -e "$1" ]; then
+- bad=$(testrun ${abs_top_builddir}/src/nm -u "$1" | awk "$LFS")
++ bad=$(testrun ${abs_top_builddir}/src/nm -u "$1" | gawk "$LFS")
+ if [ -n "$bad" ]; then
+ echo "$1 contains non-lfs symbols:" $bad
+ exit_status=1
+--
+2.41.0
+