From 347c8e91ee1c65b9d7dc1cc83446a1d7bdb0c013 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Tue, 29 Oct 2024 12:43:39 -0400 Subject: [PATCH 01/13] 0.192-5 - Enable debuginfod IMA verification - Add elfutils-0.192-fix-configure-conditional.patch - Add elfutils-0.192-fix-zsh-profile.patch --- ...tils-0.192-fix-configure-conditional.patch | 25 +++++++++++++ elfutils-0.192-fix-zsh-profile.patch | 37 +++++++++++++++++++ elfutils.spec | 22 ++++++++++- 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 elfutils-0.192-fix-configure-conditional.patch create mode 100644 elfutils-0.192-fix-zsh-profile.patch diff --git a/elfutils-0.192-fix-configure-conditional.patch b/elfutils-0.192-fix-configure-conditional.patch new file mode 100644 index 0000000..608782a --- /dev/null +++ b/elfutils-0.192-fix-configure-conditional.patch @@ -0,0 +1,25 @@ +From fb4753feb0ed7e3387f52b54bb02c6c74aac6a3e Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Tue, 29 Oct 2024 14:54:10 -0400 +Subject: [PATCH] m + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index f191488..3d2d3ee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -892,7 +892,7 @@ AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[B + AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"]) + AS_IF([test "x$enable_debuginfod_ima_verification" = "xyes"],AC_DEFINE([ENABLE_IMA_VERIFICATION],[1],[Build IMA verification])) + AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Define to 1 if libarchive is available])) +-AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"]) ++AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "x$enable_debuginfod_ima_verification" = "xyes"]) + AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"]) + + dnl for /etc/profile.d/elfutils.{csh,sh} +-- +2.47.0 + diff --git a/elfutils-0.192-fix-zsh-profile.patch b/elfutils-0.192-fix-zsh-profile.patch new file mode 100644 index 0000000..6df2df8 --- /dev/null +++ b/elfutils-0.192-fix-zsh-profile.patch @@ -0,0 +1,37 @@ +From 00cb3efe36337f27925dbff9b2e7d97c7df95bf8 Mon Sep 17 00:00:00 2001 +From: RocketDev +Date: Sat, 26 Oct 2024 22:18:09 +0800 +Subject: [PATCH] config: fix globing error for zsh + +Zsh treat unmatched glob as error while bash treat that as the original +string. Substitute globing with find to solve. + + * config/profile.sh.in: Fix globing error for zsh + +Signed-off-by: RocketDev +--- + config/profile.sh.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/config/profile.sh.in b/config/profile.sh.in +index 5e86f433..9f3e415a 100644 +--- a/config/profile.sh.in ++++ b/config/profile.sh.in +@@ -6,12 +6,12 @@ + + prefix="@prefix@" + if [ -z "$DEBUGINFOD_URLS" ]; then +- DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ' || :) ++ DEBUGINFOD_URLS=$(find "@sysconfdir@/debuginfod" -name "*.urls" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ' ' || :) + [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS + fi + + if [ -z "$DEBUGINFOD_IMA_CERT_PATH" ]; then +- DEBUGINFOD_IMA_CERT_PATH=$(cat /dev/null "@sysconfdir@/debuginfod"/*.certpath 2>/dev/null | tr '\n' ':' || :) ++ DEBUGINFOD_IMA_CERT_PATH=$(find "@sysconfdir@/debuginfod" -name "*.certpath" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ':' || :) + [ -n "$DEBUGINFOD_IMA_CERT_PATH" ] && export DEBUGINFOD_IMA_CERT_PATH || unset DEBUGINFOD_IMA_CERT_PATH + fi + unset prefix +-- +2.47.0 + diff --git a/elfutils.spec b/elfutils.spec index e415af8..4d9b44d 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 4 +%global baserelease 5 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -62,6 +62,12 @@ BuildRequires: socat # For run-debuginfod-find-metadata.sh BuildRequires: jq +# For debuginfod rpm IMA verification +BuildRequires: rpm-devel +BuildRequires: ima-evm-utils-devel +BuildRequires: openssl-devel +BuildRequires: rpm-sign + # For eu-stacktrace %if %{enable_stacktrace} BuildRequires: sysprof-capture-devel @@ -97,6 +103,12 @@ Patch2: elfutils-0.192-libelf-static.patch # Fix eu-stacktrace build with lto enabled. Patch3: elfutils-0.192-stacktrace-lto.patch +# Fix ENABLE_IMA_VERIFICATION always evaluating to false. +Patch4: elfutils-0.192-fix-configure-conditional.patch + +# Fix empty glob error on zsh. +Patch5: elfutils-0.192-fix-zsh-profile.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -324,12 +336,13 @@ trap 'cat config.log' EXIT # not configure a default server. %configure CFLAGS="$RPM_OPT_FLAGS" \ %if "%{?dist_debuginfod_url}" + --enable-debuginfod \ --enable-debuginfod-urls=%{dist_debuginfod_url} \ %endif %if %{enable_stacktrace} --enable-stacktrace \ %endif - --enable-debuginfod + --enable-debuginfod-ima-verification trap '' EXIT %make_build @@ -515,6 +528,11 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Tue Oct 29 2024 Aaron Merey - 0.192-5 +- Enable debuginfod IMA verification +- Add elfutils-0.192-fix-configure-conditional.patch +- Add elfutils-0.192-fix-zsh-profile.patch + * Thu Oct 24 2024 Mark Wielaard - 0.192-4 - Add elfutils-0.192-stacktrace-lto.patch - Enable eu-stacktrace on x86_64 From 861e4d63d5203347beaf3e1b43e76619fa115ae2 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Tue, 12 Nov 2024 13:44:16 -0500 Subject: [PATCH 02/13] 0.192-6 - Add elfutils-0.192-strip-ignore-non-ET_REL.patch - Set debuginfod IMA cert path --- elfutils-0.192-strip-ignore-non-ET_REL.patch | 48 ++++++++++++++++++++ elfutils.spec | 12 ++++- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 elfutils-0.192-strip-ignore-non-ET_REL.patch diff --git a/elfutils-0.192-strip-ignore-non-ET_REL.patch b/elfutils-0.192-strip-ignore-non-ET_REL.patch new file mode 100644 index 0000000..bef6ca6 --- /dev/null +++ b/elfutils-0.192-strip-ignore-non-ET_REL.patch @@ -0,0 +1,48 @@ +From e425a70469436c704e6c24dd4bc2abb8fb24b61d Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Tue, 5 Nov 2024 17:41:26 -0500 +Subject: [PATCH] strip: Ignore --reloc-debug-sections-only for non-ET_REL + files. + +strip --reloc-debug-sections-only is expected to be a no-op for +non-ET_REL files. This was not enforced in the code. Sections +were copied over to a new output file and normally its contents +would be identical to the input file. + +However the output file is not identical to a non-ET_REL input +file if the linker organized sections such that the indices of +SHF_ALLOC sections are not in a contigous group. + +In this case strip will modify sections in order to keep all SHF_ALLOC +sections in a contiguous group. + +Fix this by ignoring --reloc-debug-sections-only for non-ET_REL files. + +https://sourceware.org/bugzilla/show_bug.cgi?id=32253 + +Signed-off-by: Aaron Merey +--- + src/strip.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/strip.c b/src/strip.c +index 403e0f6f..3812fb17 100644 +--- a/src/strip.c ++++ b/src/strip.c +@@ -1139,6 +1139,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, + + if (reloc_debug_only) + { ++ if (ehdr->e_type != ET_REL) ++ { ++ /* Only ET_REL files can have debug relocations to remove. */ ++ error (0, 0, _("Ignoring --reloc-debug-sections-only for " \ ++ "non-ET_REL file '%s'"), fname); ++ goto fail_close; ++ } + if (handle_debug_relocs (elf, ebl, newelf, ehdr, fname, shstrndx, + &lastsec_offset, &lastsec_size) != 0) + { +-- +2.47.0 + diff --git a/elfutils.spec b/elfutils.spec index 4d9b44d..01e85ad 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 5 +%global baserelease 6 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -109,6 +109,9 @@ Patch4: elfutils-0.192-fix-configure-conditional.patch # Fix empty glob error on zsh. Patch5: elfutils-0.192-fix-zsh-profile.patch +# Fix testsuite failure caused by ld changes. +Patch6: elfutils-0.192-strip-ignore-non-ET_REL.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -342,7 +345,8 @@ trap 'cat config.log' EXIT %if %{enable_stacktrace} --enable-stacktrace \ %endif - --enable-debuginfod-ima-verification + --enable-debuginfod-ima-verification \ + --enable-debuginfod-ima-cert-path=%{_sysconfdir}/keys/ima trap '' EXIT %make_build @@ -528,6 +532,10 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Tue Nov 12 2024 Aaron Merey - 0.192-6 +- Add elfutils-0.192-strip-ignore-non-ET_REL.patch +- Set debuginfod IMA cert path + * Tue Oct 29 2024 Aaron Merey - 0.192-5 - Enable debuginfod IMA verification - Add elfutils-0.192-fix-configure-conditional.patch From 1e27db2f4c45bf0f7dff00e341f60d8b6d8317a7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 2 Dec 2024 23:41:40 +0100 Subject: [PATCH 03/13] 0.192-7 - Add elfutils-0.192-ATOMIC_VAR_INIT.patch - Add elfutils-0.192-more-dwarf5-lang.patch --- elfutils-0.192-ATOMIC_VAR_INIT.patch | 28 ++++ elfutils-0.192-more-dwarf5-lang.patch | 204 ++++++++++++++++++++++++++ elfutils.spec | 13 +- 3 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.192-ATOMIC_VAR_INIT.patch create mode 100644 elfutils-0.192-more-dwarf5-lang.patch diff --git a/elfutils-0.192-ATOMIC_VAR_INIT.patch b/elfutils-0.192-ATOMIC_VAR_INIT.patch new file mode 100644 index 0000000..962d4c9 --- /dev/null +++ b/elfutils-0.192-ATOMIC_VAR_INIT.patch @@ -0,0 +1,28 @@ +commit 5cc89c78499cd37465d7b0b3f35ef0e5d07a98cc +Author: Mark Wielaard +Date: Mon Nov 18 19:50:17 2024 +0100 + + libdw: Don't use ATOMIC_VAR_INIT + + ATOMIC_VAR_INIT was introduced in C11, but not deemed necessary to + implement atomics. So deprecated in C17 and removed in C23. Normal + initialization syntax should be sufficient. + + * libdw/libdw_alloc.c (next_id): Initialize to zero without + using ATOMIC_VAR_INIT. + + Signed-off-by: Mark Wielaard + +diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c +index b3e533434939..adc729f525f2 100644 +--- a/libdw/libdw_alloc.c ++++ b/libdw/libdw_alloc.c +@@ -45,7 +45,7 @@ + + #define THREAD_ID_UNSET ((size_t) -1) + static __thread size_t thread_id = THREAD_ID_UNSET; +-static atomic_size_t next_id = ATOMIC_VAR_INIT(0); ++static atomic_size_t next_id = 0; + + struct libdw_memblock * + __libdw_alloc_tail (Dwarf *dbg) diff --git a/elfutils-0.192-more-dwarf5-lang.patch b/elfutils-0.192-more-dwarf5-lang.patch new file mode 100644 index 0000000..2aa0d3b --- /dev/null +++ b/elfutils-0.192-more-dwarf5-lang.patch @@ -0,0 +1,204 @@ +commit 04ba163e813f6b88da850c658a03ac7b5f19f7ad +Author: Mark Wielaard +Date: Fri Nov 22 18:17:29 2024 +0100 + + libdw: Update DW_LANG codes + + Pick up the language codes published after DWARF5 was published. + The are listed at https://dwarfstd.org/languages.html + + Also adjust C language dectection in dwarf_getfuncs and update the + dwarf_default_lower_bound function to return the default lower bounds + for the new langauge codes. + + There is one small change in dwarf_default_lower_bound. We now return + zero instead of an error when called for DW_LANG_Mips_Assembler. Since + there is now an "official" DW_LANG_Assembly which is explicitly + defined as having a default lower bound of zero. It seems better to do + the same for the vendor code too. + + * libdw/dwarf.h: Add new DW_LANG codes. + * libdw/dwarf_default_lower_bound.c (dwarf_default_lower_bound): + Handle new language codes and remove a special case for + DW_LANG_Mips_Assembler. + * libdw/dwarf_getfuncs.c (dwarf_getfuncs): Check against + DW_LANG_C17 and DW_LANG_C23. + * tests/dwarf_default_lower_bound.c: Also check for + DW_LANG_Mips_Assembler. + + Signed-off-by: Mark Wielaard + +diff --git a/libdw/dwarf.h b/libdw/dwarf.h +index 4be32de5a67d..573ffd6925b2 100644 +--- a/libdw/dwarf.h ++++ b/libdw/dwarf.h +@@ -1,5 +1,6 @@ + /* This file defines standard DWARF types, structures, and macros. + Copyright (C) 2000-2011, 2014, 2016, 2017, 2018 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -697,7 +698,11 @@ enum + }; + + +-/* DWARF language encodings. */ ++/* DWARF language encodings. ++ ++ See https://dwarfstd.org/languages.html for language code published ++ after DWARF5 was published (but before DWARF6 has been released, ++ which will introduce a new DW_AT_language_name/version scheme). */ + enum + { + DW_LANG_C89 = 0x0001, /* ISO C:1989 */ +@@ -738,6 +743,35 @@ enum + DW_LANG_RenderScript = 0x0024, /* RenderScript Kernal Language */ + DW_LANG_BLISS = 0x0025, /* BLISS */ + ++ DW_LANG_Kotlin = 0x0026, /* Kotlin */ ++ DW_LANG_Zig = 0x0027, /* Zig */ ++ DW_LANG_Crystal = 0x0028, /* Crystal */ ++ DW_LANG_C_plus_plus_17 = 0x002a, /* ISO C++:2017 */ ++ DW_LANG_C_plus_plus_20 = 0x002b, /* ISO C++:2018 */ ++ DW_LANG_C17 = 0x002c, /* ISO C:2017 */ ++ DW_LANG_Fortran18 = 0x002d, /* ISO/IEC 1539-1:2018 */ ++ DW_LANG_Ada2005 = 0x002e, /* ISO Ada:2005 */ ++ DW_LANG_Ada2012 = 0x002f, /* ISO Ada:2005 */ ++ DW_LANG_HIP = 0x0030, /* HIP */ ++ DW_LANG_Assembly = 0x0031, /* Assembly */ ++ DW_LANG_C_sharp = 0x0032, /* C# */ ++ DW_LANG_Mojo = 0x0033, /* Mojo */ ++ DW_LANG_GLSL = 0x0034, /* OpenGL Shading Language */ ++ DW_LANG_GLSL_ES = 0x0035, /* OpenGL ES Shading Language */ ++ DW_LANG_HLSL = 0x0036, /* High-Level Shading Language */ ++ DW_LANG_OpenCL_CPP = 0x0037, /* OpenCL C++ */ ++ DW_LANG_CPP_for_OpenCL = 0x0038, /* C++ for OpenCL */ ++ DW_LANG_SYCL = 0x0039, /* SYCL */ ++ DW_LANG_C_plus_plus_23 = 0x003a, /* ISO C++:2023 */ ++ DW_LANG_Odin = 0x003b, /* Odin */ ++ DW_LANG_P4 = 0x003c, /* P4 */ ++ DW_LANG_Metal = 0x003d, /* Metal */ ++ DW_LANG_C23 = 0x003e, /* ISO C:2023 */ ++ DW_LANG_Fortran23 = 0x003f, /* ISO/IEC 1539-1:2023 */ ++ DW_LANG_Ruby = 0x0040, /* Ruby */ ++ DW_LANG_Move = 0x0041, /* Move */ ++ DW_LANG_Hylo = 0x0042, /* Hylo */ ++ + DW_LANG_lo_user = 0x8000, + DW_LANG_Mips_Assembler = 0x8001, /* Assembler */ + DW_LANG_hi_user = 0xffff +diff --git a/libdw/dwarf_default_lower_bound.c b/libdw/dwarf_default_lower_bound.c +index a33a34335b1b..50639e32428e 100644 +--- a/libdw/dwarf_default_lower_bound.c ++++ b/libdw/dwarf_default_lower_bound.c +@@ -1,5 +1,6 @@ + /* Get the default subrange lower bound for a given language. + Copyright (C) 2016 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -63,6 +64,30 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result) + case DW_LANG_Dylan: + case DW_LANG_RenderScript: + case DW_LANG_BLISS: ++ case DW_LANG_Kotlin: ++ case DW_LANG_Zig: ++ case DW_LANG_Crystal: ++ case DW_LANG_C_plus_plus_17: ++ case DW_LANG_C_plus_plus_20: ++ case DW_LANG_C17: ++ case DW_LANG_HIP: ++ case DW_LANG_Assembly: ++ case DW_LANG_C_sharp: ++ case DW_LANG_Mojo: ++ case DW_LANG_GLSL: ++ case DW_LANG_GLSL_ES: ++ case DW_LANG_HLSL: ++ case DW_LANG_OpenCL_CPP: ++ case DW_LANG_CPP_for_OpenCL: ++ case DW_LANG_SYCL: ++ case DW_LANG_C_plus_plus_23: ++ case DW_LANG_Odin: ++ case DW_LANG_P4: ++ case DW_LANG_Metal: ++ case DW_LANG_C23: ++ case DW_LANG_Ruby: ++ case DW_LANG_Move: ++ case DW_LANG_Hylo: + *result = 0; + return 0; + +@@ -80,9 +105,18 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result) + case DW_LANG_Modula3: + case DW_LANG_PLI: + case DW_LANG_Julia: ++ case DW_LANG_Fortran18: ++ case DW_LANG_Ada2005: ++ case DW_LANG_Ada2012: ++ case DW_LANG_Fortran23: + *result = 1; + return 0; + ++ /* Special case vendor Assembly variant. */ ++ case DW_LANG_Mips_Assembler: ++ *result = 0; ++ return 0; ++ + default: + __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE); + return -1; +diff --git a/libdw/dwarf_getfuncs.c b/libdw/dwarf_getfuncs.c +index b95f06f403d1..f6968f0081d4 100644 +--- a/libdw/dwarf_getfuncs.c ++++ b/libdw/dwarf_getfuncs.c +@@ -1,5 +1,6 @@ + /* Get function information. + Copyright (C) 2005, 2013, 2015 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + Written by Ulrich Drepper , 2005. + +@@ -104,7 +105,9 @@ dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *), + bool c_cu = (lang == DW_LANG_C89 + || lang == DW_LANG_C + || lang == DW_LANG_C99 +- || lang == DW_LANG_C11); ++ || lang == DW_LANG_C11 ++ || lang == DW_LANG_C17 ++ || lang == DW_LANG_C23); + + struct visitor_info v = { callback, arg, (void *) offset, NULL, c_cu }; + struct Dwarf_Die_Chain chain = { .die = CUDIE (cudie->cu), +diff --git a/tests/dwarf_default_lower_bound.c b/tests/dwarf_default_lower_bound.c +index d57424fc77fe..46e26f885a6b 100644 +--- a/tests/dwarf_default_lower_bound.c ++++ b/tests/dwarf_default_lower_bound.c +@@ -1,6 +1,7 @@ + /* Test all DW_LANG constants are handled by dwarf_default_lower_bound. + + Copyright (C) 2016 Red Hat, Inc. ++ Copyright (C) 2024 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -34,18 +35,6 @@ test_lang (const char *name, int lang) + Dwarf_Sword low; + int res = dwarf_default_lower_bound (lang, &low); + +- /* Assembler is special, it doesn't really have arrays. */ +- if (lang == DW_LANG_Mips_Assembler) +- { +- if (res == 0) +- { +- printf ("%s shouldn't have a known lower bound\n", name); +- exit (-1); +- } +- printf ("%s: \n", name); +- return; +- } +- + if (res != 0) + { + printf ("dwarf_default_lower_bound failed (%d) for %s\n", res, name); diff --git a/elfutils.spec b/elfutils.spec index 01e85ad..ea03564 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 6 +%global baserelease 7 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -112,6 +112,12 @@ Patch5: elfutils-0.192-fix-zsh-profile.patch # Fix testsuite failure caused by ld changes. Patch6: elfutils-0.192-strip-ignore-non-ET_REL.patch +# In c23 ATOMIC_VAR_INIT has been removed +Patch7: elfutils-0.192-ATOMIC_VAR_INIT.patch + +# New DWARF5 language constants +Patch8: elfutils-0.192-more-dwarf5-lang.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -532,6 +538,11 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog + +* Mon Dec 2 2024 Mark Wielaard - 0.192-7 +- Add elfutils-0.192-ATOMIC_VAR_INIT.patch +- Add elfutils-0.192-more-dwarf5-lang.patch + * Tue Nov 12 2024 Aaron Merey - 0.192-6 - Add elfutils-0.192-strip-ignore-non-ET_REL.patch - Set debuginfod IMA cert path From f6430a4ebda42fcb5088cd5731c5f3fc11cc5667 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 16:47:28 +0000 Subject: [PATCH 04/13] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- elfutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elfutils.spec b/elfutils.spec index ea03564..70ec135 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 7 +%global baserelease 8 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -538,6 +538,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 0.192-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Mon Dec 2 2024 Mark Wielaard - 0.192-7 - Add elfutils-0.192-ATOMIC_VAR_INIT.patch From d699b959583150a338063b89425f4805bd886b47 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 23 Feb 2025 13:32:24 +0100 Subject: [PATCH 05/13] 0.192-9 - Add elfutils-0.192-imasig-fail-free.patch --- elfutils-0.192-imasig-fail-free.patch | 33 +++++++++++++++++++++++++++ elfutils.spec | 9 ++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 elfutils-0.192-imasig-fail-free.patch diff --git a/elfutils-0.192-imasig-fail-free.patch b/elfutils-0.192-imasig-fail-free.patch new file mode 100644 index 0000000..8840fcd --- /dev/null +++ b/elfutils-0.192-imasig-fail-free.patch @@ -0,0 +1,33 @@ +commit 1be0787d6654ed71bf659e8bfd34895fea7589eb +Author: Aaron Merey +Date: Fri Jan 24 19:43:19 2025 -0500 + + debuginfod-client.c: Avoid freeing uninitialized value + + debuginfod_validate_imasig might call free on an uninitialized sig_buf + due to a goto that can occur before sig_buf is set to NULL. + + Fix this by setting sig_buf to NULL before the goto. + + Signed-off-by: Aaron Merey + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index deff19ff4568..d89beae93ea1 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -1587,6 +1587,7 @@ debuginfod_validate_imasig (debuginfod_client *c, int fd) + { + int rc = ENOSYS; + ++ char* sig_buf = NULL; + EVP_MD_CTX *ctx = NULL; + if (!c || !c->winning_headers) + { +@@ -1594,7 +1595,6 @@ debuginfod_validate_imasig (debuginfod_client *c, int fd) + goto exit_validate; + } + // Extract the HEX IMA-signature from the header +- char* sig_buf = NULL; + char* hdr_ima_sig = strcasestr(c->winning_headers, "x-debuginfod-imasignature"); + if (!hdr_ima_sig || 1 != sscanf(hdr_ima_sig + strlen("x-debuginfod-imasignature:"), "%ms", &sig_buf)) + { diff --git a/elfutils.spec b/elfutils.spec index 70ec135..5e1ef20 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.192 -%global baserelease 8 +%global baserelease 9 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -118,6 +118,9 @@ Patch7: elfutils-0.192-ATOMIC_VAR_INIT.patch # New DWARF5 language constants Patch8: elfutils-0.192-more-dwarf5-lang.patch +# debuginfod-client.c: Avoid freeing uninitialized value +patch9: elfutils-0.192-imasig-fail-free.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -538,10 +541,12 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Sun Feb 23 2025 Mark Wielaard - 0.192-9 +- Add elfutils-0.192-imasig-fail-free.patch + * Thu Jan 16 2025 Fedora Release Engineering - 0.192-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - * Mon Dec 2 2024 Mark Wielaard - 0.192-7 - Add elfutils-0.192-ATOMIC_VAR_INIT.patch - Add elfutils-0.192-more-dwarf5-lang.patch From 3e1c6bb1d8bae31db498ad4d9b181c195e90669a Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 8 Apr 2025 17:32:01 +0000 Subject: [PATCH 06/13] Update elfutils.spec, supporting dist_debuginfod_url values with spaces --- elfutils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elfutils.spec b/elfutils.spec index 5e1ef20..281eb0f 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -349,7 +349,7 @@ trap 'cat config.log' EXIT %configure CFLAGS="$RPM_OPT_FLAGS" \ %if "%{?dist_debuginfod_url}" --enable-debuginfod \ - --enable-debuginfod-urls=%{dist_debuginfod_url} \ + --enable-debuginfod-urls="%{dist_debuginfod_url}" \ %endif %if %{enable_stacktrace} --enable-stacktrace \ From 34ae6eb109ec01600b21b615add4098e0b3f65ea Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Mon, 28 Apr 2025 18:01:43 -0400 Subject: [PATCH 07/13] 0.193-1 - Upgrade to upstream elfutils 0.193 - Drop upstreamed patches elfutils-0.192-ATOMIC_VAR_INIT.patch elfutils-0.192-libelf-static.patch elfutils-0.192-fix-configure-conditional.patch elfutils-0.192-more-dwarf5-lang.patch elfutils-0.192-fix-zsh-profile.patch elfutils-0.192-stacktrace-lto.patch elfutils-0.192-imasig-fail-free.patch elfutils-0.192-strip-ignore-non-ET_REL.patch --- .gitignore | 1 + elfutils-0.192-ATOMIC_VAR_INIT.patch | 28 --- ...tils-0.192-fix-configure-conditional.patch | 25 --- elfutils-0.192-fix-zsh-profile.patch | 37 ---- elfutils-0.192-imasig-fail-free.patch | 33 --- elfutils-0.192-libelf-static.patch | 36 ---- elfutils-0.192-more-dwarf5-lang.patch | 204 ------------------ elfutils-0.192-stacktrace-lto.patch | 35 --- elfutils-0.192-strip-ignore-non-ET_REL.patch | 48 ----- elfutils.spec | 40 ++-- sources | 2 +- 11 files changed, 16 insertions(+), 473 deletions(-) delete mode 100644 elfutils-0.192-ATOMIC_VAR_INIT.patch delete mode 100644 elfutils-0.192-fix-configure-conditional.patch delete mode 100644 elfutils-0.192-fix-zsh-profile.patch delete mode 100644 elfutils-0.192-imasig-fail-free.patch delete mode 100644 elfutils-0.192-libelf-static.patch delete mode 100644 elfutils-0.192-more-dwarf5-lang.patch delete mode 100644 elfutils-0.192-stacktrace-lto.patch delete mode 100644 elfutils-0.192-strip-ignore-non-ET_REL.patch diff --git a/.gitignore b/.gitignore index abe9c2b..a406bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ /elfutils-0.190.tar.bz2 /elfutils-0.191.tar.bz2 /elfutils-0.192.tar.bz2 +/elfutils-0.193.tar.bz2 diff --git a/elfutils-0.192-ATOMIC_VAR_INIT.patch b/elfutils-0.192-ATOMIC_VAR_INIT.patch deleted file mode 100644 index 962d4c9..0000000 --- a/elfutils-0.192-ATOMIC_VAR_INIT.patch +++ /dev/null @@ -1,28 +0,0 @@ -commit 5cc89c78499cd37465d7b0b3f35ef0e5d07a98cc -Author: Mark Wielaard -Date: Mon Nov 18 19:50:17 2024 +0100 - - libdw: Don't use ATOMIC_VAR_INIT - - ATOMIC_VAR_INIT was introduced in C11, but not deemed necessary to - implement atomics. So deprecated in C17 and removed in C23. Normal - initialization syntax should be sufficient. - - * libdw/libdw_alloc.c (next_id): Initialize to zero without - using ATOMIC_VAR_INIT. - - Signed-off-by: Mark Wielaard - -diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c -index b3e533434939..adc729f525f2 100644 ---- a/libdw/libdw_alloc.c -+++ b/libdw/libdw_alloc.c -@@ -45,7 +45,7 @@ - - #define THREAD_ID_UNSET ((size_t) -1) - static __thread size_t thread_id = THREAD_ID_UNSET; --static atomic_size_t next_id = ATOMIC_VAR_INIT(0); -+static atomic_size_t next_id = 0; - - struct libdw_memblock * - __libdw_alloc_tail (Dwarf *dbg) diff --git a/elfutils-0.192-fix-configure-conditional.patch b/elfutils-0.192-fix-configure-conditional.patch deleted file mode 100644 index 608782a..0000000 --- a/elfutils-0.192-fix-configure-conditional.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fb4753feb0ed7e3387f52b54bb02c6c74aac6a3e Mon Sep 17 00:00:00 2001 -From: Aaron Merey -Date: Tue, 29 Oct 2024 14:54:10 -0400 -Subject: [PATCH] m - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index f191488..3d2d3ee 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -892,7 +892,7 @@ AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[B - AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"]) - AS_IF([test "x$enable_debuginfod_ima_verification" = "xyes"],AC_DEFINE([ENABLE_IMA_VERIFICATION],[1],[Build IMA verification])) - AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Define to 1 if libarchive is available])) --AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"]) -+AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "x$enable_debuginfod_ima_verification" = "xyes"]) - AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"]) - - dnl for /etc/profile.d/elfutils.{csh,sh} --- -2.47.0 - diff --git a/elfutils-0.192-fix-zsh-profile.patch b/elfutils-0.192-fix-zsh-profile.patch deleted file mode 100644 index 6df2df8..0000000 --- a/elfutils-0.192-fix-zsh-profile.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 00cb3efe36337f27925dbff9b2e7d97c7df95bf8 Mon Sep 17 00:00:00 2001 -From: RocketDev -Date: Sat, 26 Oct 2024 22:18:09 +0800 -Subject: [PATCH] config: fix globing error for zsh - -Zsh treat unmatched glob as error while bash treat that as the original -string. Substitute globing with find to solve. - - * config/profile.sh.in: Fix globing error for zsh - -Signed-off-by: RocketDev ---- - config/profile.sh.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/config/profile.sh.in b/config/profile.sh.in -index 5e86f433..9f3e415a 100644 ---- a/config/profile.sh.in -+++ b/config/profile.sh.in -@@ -6,12 +6,12 @@ - - prefix="@prefix@" - if [ -z "$DEBUGINFOD_URLS" ]; then -- DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ' || :) -+ DEBUGINFOD_URLS=$(find "@sysconfdir@/debuginfod" -name "*.urls" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ' ' || :) - [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS - fi - - if [ -z "$DEBUGINFOD_IMA_CERT_PATH" ]; then -- DEBUGINFOD_IMA_CERT_PATH=$(cat /dev/null "@sysconfdir@/debuginfod"/*.certpath 2>/dev/null | tr '\n' ':' || :) -+ DEBUGINFOD_IMA_CERT_PATH=$(find "@sysconfdir@/debuginfod" -name "*.certpath" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ':' || :) - [ -n "$DEBUGINFOD_IMA_CERT_PATH" ] && export DEBUGINFOD_IMA_CERT_PATH || unset DEBUGINFOD_IMA_CERT_PATH - fi - unset prefix --- -2.47.0 - diff --git a/elfutils-0.192-imasig-fail-free.patch b/elfutils-0.192-imasig-fail-free.patch deleted file mode 100644 index 8840fcd..0000000 --- a/elfutils-0.192-imasig-fail-free.patch +++ /dev/null @@ -1,33 +0,0 @@ -commit 1be0787d6654ed71bf659e8bfd34895fea7589eb -Author: Aaron Merey -Date: Fri Jan 24 19:43:19 2025 -0500 - - debuginfod-client.c: Avoid freeing uninitialized value - - debuginfod_validate_imasig might call free on an uninitialized sig_buf - due to a goto that can occur before sig_buf is set to NULL. - - Fix this by setting sig_buf to NULL before the goto. - - Signed-off-by: Aaron Merey - -diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c -index deff19ff4568..d89beae93ea1 100644 ---- a/debuginfod/debuginfod-client.c -+++ b/debuginfod/debuginfod-client.c -@@ -1587,6 +1587,7 @@ debuginfod_validate_imasig (debuginfod_client *c, int fd) - { - int rc = ENOSYS; - -+ char* sig_buf = NULL; - EVP_MD_CTX *ctx = NULL; - if (!c || !c->winning_headers) - { -@@ -1594,7 +1595,6 @@ debuginfod_validate_imasig (debuginfod_client *c, int fd) - goto exit_validate; - } - // Extract the HEX IMA-signature from the header -- char* sig_buf = NULL; - char* hdr_ima_sig = strcasestr(c->winning_headers, "x-debuginfod-imasignature"); - if (!hdr_ima_sig || 1 != sscanf(hdr_ima_sig + strlen("x-debuginfod-imasignature:"), "%ms", &sig_buf)) - { diff --git a/elfutils-0.192-libelf-static.patch b/elfutils-0.192-libelf-static.patch deleted file mode 100644 index 799cfb4..0000000 --- a/elfutils-0.192-libelf-static.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0a65a54593ae489d40cb993caa74095d45bc47fd Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -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/bugzilla/show_bug.cgi?id=32293 - -Signed-off-by: Mark Wielaard ---- - libelf/Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libelf/Makefile.am b/libelf/Makefile.am -index 3402863e..2d3dbdf2 100644 ---- 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.47.0 - diff --git a/elfutils-0.192-more-dwarf5-lang.patch b/elfutils-0.192-more-dwarf5-lang.patch deleted file mode 100644 index 2aa0d3b..0000000 --- a/elfutils-0.192-more-dwarf5-lang.patch +++ /dev/null @@ -1,204 +0,0 @@ -commit 04ba163e813f6b88da850c658a03ac7b5f19f7ad -Author: Mark Wielaard -Date: Fri Nov 22 18:17:29 2024 +0100 - - libdw: Update DW_LANG codes - - Pick up the language codes published after DWARF5 was published. - The are listed at https://dwarfstd.org/languages.html - - Also adjust C language dectection in dwarf_getfuncs and update the - dwarf_default_lower_bound function to return the default lower bounds - for the new langauge codes. - - There is one small change in dwarf_default_lower_bound. We now return - zero instead of an error when called for DW_LANG_Mips_Assembler. Since - there is now an "official" DW_LANG_Assembly which is explicitly - defined as having a default lower bound of zero. It seems better to do - the same for the vendor code too. - - * libdw/dwarf.h: Add new DW_LANG codes. - * libdw/dwarf_default_lower_bound.c (dwarf_default_lower_bound): - Handle new language codes and remove a special case for - DW_LANG_Mips_Assembler. - * libdw/dwarf_getfuncs.c (dwarf_getfuncs): Check against - DW_LANG_C17 and DW_LANG_C23. - * tests/dwarf_default_lower_bound.c: Also check for - DW_LANG_Mips_Assembler. - - Signed-off-by: Mark Wielaard - -diff --git a/libdw/dwarf.h b/libdw/dwarf.h -index 4be32de5a67d..573ffd6925b2 100644 ---- a/libdw/dwarf.h -+++ b/libdw/dwarf.h -@@ -1,5 +1,6 @@ - /* This file defines standard DWARF types, structures, and macros. - Copyright (C) 2000-2011, 2014, 2016, 2017, 2018 Red Hat, Inc. -+ Copyright (C) 2024 Mark J. Wielaard - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -697,7 +698,11 @@ enum - }; - - --/* DWARF language encodings. */ -+/* DWARF language encodings. -+ -+ See https://dwarfstd.org/languages.html for language code published -+ after DWARF5 was published (but before DWARF6 has been released, -+ which will introduce a new DW_AT_language_name/version scheme). */ - enum - { - DW_LANG_C89 = 0x0001, /* ISO C:1989 */ -@@ -738,6 +743,35 @@ enum - DW_LANG_RenderScript = 0x0024, /* RenderScript Kernal Language */ - DW_LANG_BLISS = 0x0025, /* BLISS */ - -+ DW_LANG_Kotlin = 0x0026, /* Kotlin */ -+ DW_LANG_Zig = 0x0027, /* Zig */ -+ DW_LANG_Crystal = 0x0028, /* Crystal */ -+ DW_LANG_C_plus_plus_17 = 0x002a, /* ISO C++:2017 */ -+ DW_LANG_C_plus_plus_20 = 0x002b, /* ISO C++:2018 */ -+ DW_LANG_C17 = 0x002c, /* ISO C:2017 */ -+ DW_LANG_Fortran18 = 0x002d, /* ISO/IEC 1539-1:2018 */ -+ DW_LANG_Ada2005 = 0x002e, /* ISO Ada:2005 */ -+ DW_LANG_Ada2012 = 0x002f, /* ISO Ada:2005 */ -+ DW_LANG_HIP = 0x0030, /* HIP */ -+ DW_LANG_Assembly = 0x0031, /* Assembly */ -+ DW_LANG_C_sharp = 0x0032, /* C# */ -+ DW_LANG_Mojo = 0x0033, /* Mojo */ -+ DW_LANG_GLSL = 0x0034, /* OpenGL Shading Language */ -+ DW_LANG_GLSL_ES = 0x0035, /* OpenGL ES Shading Language */ -+ DW_LANG_HLSL = 0x0036, /* High-Level Shading Language */ -+ DW_LANG_OpenCL_CPP = 0x0037, /* OpenCL C++ */ -+ DW_LANG_CPP_for_OpenCL = 0x0038, /* C++ for OpenCL */ -+ DW_LANG_SYCL = 0x0039, /* SYCL */ -+ DW_LANG_C_plus_plus_23 = 0x003a, /* ISO C++:2023 */ -+ DW_LANG_Odin = 0x003b, /* Odin */ -+ DW_LANG_P4 = 0x003c, /* P4 */ -+ DW_LANG_Metal = 0x003d, /* Metal */ -+ DW_LANG_C23 = 0x003e, /* ISO C:2023 */ -+ DW_LANG_Fortran23 = 0x003f, /* ISO/IEC 1539-1:2023 */ -+ DW_LANG_Ruby = 0x0040, /* Ruby */ -+ DW_LANG_Move = 0x0041, /* Move */ -+ DW_LANG_Hylo = 0x0042, /* Hylo */ -+ - DW_LANG_lo_user = 0x8000, - DW_LANG_Mips_Assembler = 0x8001, /* Assembler */ - DW_LANG_hi_user = 0xffff -diff --git a/libdw/dwarf_default_lower_bound.c b/libdw/dwarf_default_lower_bound.c -index a33a34335b1b..50639e32428e 100644 ---- a/libdw/dwarf_default_lower_bound.c -+++ b/libdw/dwarf_default_lower_bound.c -@@ -1,5 +1,6 @@ - /* Get the default subrange lower bound for a given language. - Copyright (C) 2016 Red Hat, Inc. -+ Copyright (C) 2024 Mark J. Wielaard - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -63,6 +64,30 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result) - case DW_LANG_Dylan: - case DW_LANG_RenderScript: - case DW_LANG_BLISS: -+ case DW_LANG_Kotlin: -+ case DW_LANG_Zig: -+ case DW_LANG_Crystal: -+ case DW_LANG_C_plus_plus_17: -+ case DW_LANG_C_plus_plus_20: -+ case DW_LANG_C17: -+ case DW_LANG_HIP: -+ case DW_LANG_Assembly: -+ case DW_LANG_C_sharp: -+ case DW_LANG_Mojo: -+ case DW_LANG_GLSL: -+ case DW_LANG_GLSL_ES: -+ case DW_LANG_HLSL: -+ case DW_LANG_OpenCL_CPP: -+ case DW_LANG_CPP_for_OpenCL: -+ case DW_LANG_SYCL: -+ case DW_LANG_C_plus_plus_23: -+ case DW_LANG_Odin: -+ case DW_LANG_P4: -+ case DW_LANG_Metal: -+ case DW_LANG_C23: -+ case DW_LANG_Ruby: -+ case DW_LANG_Move: -+ case DW_LANG_Hylo: - *result = 0; - return 0; - -@@ -80,9 +105,18 @@ dwarf_default_lower_bound (int lang, Dwarf_Sword *result) - case DW_LANG_Modula3: - case DW_LANG_PLI: - case DW_LANG_Julia: -+ case DW_LANG_Fortran18: -+ case DW_LANG_Ada2005: -+ case DW_LANG_Ada2012: -+ case DW_LANG_Fortran23: - *result = 1; - return 0; - -+ /* Special case vendor Assembly variant. */ -+ case DW_LANG_Mips_Assembler: -+ *result = 0; -+ return 0; -+ - default: - __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE); - return -1; -diff --git a/libdw/dwarf_getfuncs.c b/libdw/dwarf_getfuncs.c -index b95f06f403d1..f6968f0081d4 100644 ---- a/libdw/dwarf_getfuncs.c -+++ b/libdw/dwarf_getfuncs.c -@@ -1,5 +1,6 @@ - /* Get function information. - Copyright (C) 2005, 2013, 2015 Red Hat, Inc. -+ Copyright (C) 2024 Mark J. Wielaard - This file is part of elfutils. - Written by Ulrich Drepper , 2005. - -@@ -104,7 +105,9 @@ dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *), - bool c_cu = (lang == DW_LANG_C89 - || lang == DW_LANG_C - || lang == DW_LANG_C99 -- || lang == DW_LANG_C11); -+ || lang == DW_LANG_C11 -+ || lang == DW_LANG_C17 -+ || lang == DW_LANG_C23); - - struct visitor_info v = { callback, arg, (void *) offset, NULL, c_cu }; - struct Dwarf_Die_Chain chain = { .die = CUDIE (cudie->cu), -diff --git a/tests/dwarf_default_lower_bound.c b/tests/dwarf_default_lower_bound.c -index d57424fc77fe..46e26f885a6b 100644 ---- a/tests/dwarf_default_lower_bound.c -+++ b/tests/dwarf_default_lower_bound.c -@@ -1,6 +1,7 @@ - /* Test all DW_LANG constants are handled by dwarf_default_lower_bound. - - Copyright (C) 2016 Red Hat, Inc. -+ Copyright (C) 2024 Mark J. Wielaard - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -34,18 +35,6 @@ test_lang (const char *name, int lang) - Dwarf_Sword low; - int res = dwarf_default_lower_bound (lang, &low); - -- /* Assembler is special, it doesn't really have arrays. */ -- if (lang == DW_LANG_Mips_Assembler) -- { -- if (res == 0) -- { -- printf ("%s shouldn't have a known lower bound\n", name); -- exit (-1); -- } -- printf ("%s: \n", name); -- return; -- } -- - if (res != 0) - { - printf ("dwarf_default_lower_bound failed (%d) for %s\n", res, name); diff --git a/elfutils-0.192-stacktrace-lto.patch b/elfutils-0.192-stacktrace-lto.patch deleted file mode 100644 index 9f110f8..0000000 --- a/elfutils-0.192-stacktrace-lto.patch +++ /dev/null @@ -1,35 +0,0 @@ -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-0.192-strip-ignore-non-ET_REL.patch b/elfutils-0.192-strip-ignore-non-ET_REL.patch deleted file mode 100644 index bef6ca6..0000000 --- a/elfutils-0.192-strip-ignore-non-ET_REL.patch +++ /dev/null @@ -1,48 +0,0 @@ -From e425a70469436c704e6c24dd4bc2abb8fb24b61d Mon Sep 17 00:00:00 2001 -From: Aaron Merey -Date: Tue, 5 Nov 2024 17:41:26 -0500 -Subject: [PATCH] strip: Ignore --reloc-debug-sections-only for non-ET_REL - files. - -strip --reloc-debug-sections-only is expected to be a no-op for -non-ET_REL files. This was not enforced in the code. Sections -were copied over to a new output file and normally its contents -would be identical to the input file. - -However the output file is not identical to a non-ET_REL input -file if the linker organized sections such that the indices of -SHF_ALLOC sections are not in a contigous group. - -In this case strip will modify sections in order to keep all SHF_ALLOC -sections in a contiguous group. - -Fix this by ignoring --reloc-debug-sections-only for non-ET_REL files. - -https://sourceware.org/bugzilla/show_bug.cgi?id=32253 - -Signed-off-by: Aaron Merey ---- - src/strip.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/strip.c b/src/strip.c -index 403e0f6f..3812fb17 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -1139,6 +1139,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - - if (reloc_debug_only) - { -+ if (ehdr->e_type != ET_REL) -+ { -+ /* Only ET_REL files can have debug relocations to remove. */ -+ error (0, 0, _("Ignoring --reloc-debug-sections-only for " \ -+ "non-ET_REL file '%s'"), fname); -+ goto fail_close; -+ } - if (handle_debug_relocs (elf, ebl, newelf, ehdr, fname, shstrndx, - &lastsec_offset, &lastsec_size) != 0) - { --- -2.47.0 - diff --git a/elfutils.spec b/elfutils.spec index 281eb0f..a220b32 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -3,8 +3,8 @@ %bcond_with static Name: elfutils -Version: 0.192 -%global baserelease 9 +Version: 0.193 +%global baserelease 1 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -97,30 +97,6 @@ BuildRequires: gettext-devel # For s390x... FDO package notes are bogus. Patch1: elfutils-0.186-fdo-swap.patch -# Include libeu.a objects in libelf.a for static linking. -Patch2: elfutils-0.192-libelf-static.patch - -# Fix eu-stacktrace build with lto enabled. -Patch3: elfutils-0.192-stacktrace-lto.patch - -# Fix ENABLE_IMA_VERIFICATION always evaluating to false. -Patch4: elfutils-0.192-fix-configure-conditional.patch - -# Fix empty glob error on zsh. -Patch5: elfutils-0.192-fix-zsh-profile.patch - -# Fix testsuite failure caused by ld changes. -Patch6: elfutils-0.192-strip-ignore-non-ET_REL.patch - -# In c23 ATOMIC_VAR_INIT has been removed -Patch7: elfutils-0.192-ATOMIC_VAR_INIT.patch - -# New DWARF5 language constants -Patch8: elfutils-0.192-more-dwarf5-lang.patch - -# debuginfod-client.c: Avoid freeing uninitialized value -patch9: elfutils-0.192-imasig-fail-free.patch - %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -541,6 +517,18 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Mon Apr 28 2025 Aaron Merey - 0.193-1 +- Upgrade to upstream elfutils 0.193 +- Drop upstreamed patches + elfutils-0.192-ATOMIC_VAR_INIT.patch + elfutils-0.192-libelf-static.patch + elfutils-0.192-fix-configure-conditional.patch + elfutils-0.192-more-dwarf5-lang.patch + elfutils-0.192-fix-zsh-profile.patch + elfutils-0.192-stacktrace-lto.patch + elfutils-0.192-imasig-fail-free.patch + elfutils-0.192-strip-ignore-non-ET_REL.patch + * Sun Feb 23 2025 Mark Wielaard - 0.192-9 - Add elfutils-0.192-imasig-fail-free.patch diff --git a/sources b/sources index 52f4826..7c1ca7e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (elfutils-0.192.tar.bz2) = 543188f5f2cfe5bc7955a878416c5f252edff9926754e5de0c6c57b132f21d9285c9b29e41281e93baad11d4ae7efbbf93580c114579c182103565fe99bd3909 +SHA512 (elfutils-0.193.tar.bz2) = 557e328e3de0d2a69d09c15a9333f705f3233584e2c6a7d3ce855d06a12dc129e69168d6be64082803630397bd64e1660a8b5324d4f162d17922e10ddb367d76 From 6d89dc3f7ea5dc28c5b1d50b5596662d6555f75a Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Wed, 30 Apr 2025 08:38:12 -0400 Subject: [PATCH 08/13] Include libdwfl_stacktrace.h when building eu-stacktrace --- elfutils.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elfutils.spec b/elfutils.spec index a220b32..fb4094a 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -432,6 +432,9 @@ fi %{_includedir}/elfutils/libdwfl.h %{_includedir}/elfutils/libdwelf.h %{_includedir}/elfutils/version.h +%if %{enable_stacktrace} +%{_includedir}/elfutils/libdwfl_stacktrace.h +%endif %{_libdir}/libasm.so %{_libdir}/libdw.so %{_libdir}/pkgconfig/libdw.pc From 1e730db939dd7ab34e5f5142ceff6cb6f5ea2433 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Wed, 30 Apr 2025 08:54:03 -0400 Subject: [PATCH 09/13] 0.193-2 Include libdwfl_stacktrace.h unconditionally --- elfutils.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/elfutils.spec b/elfutils.spec index fb4094a..f677ca3 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -432,9 +432,7 @@ fi %{_includedir}/elfutils/libdwfl.h %{_includedir}/elfutils/libdwelf.h %{_includedir}/elfutils/version.h -%if %{enable_stacktrace} %{_includedir}/elfutils/libdwfl_stacktrace.h -%endif %{_libdir}/libasm.so %{_libdir}/libdw.so %{_libdir}/pkgconfig/libdw.pc From accba9105dc16f095930fe2a75aef0f559ccca65 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Wed, 30 Apr 2025 08:56:27 -0400 Subject: [PATCH 10/13] Bump release version --- elfutils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elfutils.spec b/elfutils.spec index f677ca3..0a545aa 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.193 -%global baserelease 1 +%global baserelease 2 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ From d93e194c37525d17f6c497b6712a56bf0f971598 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 19:47:24 +0000 Subject: [PATCH 11/13] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- elfutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elfutils.spec b/elfutils.spec index 0a545aa..6c79016 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.193 -%global baserelease 2 +%global baserelease 3 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -518,6 +518,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 0.193-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Apr 28 2025 Aaron Merey - 0.193-1 - Upgrade to upstream elfutils 0.193 - Drop upstreamed patches From 77509c6ab099e628f22724f74c09bdf78e92cad5 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Tue, 28 Oct 2025 16:10:55 -0400 Subject: [PATCH 12/13] 0.194-1 - Upgrade to upstream elfutils 0.194 - Add elfutils-0.194-alloc-jobs.patch --- .gitignore | 1 + elfutils-0.194-alloc-jobs.patch | 135 ++++++++++++++++++++++++++++++++ elfutils.spec | 12 ++- sources | 2 +- 4 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 elfutils-0.194-alloc-jobs.patch diff --git a/.gitignore b/.gitignore index a406bd1..6aac4df 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ /elfutils-0.191.tar.bz2 /elfutils-0.192.tar.bz2 /elfutils-0.193.tar.bz2 +/elfutils-0.194.tar.bz2 diff --git a/elfutils-0.194-alloc-jobs.patch b/elfutils-0.194-alloc-jobs.patch new file mode 100644 index 0000000..cabf590 --- /dev/null +++ b/elfutils-0.194-alloc-jobs.patch @@ -0,0 +1,135 @@ +From f66135f16fe44182a3fc5b651d7e5071c936217d Mon Sep 17 00:00:00 2001 +From: Aaron Merey +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 +--- + 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.51.0 + diff --git a/elfutils.spec b/elfutils.spec index 6c79016..cbd3bf3 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -3,8 +3,8 @@ %bcond_with static Name: elfutils -Version: 0.193 -%global baserelease 3 +Version: 0.194 +%global baserelease 1 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -97,6 +97,9 @@ BuildRequires: gettext-devel # For s390x... FDO package notes are bogus. Patch1: elfutils-0.186-fdo-swap.patch +# Prevent assert failure in readelf for some -ggdb3 binaries. +Patch2: elfutils-0.194-alloc-jobs.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -457,6 +460,7 @@ fi %{_mandir}/man3/elf_*.3* %{_mandir}/man3/elf32_*.3* %{_mandir}/man3/elf64_*.3* +%{_mandir}/man3/gelf_*.3* %{_mandir}/man3/libelf.3* %if %{with static} @@ -518,6 +522,10 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Tue Oct 28 2025 Aaron Merey - 0.194-1 +- Upgrade to upstream elfutils 0.194 +- Add elfutils-0.194-alloc-jobs.patch + * Wed Jul 23 2025 Fedora Release Engineering - 0.193-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index 7c1ca7e..bd25645 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (elfutils-0.193.tar.bz2) = 557e328e3de0d2a69d09c15a9333f705f3233584e2c6a7d3ce855d06a12dc129e69168d6be64082803630397bd64e1660a8b5324d4f162d17922e10ddb367d76 +SHA512 (elfutils-0.194.tar.bz2) = 5d00502f61b92643bf61dc61da4ddded36c423466388d992bcd388c5208761b8ed9db1a01492c085cd0984eef30c08f895a8e307e78e0df8df40b56ae35b78a5 From fe811227810613065ff5d02ef25edcc82ddae288 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Tue, 9 Dec 2025 10:23:48 -0500 Subject: [PATCH 13/13] 0.194-2 Add elfutils-0.194-fix-const.patch --- elfutils-0.194-fix-const.patch | 301 +++++++++++++++++++++++++++++++++ elfutils.spec | 8 +- 2 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.194-fix-const.patch diff --git a/elfutils-0.194-fix-const.patch b/elfutils-0.194-fix-const.patch new file mode 100644 index 0000000..085f899 --- /dev/null +++ b/elfutils-0.194-fix-const.patch @@ -0,0 +1,301 @@ +From 4a5cf8be906d5991e7527e69e3f2ceaa74811301 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Mon, 24 Nov 2025 13:46:16 +0100 +Subject: [PATCH] Fix const-correctness issues + +These were uncovered by the C23 const-preserving library macros. +--- + debuginfod/debuginfod-client.c | 2 +- + libcpu/riscv_disasm.c | 52 +++++++++++++++++----------------- + libdw/dwarf_getsrclines.c | 6 ++-- + src/readelf.c | 8 +++--- + 4 files changed, 34 insertions(+), 34 deletions(-) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index c0ff5967..c5bc8a4f 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -3104,7 +3104,7 @@ int debuginfod_add_http_header (debuginfod_client *client, const char* header) + /* Sanity check header value is of the form Header: Value. + It should contain at least one colon that isn't the first or + last character. */ +- char *colon = strchr (header, ':'); /* first colon */ ++ const char *colon = strchr (header, ':'); /* first colon */ + if (colon == NULL /* present */ + || colon == header /* not at beginning - i.e., have a header name */ + || *(colon + 1) == '\0') /* not at end - i.e., have a value */ +diff --git a/libcpu/riscv_disasm.c b/libcpu/riscv_disasm.c +index 0dee842a..749d4567 100644 +--- a/libcpu/riscv_disasm.c ++++ b/libcpu/riscv_disasm.c +@@ -77,7 +77,7 @@ static const char *regnames[32] = + "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7", + "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6" + }; +-#define REG(nr) ((char *) regnames[nr]) ++#define REG(nr) regnames[nr] + #define REGP(nr) REG (8 + (nr)) + + +@@ -88,7 +88,7 @@ static const char *fregnames[32] = + "fa6", "fa7", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7", + "fs8", "fs9", "fs10", "fs11", "ft8", "ft9", "ft10", "ft11" + }; +-#define FREG(nr) ((char *) fregnames[nr]) ++#define FREG(nr) fregnames[nr] + #define FREGP(nr) FREG (8 + (nr)) + + +@@ -163,12 +163,12 @@ riscv_disasm (Ebl *ebl, + break; + } + +- char *mne = NULL; ++ const char *mne = NULL; + /* Max length is 24, which is "illegal", so we print it as + "0x<48 hex chars>" + See: No instruction encodings defined for these sizes yet, below */ + char mnebuf[50]; +- char *op[5] = { NULL, NULL, NULL, NULL, NULL }; ++ const char *op[5] = { NULL, NULL, NULL, NULL, NULL }; + char immbuf[32]; + size_t len; + char *strp = NULL; +@@ -400,7 +400,7 @@ riscv_disasm (Ebl *ebl, + { + "sub", "xor", "or", "and", "subw", "addw", NULL, NULL + }; +- mne = (char *) arithmne[((first >> 10) & 0x4) | ((first >> 5) & 0x3)]; ++ mne = arithmne[((first >> 10) & 0x4) | ((first >> 5) & 0x3)]; + } + op[0] = op[1] = REGP ((first >> 7) & 0x7); + break; +@@ -572,7 +572,7 @@ riscv_disasm (Ebl *ebl, + { + NULL, NULL, "flw", "fld", "flq", NULL, NULL, NULL + }; +- mne = (char *) (idx == 0x00 ? loadmne[func] : floadmne[func]); ++ mne = idx == 0x00 ? loadmne[func] : floadmne[func]; + break; + case 0x03: + // MISC-MEM +@@ -595,8 +595,8 @@ riscv_disasm (Ebl *ebl, + uint32_t succ = (word >> 24) & 0xf; + if (pred != 0xf || succ != 0xf) + { +- op[0] = (char *) order[succ]; +- op[1] = (char *) order[pred]; ++ op[0] = order[succ]; ++ op[1] = order[pred]; + } + mne = "fence"; + } +@@ -614,7 +614,7 @@ riscv_disasm (Ebl *ebl, + "addi", NULL, "slti", "sltiu", "xori", NULL, "ori", "andi" + }; + func = (word >> 12) & 0x7; +- mne = (char *) opimmmne[func]; ++ mne = opimmmne[func]; + if (mne == NULL) + { + const uint64_t shiftmask = ebl->class == ELFCLASS32 ? 0x1f : 0x3f; +@@ -697,7 +697,7 @@ riscv_disasm (Ebl *ebl, + { + NULL, NULL, "fsw", "fsd", "fsq", NULL, NULL, NULL + }; +- mne = (char *) (idx == 0x08 ? storemne[func] : fstoremne[func]); ++ mne = idx == 0x08 ? storemne[func] : fstoremne[func]; + break; + case 0x0b: + // AMO +@@ -778,7 +778,7 @@ riscv_disasm (Ebl *ebl, + } + else + { +- mne = (char *) (idx == 0x0c ? arithmne2[func] : arithmne3[func]); ++ mne = idx == 0x0c ? arithmne2[func] : arithmne3[func]; + op[1] = REG (rs1); + op[2] = REG (rs2); + } +@@ -811,7 +811,7 @@ riscv_disasm (Ebl *ebl, + op[2] = FREG (rs2); + op[3] = FREG (rs3); + if (rm != 0x7) +- op[4] = (char *) rndmode[rm]; ++ op[4] = rndmode[rm]; + } + break; + case 0x14: +@@ -839,7 +839,7 @@ riscv_disasm (Ebl *ebl, + op[1] = FREG (rs1); + op[2] = FREG (rs2); + if (rm != 0x7) +- op[3] = (char *) rndmode[rm]; ++ op[3] = rndmode[rm]; + } + else if (func == 0x1c && width != 2 && rs2 == 0 && rm <= 1) + { +@@ -950,7 +950,7 @@ riscv_disasm (Ebl *ebl, + } + mne = mnebuf; + if (rm != 0x7 && (func == 0x18 || width == 0 || rs2 >= 2)) +- op[2] = (char *) rndmode[rm]; ++ op[2] = rndmode[rm]; + } + else if (func == 0x0b && rs2 == 0) + { +@@ -961,7 +961,7 @@ riscv_disasm (Ebl *ebl, + *cp = '\0'; + mne = mnebuf; + if (rm != 0x7) +- op[2] = (char *) rndmode[rm]; ++ op[2] = rndmode[rm]; + } + else if (func == 0x05 && rm < 2) + { +@@ -1007,7 +1007,7 @@ riscv_disasm (Ebl *ebl, + "beq", "bne", NULL, NULL, "blt", "bge", "bltu", "bgeu" + }; + func = (word >> 12) & 0x7; +- mne = (char *) branchmne[func]; ++ mne = branchmne[func]; + if (rs1 == 0 && func == 5) + { + op[0] = op[1]; +@@ -1035,7 +1035,7 @@ riscv_disasm (Ebl *ebl, + else if (func == 5 || func == 7) + { + // binutils use these opcodes and the reverse parameter order +- char *tmp = op[0]; ++ const char *tmp = op[0]; + op[0] = op[1]; + op[1] = tmp; + mne = func == 5 ? "ble" : "bleu"; +@@ -1103,7 +1103,7 @@ riscv_disasm (Ebl *ebl, + { + NULL, "frflags", "frrm", "frsr", + }; +- mne = (char *) unprivrw[csr - 0x000]; ++ mne = unprivrw[csr - 0x000]; + } + else if (csr >= 0xc00 && csr <= 0xc03) + { +@@ -1111,7 +1111,7 @@ riscv_disasm (Ebl *ebl, + { + "rdcycle", "rdtime", "rdinstret" + }; +- mne = (char *) unprivrolow[csr - 0xc00]; ++ mne = unprivrolow[csr - 0xc00]; + } + op[0] = REG ((word >> 7) & 0x1f); + } +@@ -1128,7 +1128,7 @@ riscv_disasm (Ebl *ebl, + { + NULL, "fsflagsi", "fsrmi", NULL + }; +- mne = (char *) ((word & 0x4000) == 0 ? unprivrs : unprivrsi)[csr - 0x000]; ++ mne = ((word & 0x4000) == 0 ? unprivrs : unprivrsi)[csr - 0x000]; + + if ((word & 0x4000) == 0) + op[0] = REG ((word >> 15) & 0x1f); +@@ -1259,12 +1259,12 @@ riscv_disasm (Ebl *ebl, + if (rd != 0) + op[last++] = REG (rd); + struct known_csrs key = { csr, NULL }; +- struct known_csrs *found = bsearch (&key, known, +- sizeof (known) / sizeof (known[0]), +- sizeof (known[0]), +- compare_csr); ++ const struct known_csrs *found = bsearch (&key, known, ++ sizeof (known) / sizeof (known[0]), ++ sizeof (known[0]), ++ compare_csr); + if (found) +- op[last] = (char *) found->name; ++ op[last] = found->name; + else + { + snprintf (addrbuf, sizeof (addrbuf), "0x%" PRIx32, csr); +@@ -1289,7 +1289,7 @@ riscv_disasm (Ebl *ebl, + else if (instr == 3 && rd == 0) + mne = "csrc"; + else +- mne = (char *) mnecsr[instr]; ++ mne = mnecsr[instr]; + } + break; + default: +diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c +index be10cdee..76db2929 100644 +--- a/libdw/dwarf_getsrclines.c ++++ b/libdw/dwarf_getsrclines.c +@@ -364,7 +364,7 @@ read_srcfiles (Dwarf *dbg, + const unsigned char *dirp = linep; + while (dirp < lineendp && *dirp != 0) + { +- uint8_t *endp = memchr (dirp, '\0', lineendp - dirp); ++ const uint8_t *endp = memchr (dirp, '\0', lineendp - dirp); + if (endp == NULL) + goto invalid_data; + ++ndirs; +@@ -440,7 +440,7 @@ read_srcfiles (Dwarf *dbg, + for (unsigned int n = 1; n < ndirlist; n++) + { + dirarray[n].dir = (char *) linep; +- uint8_t *endp = memchr (linep, '\0', lineendp - linep); ++ const uint8_t *endp = memchr (linep, '\0', lineendp - linep); + assert (endp != NULL); // Checked above when calculating ndirlist. + dirarray[n].len = endp - linep; + linep = endp + 1; +@@ -927,7 +927,7 @@ read_srclines (Dwarf *dbg, + case DW_LNE_define_file: + { + char *fname = (char *) linep; +- uint8_t *endp = memchr (linep, '\0', lineendp - linep); ++ const uint8_t *endp = memchr (linep, '\0', lineendp - linep); + if (endp == NULL) + goto invalid_data; + size_t fnamelen = endp - linep; +diff --git a/src/readelf.c b/src/readelf.c +index a2d17358..fbdf8c71 100644 +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -8269,7 +8269,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) + valuestr = dwarf_filesrc (files, num, NULL, NULL); + if (valuestr != NULL) + { +- char *filename = strrchr (valuestr, '/'); ++ const char *filename = strrchr (valuestr, '/'); + if (filename != NULL) + valuestr = filename + 1; + } +@@ -9033,7 +9033,7 @@ print_form_data (Dwarf *dbg, int form, const unsigned char *readp, + Dwarf_Off str_offsets_base, FILE *out) + { + Dwarf_Word val; +- unsigned char *endp; ++ const unsigned char *endp; + Elf_Data *data; + char *str; + switch (form) +@@ -9530,7 +9530,7 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, + { + while (linep < lineendp && *linep != 0) + { +- unsigned char *endp = memchr (linep, '\0', lineendp - linep); ++ const unsigned char *endp = memchr (linep, '\0', lineendp - linep); + if (unlikely (endp == NULL)) + goto invalid_unit; + +@@ -9764,7 +9764,7 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, + case DW_LNE_define_file: + { + char *fname = (char *) linep; +- unsigned char *endp = memchr (linep, '\0', ++ const unsigned char *endp = memchr (linep, '\0', + lineendp - linep); + if (unlikely (endp == NULL)) + goto invalid_unit; +-- +2.52.0 + diff --git a/elfutils.spec b/elfutils.spec index cbd3bf3..803a824 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -4,7 +4,7 @@ Name: elfutils Version: 0.194 -%global baserelease 1 +%global baserelease 2 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -100,6 +100,9 @@ Patch1: elfutils-0.186-fdo-swap.patch # Prevent assert failure in readelf for some -ggdb3 binaries. Patch2: elfutils-0.194-alloc-jobs.patch +# Fix const warning from newer GCC. +Patch3: elfutils-0.194-fix-const.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -522,6 +525,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Tue Dec 09 2025 Aaron Merey - 0.194-2 +- Add elfutils-0.194-fix-const.patch + * Tue Oct 28 2025 Aaron Merey - 0.194-1 - Upgrade to upstream elfutils 0.194 - Add elfutils-0.194-alloc-jobs.patch