From c06d0b7bcfad0dba8c6791a75152c290e5fdc9c7 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Oct 24 2024 22:49:13 +0000 Subject: 0.192-2 Enable eu-stacktrace on x86_64 Add elfutils-0.192-stacktrace-lto.patch Resolves: RHEL-64067 --- diff --git a/elfutils-0.192-stacktrace-lto.patch b/elfutils-0.192-stacktrace-lto.patch new file mode 100644 index 0000000..9f110f8 --- /dev/null +++ b/elfutils-0.192-stacktrace-lto.patch @@ -0,0 +1,35 @@ +commit 43829fb8780ecbe9d17aaed22d3dfcb806cb5f45 +Author: Mark Wielaard +Date: Thu Oct 24 10:44:25 2024 +0200 + + stacktrace: Init elf_fd in sysprof_init_dwfl + + 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 + +diff --git a/src/stacktrace.c b/src/stacktrace.c +index 438cb1dd0d38..b912ca5de502 100644 +--- 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) + { diff --git a/elfutils.spec b/elfutils.spec index b1574fd..bc16325 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 1 +%global baserelease 2 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -16,6 +16,13 @@ Summary: A collection of utilities and DSOs to handle ELF files and DWARF data # Needed for isa specific Provides and Requires. %global depsuffix %{?_isa}%{!?_isa:-%{_arch}} +# eu-stacktrace currently only supports x86_64 +%ifarch x86_64 +%global enable_stacktrace 1 +%else +%global enable_stacktrace 0 +%endif + Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libs%{depsuffix} = %{version}-%{release} Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release} @@ -53,6 +60,11 @@ BuildRequires: curl # For run-debuginfod-response-headers.sh test case BuildRequires: socat +# For eu-stacktrace +%if %{enable_stacktrace} +BuildRequires: sysprof-capture-devel +%endif + BuildRequires: automake BuildRequires: autoconf BuildRequires: gettext-devel @@ -77,6 +89,9 @@ BuildRequires: gettext-devel # Include libeu.a objects in libelf.a for static linking. Patch1: elfutils-0.192-libelf-static.patch +# Fix eu-stacktrace LTO build error. +Patch2: elfutils-0.192-stacktrace-lto.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -303,11 +318,14 @@ RPM_OPT_FLAGS="${RPM_OPT_FLAGS} -Wformat" trap 'cat config.log' EXIT +%configure CFLAGS="$RPM_OPT_FLAGS" \ %if 0%{?centos} >= 8 -%configure CFLAGS="$RPM_OPT_FLAGS" --enable-debuginfod-urls=https://debuginfod.centos.org/ -%else -%configure CFLAGS="$RPM_OPT_FLAGS" + --enable-debuginfod-urls=%{dist_debuginfod_url} \ +%endif +%if %{enable_stacktrace} + --enable-stacktrace \ %endif + --enable-debuginfod trap '' EXIT %make_build @@ -390,6 +408,9 @@ fi %{_bindir}/eu-size %{_bindir}/eu-srcfiles %{_bindir}/eu-stack +%if %{enable_stacktrace} +%{_bindir}/eu-stacktrace +%endif %{_bindir}/eu-strings %{_bindir}/eu-strip %{_bindir}/eu-unstrip @@ -497,6 +518,10 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Thu Oct 24 2024 Aaron Merey - 0.192-2 +- Enable eu-stacktrace on x86_64 +- Add elfutils-0.192-stacktrace-lto.patch + * Wed Oct 23 2024 Aaron Merey - 0.192-1 - Upgrade to upstream elfutils 0.192 - Drop upstreamed patches