dev-libs/elfutils: Sync with Gentoo

It's from Gentoo commit 35185b7dc9ef1d5d23a3c82441745785952677a6.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2025-11-03 07:07:05 +00:00 committed by Krzesimir Nowak
parent 32efdf8847
commit f381f4abfc
12 changed files with 174 additions and 387 deletions

View File

@ -1,6 +1,4 @@
DIST elfutils-0.191.tar.bz2 9310088 BLAKE2B 2a7ad251369eca7ba609ab8644181fd479ad8596ee58dc068398ca22be25a978e96b81a10a92a5555d7574fd1b9227c8d54fb41dceb4025aedfc6ae32870bbca SHA512 e22d85f25317a79b36d370347e50284c9120c86f9830f08791b7b6a7b4ad89b9bf4c7c71129133b8d193a0edffb2a2c17987b7e48428b9670aff5ce918777e04
DIST elfutils-0.191.tar.bz2.sig 310 BLAKE2B 5afee19515a115d4ca6d1e0c4a49eca84bb4b911687492934e939a80ac75b7fcea9b6bf5fc0f2248a4c64ef09bd5af9dfc60c72410cba33b78444c38443ad279 SHA512 ab030739d95d13abb84cf4dc6c5407e51d0bd0bca108e27654a1830371694181a1b6f115fdbb4ae0772390f54f1c4811e5ae26b38fdcfd3275177a3716adfd22
DIST elfutils-0.192.tar.bz2 11913897 BLAKE2B cf9036a1fca416e0d47c76471093609230545aee63e31e30991dc3c88417d7c621c930bb74809374da3bf142501cee91a2b861a5a89efcb5e1ac184df5defce1 SHA512 543188f5f2cfe5bc7955a878416c5f252edff9926754e5de0c6c57b132f21d9285c9b29e41281e93baad11d4ae7efbbf93580c114579c182103565fe99bd3909
DIST elfutils-0.192.tar.bz2.sig 310 BLAKE2B b34bd17e161c827ce502338388f0f7604fca8478e8e2f05f1ad744b5288f7767466d005d7591ad74098eda53aa3bcde8a3b485983447a434e2cb2e5e64c38063 SHA512 9de0731dd3986a3dde03cfacdc3daa668f0e2cc482adfc31ab97320f85f7d13d3f056154aa16299db3f09e1c89020635012ffdd0e4cb68c1391b0e218721fb22
DIST elfutils-0.193.tar.bz2 11974916 BLAKE2B 3ddda695e92c76d0f98432b65d51737bdebf9cad536e0a583d10beb4693d98ce6e47716ff143d82dd3488e59489b03170bd292cb165d44bfb8581ff67dd2b1b9 SHA512 557e328e3de0d2a69d09c15a9333f705f3233584e2c6a7d3ce855d06a12dc129e69168d6be64082803630397bd64e1660a8b5324d4f162d17922e10ddb367d76
DIST elfutils-0.193.tar.bz2.sig 310 BLAKE2B 2c5626af37031e6dbf1f94ca2d5622f978a50c7cbf412c33924585dc7261e0c7fe3f55d91121a9a3ae9cc092c4e1879a34cf145fdc19607ad6db065bbed8b605 SHA512 75f3935c4a519dc0b23e59e2e6f2bae7926c988aec484f2e1f0759cf7662eca1752f02c16b2f129fee0d7451e961322cf9a315c4ce23e91520f4779ed9fda713
DIST elfutils-0.194.tar.bz2 12003321 BLAKE2B dd1fd1ba83330aa3313bd96614851a59411ea8e1004afda23791296de03960db5e193ee9ded4dd159d80c954efecc2cb5438cce986817d537c72d5ff887faf16 SHA512 5d00502f61b92643bf61dc61da4ddded36c423466388d992bcd388c5208761b8ed9db1a01492c085cd0984eef30c08f895a8e307e78e0df8df40b56ae35b78a5
DIST elfutils-0.194.tar.bz2.sig 310 BLAKE2B f43c370c339038a4894700984c501c7120a139763a7369f6fabc918c6c842dd50fff19d999a005939f9f049d0cf2c2a4f000e32fbc55afd8abdb67d82aefa90e SHA512 12d90f66dfa37544fb6b368099fac3eae9487188b0ce49409ae5c647c1fa3c68582efc5216a758d830e3775d5686ac2605dba600ad258f27ae99d5ce1094b624

View File

@ -1,142 +0,0 @@
# Copyright 2003-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/elfutils.gpg
inherit autotools flag-o-matic multilib-minimal
DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)"
HOMEPAGE="https://sourceware.org/elfutils/"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://sourceware.org/git/elfutils.git"
inherit git-r3
BDEPEND="
sys-devel/bison
sys-devel/flex
"
else
inherit verify-sig
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 )"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
BDEPEND="verify-sig? ( >=sec-keys/openpgp-keys-elfutils-20240301 )"
fi
LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
SLOT="0"
IUSE="bzip2 debuginfod lzma nls static-libs test +utils valgrind 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}
valgrind? ( dev-debug/valgrind )
"
BDEPEND+="
sys-devel/m4
virtual/pkgconfig
nls? ( sys-devel/gettext )
"
PATCHES=(
"${FILESDIR}"/${PN}-0.189-musl-aarch64-regs.patch
"${FILESDIR}"/${PN}-0.191-musl-macros.patch
"${FILESDIR}"/${PN}-0.191-avoid-overriding-libcxx-system-header.patch
"${FILESDIR}"/${PN}-0.191-musl-configure-better-error-h-check.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() {
# bug #407135
use test && append-flags -g
# bug 660738
filter-flags -fno-asynchronous-unwind-tables
multilib-minimal_src_configure
}
multilib_src_configure() {
unset LEX YACC
local myeconfargs=(
$(use_enable nls)
$(multilib_native_use_enable debuginfod)
$(use_enable debuginfod libdebuginfod)
$(use_enable valgrind valgrind-annotations)
# 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)
)
[[ ${PV} == 9999 ]] && myeconfargs+=( --enable-maintainer-mode )
# 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 we don't
# disable building them when the USE flag is disabled.
if ! use utils; then
rm -rf "${ED}"/usr/bin || die
fi
}

View File

@ -33,10 +33,10 @@ RESTRICT="!test? ( test )"
RDEPEND="
!dev-libs/libelf
>=app-arch/libarchive-3.1.2:=
>=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-3.1.2:=
dev-db/sqlite:3=
>=dev-libs/json-c-0.11:=[${MULTILIB_USEDEP}]
>=net-libs/libmicrohttpd-0.9.33:=

View File

@ -21,27 +21,28 @@ else
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 )"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
BDEPEND="verify-sig? ( >=sec-keys/openpgp-keys-elfutils-20240301 )"
fi
LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
SLOT="0"
IUSE="bzip2 debuginfod lzma nls static-libs stacktrace test +utils valgrind zstd"
IUSE="bzip2 debuginfod libarchive +lzma nls static-libs stacktrace test +utils valgrind zstd"
RESTRICT="!test? ( test )"
REQUIRED_USE="debuginfod? ( libarchive )"
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-3.1.2:=
dev-db/sqlite:3=
>=dev-libs/json-c-0.11:=[${MULTILIB_USEDEP}]
>=net-libs/libmicrohttpd-0.9.33:=
>=net-misc/curl-7.29.0[static-libs?,${MULTILIB_USEDEP}]
)
libarchive? ( >=app-arch/libarchive-3.1.2:= )
lzma? ( >=app-arch/xz-utils-5.0.5-r1[static-libs?,${MULTILIB_USEDEP}] )
stacktrace? ( dev-util/sysprof )
zstd? ( app-arch/zstd:=[static-libs?,${MULTILIB_USEDEP}] )
@ -65,10 +66,7 @@ BDEPEND+="
PATCHES=(
"${FILESDIR}"/${PN}-0.189-musl-aarch64-regs.patch
"${FILESDIR}"/${PN}-0.191-musl-macros.patch
"${FILESDIR}"/${P}-libelf-static-link-libeu.patch
"${FILESDIR}"/${P}-configure-better-error-message.patch
"${FILESDIR}"/${P}-stacktrace-maybe-uninit.patch
"${FILESDIR}"/${PN}-0.191-musl-configure-better-error-h-check.patch
"${FILESDIR}"/${P}-tests.patch
)
src_prepare() {
@ -80,6 +78,17 @@ src_prepare() {
sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die
fi
# TODO: Fails with some CFLAGS
# " __divhc3: /var/tmp/portage/dev-libs/elfutils-0.193/work/elfutils-0.193-abi_x86_32.x86/tests/funcretval:
# dwfl_module_return_value_location: cannot handle DWARF type description"
printf "#!/bin/sh\nexit 77" > tests/run-native-test.sh || die
# TODO: Fails for abi_x86_32 w/ DT_RELR
# "section [14] '.rel.plt': relocation 55: relocation type invalid for the file type"
printf "#!/bin/sh\nexit 77" > tests/run-elflint-self.sh || die
printf "#!/bin/sh\nexit 77" > tests/run-reverse-sections-self.sh || die
# TODO: Fails with SFrames
printf "#!/bin/sh\nexit 77" > tests/run-strip-strmerge.sh || die
# https://sourceware.org/PR23914
sed -i 's:-Werror::' */Makefile.in || die
}
@ -105,8 +114,8 @@ multilib_src_configure() {
$(multilib_native_use_enable stacktrace)
$(use_enable valgrind valgrind-annotations)
# explicitly disable thread safety, it's not recommended by upstream
# doesn't build either on musl.
# Explicitly disable thread safety, it's not recommended by upstream
# (marked experimental in configure) and doesn't build either on musl.
--disable-thread-safety
# Valgrind option is just for running tests under it; dodgy under sandbox
@ -115,6 +124,7 @@ multilib_src_configure() {
--program-prefix="eu-"
--with-zlib
$(use_with bzip2 bzlib)
$(multilib_native_use_with libarchive)
$(use_with lzma)
$(use_with zstd)
)

View File

@ -28,20 +28,21 @@ fi
LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
SLOT="0"
IUSE="bzip2 debuginfod +lzma nls static-libs stacktrace test +utils valgrind zstd"
IUSE="bzip2 debuginfod libarchive +lzma nls static-libs stacktrace test +utils valgrind zstd"
RESTRICT="!test? ( test )"
REQUIRED_USE="debuginfod? ( libarchive )"
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-3.1.2:=
dev-db/sqlite:3=
>=dev-libs/json-c-0.11:=[${MULTILIB_USEDEP}]
>=net-libs/libmicrohttpd-0.9.33:=
>=net-misc/curl-7.29.0[static-libs?,${MULTILIB_USEDEP}]
)
libarchive? ( >=app-arch/libarchive-3.1.2:= )
lzma? ( >=app-arch/xz-utils-5.0.5-r1[static-libs?,${MULTILIB_USEDEP}] )
stacktrace? ( dev-util/sysprof )
zstd? ( app-arch/zstd:=[static-libs?,${MULTILIB_USEDEP}] )
@ -84,6 +85,8 @@ src_prepare() {
# "section [14] '.rel.plt': relocation 55: relocation type invalid for the file type"
printf "#!/bin/sh\nexit 77" > tests/run-elflint-self.sh || die
printf "#!/bin/sh\nexit 77" > tests/run-reverse-sections-self.sh || die
# TODO: Fails with SFrames
printf "#!/bin/sh\nexit 77" > tests/run-strip-strmerge.sh || die
# https://sourceware.org/PR23914
sed -i 's:-Werror::' */Makefile.in || die
@ -110,8 +113,8 @@ multilib_src_configure() {
$(multilib_native_use_enable stacktrace)
$(use_enable valgrind valgrind-annotations)
# explicitly disable thread safety, it's not recommended by upstream
# doesn't build either on musl.
# Explicitly disable thread safety, it's not recommended by upstream
# (marked experimental in configure) and doesn't build either on musl.
--disable-thread-safety
# Valgrind option is just for running tests under it; dodgy under sandbox
@ -120,6 +123,7 @@ multilib_src_configure() {
--program-prefix="eu-"
--with-zlib
$(use_with bzip2 bzlib)
$(multilib_native_use_with libarchive)
$(use_with lzma)
$(use_with zstd)
)

View File

@ -1,28 +0,0 @@
https://bugs.gentoo.org/925241
Replace -I with -iquote to avoid overriding stack system header from libcxx-18
with the previously built stack binary. Override DEFAULT_INLCUDES because m4
adds -I. by default.
--- a/config/eu.am
+++ b/config/eu.am
@@ -31,7 +31,7 @@
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
+AM_CPPFLAGS = -iquote . -I$(srcdir) -I$(top_srcdir)/lib -I..
# Drop the 'u' flag that automake adds by default. It is incompatible
# with deterministic archives.
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,6 +19,8 @@
include $(top_srcdir)/config/eu.am
DEFS += $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \
-DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
+
+DEFAULT_INCLUDES =
AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
-I$(srcdir)/../libdwfl -I$(srcdir)/../libasm -I../debuginfod

View File

@ -1,32 +0,0 @@
From 43ddbe073025fe2ff454dabb84674ccdbd013487 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Wed, 29 Jan 2025 09:32:49 +0200
Subject: [PATCH] Declare HAVE_ERROR_H only if error symbol is available
Musl doesn't provide error.h. But there exists a standalone implementation
that installs /usr/include/error.h but requires explicit linkage. This
leads linkage errors later on due to the assumption that error
symbols are provided by the libc.
Bug: https://bugs.gentoo.org/948878
Signed-off-by: Alfred Wingate <parona@protonmail.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 1da2a12c..7a2f2540 100644
--- a/configure.ac
+++ b/configure.ac
@@ -477,7 +477,7 @@ AC_CHECK_FUNCS([process_vm_readv mremap])
AS_IF([test "x$ac_cv_func_mremap" = "xno"],
[AC_MSG_WARN([elf_update needs mremap to support ELF_C_RDWR_MMAP])])
-AC_CHECK_HEADERS([error.h])
+AC_CHECK_HEADER([error.h], [AC_CHECK_FUNC([error], AC_DEFINE([HAVE_ERROR_H], [1], [Define if error.h is usable]))])
AC_CHECK_HEADERS([err.h])
dnl for debuginfod concurrency heuristics
--
2.48.1

View File

@ -1,96 +0,0 @@
https://sourceware.org/git/?p=elfutils.git;a=commit;h=42b19e54393f031e6355cf0658e9518571e85ed3
From 42b19e54393f031e6355cf0658e9518571e85ed3 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Tue, 22 Oct 2024 18:19:09 +0200
Subject: [PATCH] configure: better error message for [lib]debuginfod missing
dependencies
When dependencies for libdebuginfod, debuginfod or ima verification are
missing and these features are explicitly enabled the user might not
immediately know which of the dependicies are missing. Move the checks
around a little so checks for dependencies are done immediately before
the enable error message. And add the possible reason to the error to
make things more clear.
* configure.ac: Move libcurl and json-c tests before libdebuginfod
check, move libmicrohttpd, sqlite3 and libarchive tests before
debuginfod check and move librpm, libcrypto and imaevm.h tests
before ima verification check.
https://sourceware.org/PR32294
Signed-off-by: Mark Wielaard <mark@klomp.org>
--- a/configure.ac
+++ b/configure.ac
@@ -837,16 +837,7 @@ AC_ARG_ENABLE([debuginfod-ima-verification],[AS_HELP_STRING([--enable-debuginfod
# Look for various packages, minimum versions as per rhel7.
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([libcurl],[libcurl >= 7.29.0],[have_libcurl=yes],[have_libcurl=no])
-AC_CHECK_LIB(pthread, pthread_setname_np, [AC_DEFINE([HAVE_PTHREAD_SETNAME_NP],[1],[Enable pthread_setname_np])])
PKG_CHECK_MODULES([jsonc],[json-c >= 0.11],[have_jsonc=yes],[have_jsonc=no])
-PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no])
-PKG_CHECK_MODULES([oldlibmicrohttpd],[libmicrohttpd < 0.9.51],[old_libmicrohttpd=yes],[old_libmicrohttpd=no])
-PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[have_sqlite3=yes],[have_sqlite3=no])
-PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[have_libarchive=yes],[have_libarchive=no])
-AC_CHECK_LIB(rpm, headerGet, [AC_CHECK_DECL(RPMSIGTAG_FILESIGNATURES,
- [AC_SUBST(rpm_LIBS, '-lrpm -lrpmio')],[], [#include <rpm/rpmlib.h>])])
-AC_CHECK_LIB(crypto, EVP_MD_CTX_new, [AC_SUBST(crypto_LIBS, '-lcrypto')])
-AC_CHECK_HEADER(imaevm.h)
#
# pronounce judgement on ability to build client, overridden by =yes/=no
if test "x$enable_libdebuginfod" = "xno"; then
@@ -855,11 +846,15 @@ elif test "x$enable_libdebuginfod" = "xdummy"; then
true
elif test "x$have_jsonc$have_libcurl" = "xyesyes"; then
enable_libdebuginfod=yes
-elif test "x$enable_libdebuginfod" = "xyes" -o "x$enable_libdebuginfod" = "xdummy"; then
- AC_MSG_ERROR([unable to build libdebuginfod])
+elif test "x$enable_libdebuginfod" = "xyes"; then
+ AC_MSG_ERROR([unable to build libdebuginfod, missing libjson-c or libcurl])
else
enable_libdebuginfod=no
fi
+PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no])
+PKG_CHECK_MODULES([oldlibmicrohttpd],[libmicrohttpd < 0.9.51],[old_libmicrohttpd=yes],[old_libmicrohttpd=no])
+PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[have_sqlite3=yes],[have_sqlite3=no])
+PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[have_libarchive=yes],[have_libarchive=no])
#
# pronounce judgement on ability to build server, overridden by =yes/=no
if test "x$enable_debuginfod" = "xno"; then
@@ -867,18 +862,22 @@ if test "x$enable_debuginfod" = "xno"; then
elif test "x$have_jsonc$HAVE_CXX11$have_libarchive$have_sqlite3" = "xyesyesyesyes"; then
enable_debuginfod=yes
elif test "x$enable_debuginfod" = "xyes"; then
- AC_MSG_ERROR([unable to build debuginfod])
+ AC_MSG_ERROR([unable to build debuginfod, missing libmicrohttpd, sqlite3 or libarchive])
else
enable_debuginfod=no
fi
#
+AC_CHECK_LIB(rpm, headerGet, [AC_CHECK_DECL(RPMSIGTAG_FILESIGNATURES,
+ [AC_SUBST(rpm_LIBS, '-lrpm -lrpmio')],[], [#include <rpm/rpmlib.h>])])
+AC_CHECK_LIB(crypto, EVP_MD_CTX_new, [AC_SUBST(crypto_LIBS, '-lcrypto')])
+AC_CHECK_HEADER(imaevm.h)
# pronounce judgment on ima signature support
if test "x$enable_debuginfod_ima_verification" = "xno"; then
true
elif test "x$ac_cv_lib_rpm_headerGet$ac_cv_have_decl_RPMSIGTAG_FILESIGNATURES$ac_cv_lib_crypto_EVP_MD_CTX_new$ac_cv_header_imaevm_h" = "xyesyesyesyes"; then
enable_debuginfod_ima_verification=yes
elif test "x$enable_debuginfod_ima_verification" = "xyes"; then
- AC_MSG_ERROR([unable to enable debuginfod ima verification])
+ AC_MSG_ERROR([unable to enable ima verification, missing librpm, libcrypto or imaevm.h])
else
enable_debuginfod_ima_verification=no
fi
@@ -895,6 +894,8 @@ AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Defin
AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"])
AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"])
+AC_CHECK_LIB(pthread, pthread_setname_np, [AC_DEFINE([HAVE_PTHREAD_SETNAME_NP],[1],[Enable pthread_setname_np])])
+
dnl for /etc/profile.d/elfutils.{csh,sh}
default_debuginfod_urls=""
AC_ARG_ENABLE(debuginfod-urls,
--
2.43.5

View File

@ -1,31 +0,0 @@
https://sourceware.org/git/?p=elfutils.git;a=commit;h=f5d6e088f84dd05278c4698a21cbf1ff4569978d
From f5d6e088f84dd05278c4698a21cbf1ff4569978d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Tue, 22 Oct 2024 15:03:42 +0200
Subject: [PATCH] libelf: Add libeu objects to libelf.a static archive
libelf might use some symbols from libeu.a, specifically the eu-search
wrappers. But we don't ship libeu.a separately. So include the libeu
objects in the libelf.a archive to facilitate static linking.
* libelf/Makefile.am (libeu_objects): New variable.
(libelf_a_LIBADD): New, add libeu_objects.
https://sourceware.org/PR32293
Signed-off-by: Mark Wielaard <mark@klomp.org>
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -122,6 +122,9 @@ libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS)
@$(textrel_check)
$(AM_V_at)ln -fs $@ $@.$(VERSION)
+libeu_objects = $(shell $(AR) t ../lib/libeu.a)
+libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects))
+
install: install-am libelf.so
$(mkinstalldirs) $(DESTDIR)$(libdir)
$(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
--
2.43.5

View File

@ -1,38 +0,0 @@
https://sourceware.org/git/?p=elfutils.git;a=commit;h=dce324303198545e1c5484d912e5f259b1d4953d
From dce324303198545e1c5484d912e5f259b1d4953d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 24 Oct 2024 11:06:08 +0200
Subject: [PATCH] stacktrace: Init elf_fd in sysprof_init_dwfl
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
When building with LTO gcc believes elf_fd can be used uninitialized:
In function ‘sysprof_init_dwfl’,
inlined from ‘sysprof_unwind_cb’ at stacktrace.c:1235:16:
stacktrace.c:1087:7: error: ‘elf_fd’ may be used uninitialized [-Werror=maybe-uninitialized]
1087 | close (elf_fd);
| ^
This code won't be reached because if find_procfile doesn't initialize
elf_fd, it will return an error. But help the compiler by initializing
elf_fd to -1.
* src/stacktrace.c (sysprof_init_dwfl): Init elf_fd to -1.
Signed-off-by: Mark Wielaard <mark@klomp.org>
--- a/src/stacktrace.c
+++ b/src/stacktrace.c
@@ -1033,7 +1033,7 @@ sysprof_init_dwfl (struct sysprof_unwind_info *sui,
}
Elf *elf = NULL;
- int elf_fd;
+ int elf_fd = -1;
err = find_procfile (dwfl, &pid, &elf, &elf_fd);
if (err < 0)
{
--
2.43.5

View File

@ -0,0 +1,136 @@
https://sourceware.org/git/?p=elfutils.git;a=commit;h=f66135f16fe44182a3fc5b651d7e5071c936217d
From f66135f16fe44182a3fc5b651d7e5071c936217d Mon Sep 17 00:00:00 2001
From: Aaron Merey <amerey@redhat.com>
Date: Mon, 27 Oct 2025 22:00:12 -0400
Subject: [PATCH] readelf: Allocate job_data one-by-one as needed
Currently, job_data is stored in an array whose size is equal to the
number of debug sections (.debug_*, .eh_frame, .gdb_index, etc.).
This size may be too small if a binary contains multiple debug sections
with the same name. For example an ET_REL binary compiled with -ggdb3
can contain multiple .debug_macro sections.
Fix this by allocating job_data on the fly when preparing to read a
debug section. This supports an arbitrary number of debug sections
while also avoiding unnecessary memory allocation.
https://sourceware.org/bugzilla/show_bug.cgi?id=33580
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
src/readelf.c | 49 +++++++++++++++++++++++++------------------------
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/src/readelf.c b/src/readelf.c
index ee6c203d..a2d17358 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -12200,7 +12200,8 @@ getone_dwflmod (Dwfl_Module *dwflmod,
return DWARF_CB_OK;
}
-typedef struct {
+typedef struct Job_Data {
+ struct Job_Data *next;
Dwfl_Module *dwflmod;
Ebl *ebl;
GElf_Ehdr *ehdr;
@@ -12230,7 +12231,7 @@ do_job (void *data, FILE *out)
If thread safety is not supported or the maximum number of threads is set
to 1, then immediately call START_ROUTINE with the given arguments. */
static void
-schedule_job (job_data jdata[], size_t idx,
+schedule_job (job_data **jdatalist,
void (*start_routine) (Dwfl_Module *, Ebl *, GElf_Ehdr *,
Elf_Scn *, GElf_Shdr *, Dwarf *, FILE *),
Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn,
@@ -12239,21 +12240,24 @@ schedule_job (job_data jdata[], size_t idx,
#ifdef USE_LOCKS
if (max_threads > 1)
{
- /* Add to the job queue. */
- jdata[idx].dwflmod = dwflmod;
- jdata[idx].ebl = ebl;
- jdata[idx].ehdr = ehdr;
- jdata[idx].scn = *scn;
- jdata[idx].shdr = *shdr;
- jdata[idx].dbg = dbg;
- jdata[idx].fp = start_routine;
+ job_data *jdata = xmalloc (sizeof (job_data));
+
+ jdata->dwflmod = dwflmod;
+ jdata->ebl = ebl;
+ jdata->ehdr = ehdr;
+ jdata->scn = *scn;
+ jdata->shdr = *shdr;
+ jdata->dbg = dbg;
+ jdata->fp = start_routine;
+ jdata->next = *jdatalist;
+ *jdatalist = jdata;
- add_job (do_job, (void *) &jdata[idx]);
+ add_job (do_job, (void *) jdata);
}
else
start_routine (dwflmod, ebl, ehdr, scn, shdr, dbg, stdout);
#else
- (void) jdata; (void) idx;
+ (void) jdatalist;
start_routine (dwflmod, ebl, ehdr, scn, shdr, dbg, stdout);
#endif
@@ -12431,8 +12435,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error_exit (0, _("cannot get section header string table index"));
- ssize_t num_jobs = 0;
- job_data *jdata = NULL;
+ job_data *jdatalist = NULL;
/* If the .debug_info section is listed as implicitly required then
we must make sure to handle it before handling any other debug
@@ -12531,13 +12534,6 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
if (name == NULL)
continue;
- if (jdata == NULL)
- {
- jdata = calloc (ndebug_sections, sizeof (*jdata));
- if (jdata == NULL)
- error_exit (0, _("failed to allocate job data"));
- }
-
int n;
for (n = 0; n < ndebug_sections; ++n)
{
@@ -12561,10 +12557,9 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
{
if (((print_debug_sections | implicit_debug_sections)
& debug_sections[n].bitmask))
- schedule_job (jdata, num_jobs++, debug_sections[n].fp,
+ schedule_job (&jdatalist, debug_sections[n].fp,
dwflmod, ebl, ehdr, scn, shdr, dbg);
- assert (num_jobs <= ndebug_sections);
break;
}
}
@@ -12579,7 +12574,13 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
dwfl_end (skel_dwfl);
free (skel_name);
- free (jdata);
+
+ while (jdatalist != NULL)
+ {
+ job_data *jdata = jdatalist;
+ jdatalist = jdatalist->next;
+ free (jdata);
+ }
/* Turn implicit and/or explicit back on in case we go over another file. */
if (implicit_info)
--
2.43.7

View File

@ -6,14 +6,20 @@
<name>Gentoo Toolchain Project</name>
</maintainer>
<use>
<flag name="debuginfod">Enable debuginfod support, both the debuginfod server and the libdebuginfod client library</flag>
<flag name="libarchive">
Needed for debuginfod (the server) and also for
--zip support in the eu-srcfiles utility.
Requires <pkg>app-arch/libarchive</pkg>.
</flag>
<flag name="lzma">Support automatic decompression of LZMA-compressed files and kernel images</flag>
<flag name="stacktrace">
Build experimental eu-stacktrace tool. Relies on integration with dev-util/sysprof.
See https://developers.redhat.com/articles/2024/06/11/get-system-wide-profiles-binaries-without-frame-pointers.
</flag>
<flag name="utils">Install command-line utilities (all the eu-* programs)</flag>
<flag name="debuginfod">Enable debuginfod support, both the debuginfod server and the libdebuginfod client library</flag>
<flag name="utils">Install command-line utilities (all the eu-* programs).</flag>
</use>
<upstream>
<remote-id type="cpe">cpe:/a:elfutils_project:elfutils</remote-id>