public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/elfutils/files/, dev-libs/elfutils/, profiles/arch/amd64/, ...
@ 2024-10-29  1:06 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2024-10-29  1:06 UTC (permalink / raw
  To: gentoo-commits

commit:     17bf42f78a41bea2fce8db8daadef889a7d99b5a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 29 00:28:31 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 29 00:37:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17bf42f7

dev-libs/elfutils: add 0.192

Wires up USE=stacktrace for the new eu-stacktrace tool, which is very
exciting, but still relies on patched sysprof so masked the USE flag
for now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/elfutils/Manifest                         |  2 +
 ...{elfutils-9999.ebuild => elfutils-0.192.ebuild} |  7 +-
 dev-libs/elfutils/elfutils-9999.ebuild             |  4 +-
 ...tils-0.192-configure-better-error-message.patch | 96 ++++++++++++++++++++++
 .../elfutils-0.192-libelf-static-link-libeu.patch  | 31 +++++++
 .../elfutils-0.192-stacktrace-maybe-uninit.patch   | 38 +++++++++
 dev-libs/elfutils/metadata.xml                     |  5 ++
 profiles/arch/amd64/package.use.mask               |  4 +
 profiles/arch/base/package.use.mask                |  4 +
 profiles/base/package.use.mask                     |  4 +
 10 files changed, 193 insertions(+), 2 deletions(-)

diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest
index c9977594e891..01f87dc02d56 100644
--- a/dev-libs/elfutils/Manifest
+++ b/dev-libs/elfutils/Manifest
@@ -2,3 +2,5 @@ DIST elfutils-0.190.tar.bz2 9162766 BLAKE2B 9934aff08f1898377708b28595fb52130ef9
 DIST elfutils-0.190.tar.bz2.sig 310 BLAKE2B d6a2d490aa6815ed9a7c3624050716ebf7c50465af9907d471d47aa3b57590faf9b9ee03de127c6b3bdffa6948414aab6aa8c784ce29570f76bb03ee2021c062 SHA512 7cd88c19402a959679204a5b01ddd48720e224b84268d0d7452f0f1433150b97dd02288fac204fbd5e2fd6f227473bfe62205b350d5fe2e17addf45fb452eed6
 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

diff --git a/dev-libs/elfutils/elfutils-9999.ebuild b/dev-libs/elfutils/elfutils-0.192.ebuild
similarity index 91%
copy from dev-libs/elfutils/elfutils-9999.ebuild
copy to dev-libs/elfutils/elfutils-0.192.ebuild
index ca29f7aa5643..36c17b46d209 100644
--- a/dev-libs/elfutils/elfutils-9999.ebuild
+++ b/dev-libs/elfutils/elfutils-0.192.ebuild
@@ -28,7 +28,7 @@ fi
 
 LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
 SLOT="0"
-IUSE="bzip2 debuginfod lzma nls static-libs test +utils valgrind zstd"
+IUSE="bzip2 debuginfod lzma nls static-libs stacktrace test +utils valgrind zstd"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
@@ -43,6 +43,7 @@ RDEPEND="
 		net-misc/curl[static-libs?,${MULTILIB_USEDEP}]
 	)
 	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}] )
 	elibc_musl? (
 		dev-libs/libbsd
@@ -64,6 +65,9 @@ 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
 )
 
 src_prepare() {
@@ -96,6 +100,7 @@ multilib_src_configure() {
 		$(use_enable nls)
 		$(multilib_native_use_enable debuginfod)
 		$(use_enable debuginfod libdebuginfod)
+		$(multilib_native_use_enable stacktrace)
 		$(use_enable valgrind valgrind-annotations)
 
 		# explicitly disable thread safety, it's not recommended by upstream

diff --git a/dev-libs/elfutils/elfutils-9999.ebuild b/dev-libs/elfutils/elfutils-9999.ebuild
index ca29f7aa5643..84b6120da8b2 100644
--- a/dev-libs/elfutils/elfutils-9999.ebuild
+++ b/dev-libs/elfutils/elfutils-9999.ebuild
@@ -28,7 +28,7 @@ fi
 
 LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
 SLOT="0"
-IUSE="bzip2 debuginfod lzma nls static-libs test +utils valgrind zstd"
+IUSE="bzip2 debuginfod lzma nls static-libs stacktrace test +utils valgrind zstd"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
@@ -43,6 +43,7 @@ RDEPEND="
 		net-misc/curl[static-libs?,${MULTILIB_USEDEP}]
 	)
 	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}] )
 	elibc_musl? (
 		dev-libs/libbsd
@@ -96,6 +97,7 @@ multilib_src_configure() {
 		$(use_enable nls)
 		$(multilib_native_use_enable debuginfod)
 		$(use_enable debuginfod libdebuginfod)
+		$(multilib_native_use_enable stacktrace)
 		$(use_enable valgrind valgrind-annotations)
 
 		# explicitly disable thread safety, it's not recommended by upstream

diff --git a/dev-libs/elfutils/files/elfutils-0.192-configure-better-error-message.patch b/dev-libs/elfutils/files/elfutils-0.192-configure-better-error-message.patch
new file mode 100644
index 000000000000..fc6867ea782d
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.192-configure-better-error-message.patch
@@ -0,0 +1,96 @@
+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

diff --git a/dev-libs/elfutils/files/elfutils-0.192-libelf-static-link-libeu.patch b/dev-libs/elfutils/files/elfutils-0.192-libelf-static-link-libeu.patch
new file mode 100644
index 000000000000..0986ce6b3262
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.192-libelf-static-link-libeu.patch
@@ -0,0 +1,31 @@
+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

diff --git a/dev-libs/elfutils/files/elfutils-0.192-stacktrace-maybe-uninit.patch b/dev-libs/elfutils/files/elfutils-0.192-stacktrace-maybe-uninit.patch
new file mode 100644
index 000000000000..f572bf854678
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.192-stacktrace-maybe-uninit.patch
@@ -0,0 +1,38 @@
+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

diff --git a/dev-libs/elfutils/metadata.xml b/dev-libs/elfutils/metadata.xml
index 05def2bfd0b3..a28aa11dc005 100644
--- a/dev-libs/elfutils/metadata.xml
+++ b/dev-libs/elfutils/metadata.xml
@@ -7,6 +7,11 @@
 	</maintainer>
 	<use>
 		<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>
 	</use>

diff --git a/profiles/arch/amd64/package.use.mask b/profiles/arch/amd64/package.use.mask
index d9134885799f..fdece9536c32 100644
--- a/profiles/arch/amd64/package.use.mask
+++ b/profiles/arch/amd64/package.use.mask
@@ -17,6 +17,10 @@
 
 #--- END OF EXAMPLES ---
 
+# Sam James <sam@gentoo.org> (2024-10-29)
+# Only available on amd64 for now
+dev-libs/elfutils -stacktrace
+
 # Viorel Munteanu <ceamac@gentoo.org> (2024-10-23)
 # Dependency dev-python/asyncssh is keyworded here.
 net-misc/dropbear -test

diff --git a/profiles/arch/base/package.use.mask b/profiles/arch/base/package.use.mask
index 2edcde7a59c8..c1eddd2ac0ff 100644
--- a/profiles/arch/base/package.use.mask
+++ b/profiles/arch/base/package.use.mask
@@ -1,6 +1,10 @@
 # Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Sam James <sam@gentoo.org> (2024-10-29)
+# Only available on amd64 for now
+dev-libs/elfutils stacktrace
+
 # Viorel Munteanu <ceamac@gentoo.org> (2024-10-23)
 # Missing keywords on dev-python/asyncssh.
 net-misc/dropbear test

diff --git a/profiles/base/package.use.mask b/profiles/base/package.use.mask
index d2d2e9dce85f..f6a7e6cd7462 100644
--- a/profiles/base/package.use.mask
+++ b/profiles/base/package.use.mask
@@ -3,6 +3,10 @@
 
 # New entries go on top.
 
+# Sam James <sam@gentoo.org> (2024-10-29)
+# Currently needs patched dev-util/sysprof.
+dev-libs/elfutils stacktrace
+
 # Andreas K. Hüttel <dilfridge@gentoo.org> (2024-10-21)
 # Mechanism for coping with the time64 transition of 32bit arches
 # Will be unmasked in the time64 profiles


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-29  1:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29  1:06 [gentoo-commits] repo/gentoo:master commit in: dev-libs/elfutils/files/, dev-libs/elfutils/, profiles/arch/amd64/, Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox