commit: f71eefb64fe9458509575fef9f31745a901655c7 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Oct 29 08:15:52 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Oct 29 08:20:11 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f71eefb6
dev-libs/elfutils: add 0.194 Closes: https://bugs.gentoo.org/957989 Signed-off-by: Sam James <sam <AT> gentoo.org> dev-libs/elfutils/Manifest | 2 + ...{elfutils-9999.ebuild => elfutils-0.194.ebuild} | 13 +- dev-libs/elfutils/elfutils-9999.ebuild | 12 +- dev-libs/elfutils/files/elfutils-0.194-tests.patch | 136 +++++++++++++++++++++ dev-libs/elfutils/metadata.xml | 10 +- 5 files changed, 163 insertions(+), 10 deletions(-) diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest index 84a450b50b98..421ea88c2b7c 100644 --- a/dev-libs/elfutils/Manifest +++ b/dev-libs/elfutils/Manifest @@ -4,3 +4,5 @@ DIST elfutils-0.192.tar.bz2 11913897 BLAKE2B cf9036a1fca416e0d47c764710936092305 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 diff --git a/dev-libs/elfutils/elfutils-9999.ebuild b/dev-libs/elfutils/elfutils-0.194.ebuild similarity index 89% copy from dev-libs/elfutils/elfutils-9999.ebuild copy to dev-libs/elfutils/elfutils-0.194.ebuild index 5f4954759a43..590f123620aa 100644 --- a/dev-libs/elfutils/elfutils-9999.ebuild +++ b/dev-libs/elfutils/elfutils-0.194.ebuild @@ -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}] ) @@ -65,6 +66,7 @@ BDEPEND+=" PATCHES=( "${FILESDIR}"/${PN}-0.189-musl-aarch64-regs.patch "${FILESDIR}"/${PN}-0.191-musl-macros.patch + "${FILESDIR}"/${P}-tests.patch ) src_prepare() { @@ -84,6 +86,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 +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 @@ -120,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) ) diff --git a/dev-libs/elfutils/elfutils-9999.ebuild b/dev-libs/elfutils/elfutils-9999.ebuild index 5f4954759a43..5852a5743355 100644 --- a/dev-libs/elfutils/elfutils-9999.ebuild +++ b/dev-libs/elfutils/elfutils-9999.ebuild @@ -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) ) diff --git a/dev-libs/elfutils/files/elfutils-0.194-tests.patch b/dev-libs/elfutils/files/elfutils-0.194-tests.patch new file mode 100644 index 000000000000..14c4a46613a6 --- /dev/null +++ b/dev-libs/elfutils/files/elfutils-0.194-tests.patch @@ -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 <[email protected]> +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 <[email protected]> +--- + 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 diff --git a/dev-libs/elfutils/metadata.xml b/dev-libs/elfutils/metadata.xml index a28aa11dc005..caed8c112b94 100644 --- a/dev-libs/elfutils/metadata.xml +++ b/dev-libs/elfutils/metadata.xml @@ -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>
