diff --git a/.gitignore b/.gitignore index f4ae54b..cd162f4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ /debugedit-5.0.tar.xz.sig /debugedit-5.1.tar.xz /debugedit-5.1.tar.xz.sig +/debugedit-5.3.tar.xz +/debugedit-5.3.tar.xz.sig diff --git a/0001-Add-basic-find-debuginfo-script-tests.patch b/0001-Add-basic-find-debuginfo-script-tests.patch deleted file mode 100644 index 50dbf92..0000000 --- a/0001-Add-basic-find-debuginfo-script-tests.patch +++ /dev/null @@ -1,434 +0,0 @@ -From f1cdc73f78a2f9b6499b4a5462485a873d9620af Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 12 Jun 2025 23:27:50 +0200 -Subject: [PATCH] Add basic find-debuginfo script tests - -Covers basic find-debuginfo script functionality. Checks .debug files -are generated by eu-strip, .gnu_debugdata is generated, .gdb_index is -added by gdb-add-index, dwz multi file is created and all debugsources -are found, also does parallel runs. Skips dwz testing if .debug_addr -is generated (since dwz currently doesn't handle that). - - * configure.ac: Check whether -gdwarf-5 produced DWARF5 .debug_addr. - * tests/atlocal.in: Add DWARF_5_DEBUGADDR. - * tests/Makefile.am (TESTSUITE_AT): Add find-debuginfo.at. - * tests/testsuite.at: m4_include find-debuginfo.at. - * tests/find-debuginfo.at: New test file. - -Signed-off-by: Mark Wielaard ---- - configure.ac | 13 ++ - tests/Makefile.am | 3 +- - tests/atlocal.in | 1 + - tests/find-debuginfo.at | 341 ++++++++++++++++++++++++++++++++++++++++ - tests/testsuite.at | 1 + - 5 files changed, 358 insertions(+), 1 deletion(-) - create mode 100644 tests/find-debuginfo.at - -diff --git a/configure.ac b/configure.ac -index ad4d70c63995..e48fa828c9db 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -125,6 +125,19 @@ CFLAGS="$save_CFLAGS" - DWARF_5_DEBUGLINE=$ac_cv_dwarf_5_debugline - AC_SUBST([DWARF_5_DEBUGLINE]) - -+AC_CACHE_CHECK([whether -gdwarf-5 produced DWARF5 .debug_addr], ac_cv_dwarf_5_debugaddr, [dnl -+save_CFLAGS="$CFLAGS" -+CFLAGS="-gdwarf-5" -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i=0;]],[[/* empty main */]])], -+ [if $READELF -S conftest.o 2>&1 | grep -F ".debug_addr" > /dev/null 2>&1; \ -+ then ac_cv_dwarf_5_debugaddr=yes; \ -+ else ac_cv_dwarf_5_debugaddr=no; fi], -+ ac_cv_dwarf_5_debugaddr=no) -+CFLAGS="$save_CFLAGS" -+]) -+DWARF_5_DEBUGADDR=$ac_cv_dwarf_5_debugaddr -+AC_SUBST([DWARF_5_DEBUGADDR]) -+ - AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="-gz=none" -diff --git a/tests/Makefile.am b/tests/Makefile.am -index b1d39f4ac1fc..7fab084f31f2 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -32,7 +32,8 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac - # The tests - TESTSUITE_AT = \ - testsuite.at \ -- debugedit.at -+ debugedit.at \ -+ find-debuginfo.at - - # Some source files that are needed by the tests - EXTRA_DIST += data/SOURCES/foo.c \ -diff --git a/tests/atlocal.in b/tests/atlocal.in -index 9da28786ba26..e9bd31fe3f13 100644 ---- a/tests/atlocal.in -+++ b/tests/atlocal.in -@@ -16,4 +16,5 @@ GDWARF_5_FLAG=@GDWARF_5_FLAG@ - GZ_NONE_FLAG=@GZ_NONE_FLAG@ - GZ_ZLIB_FLAG=@GZ_ZLIB_FLAG@ - DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@ -+DWARF_5_DEBUGADDR=@DWARF_5_DEBUGADDR@ - DEBUG_MACRO_FLAG=@DEBUG_MACRO_FLAG@ -diff --git a/tests/find-debuginfo.at b/tests/find-debuginfo.at -new file mode 100644 -index 000000000000..d6f6ae9ee07a ---- /dev/null -+++ b/tests/find-debuginfo.at -@@ -0,0 +1,341 @@ -+# find-debuginfo.at: Tests for the find-debuginfo script -+# -+# Copyright (C) 2025 Red Hat Inc. -+# Copyright (C) 2025 Mark J. Wielaard -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, see see . -+ -+# Tests for scripts/find-debuginfo.in -+AT_BANNER([find-debuginfo]) -+ -+# Show which find-debuginfo script we are testing -+AT_TESTED([find-debuginfo]) -+ -+# Helper to create some test binaries -+m4_define([FIND_DEBUGINFO_PKG_BUILD_SETUP],[[ -+mkdir subdir_build -+cp "${abs_srcdir}"/data/SOURCES/foo.c subdir_build -+cp "${abs_srcdir}"/data/SOURCES/bar.c subdir_build -+cp "${abs_srcdir}"/data/SOURCES/foobar.h subdir_build -+cp "${abs_srcdir}"/data/SOURCES/baz.c subdir_build -+cd subdir_build -+# Three almost identical binaries -+# so dwz has something to put into the alt file -+$CC $CFLAGS -g3 -I. -o foo foo.c bar.c baz.c -+$CC $CFLAGS -g3 -I. -o bar bar.c baz.c foo.c -+$CC $CFLAGS -g3 -I. -o baz baz.c foo.c bar.c -+cd .. -+]]) -+ -+# Check find-debuginfo --help doesn't crash and burn -+AT_SETUP([find-debuginfo help]) -+AT_KEYWORDS([find-debuginfo] [help]) -+AT_CHECK([find-debuginfo --help],[0],[ignore],[ignore]) -+AT_CLEANUP -+ -+# Run find-debuginfo on a small build without any fancy options -+AT_SETUP([find-debuginfo sources]) -+AT_KEYWORDS([find-debuginfo] [sources]) -+FIND_DEBUGINFO_PKG_BUILD_SETUP -+# Sanity check the binaries have debug sections -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [0], [ignore], []) -+# We need to set some environment variables for running find-debuginfo -+# normally set by rpmbuild. -+# -+# run debugedit and collect source files for binaries in subdir_build -+AT_CHECK([env RPM_BUILD_DIR=${PWD} \ -+ RPM_BUILD_ROOT=${PWD} \ -+ RPM_PACKAGE_NAME=pkg \ -+ RPM_PACKAGE_VERSION=ver \ -+ RPM_PACKAGE_RELEASE=rel \ -+ RPM_ARCH=arch \ -+ find-debuginfo ${PWD}/subdir_build], -+ [0], [stdout], []) -+# Make sure all three binaries are processed -+AT_CHECK([grep "Extracting debug info from 3 files" stdout], [0], [ignore], []) -+# debug sections should have been removed -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [1], [ignore], []) -+# Now there are .debug files with those .debug_ sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep debug_], -+ [0], [ignore], []) -+# Check all sources are listed in debugsources.list -+AT_DATA([expout], -+[subdir_build/ -+subdir_build/bar.c -+subdir_build/baz.c -+subdir_build/foo.c -+subdir_build/foobar.h -+]) -+AT_CHECK([cat subdir_build/debugsources.list | tr '\0' '\n' | sort -u], -+ [0], [expout], []) -+AT_CLEANUP -+ -+# Run find-debuginfo on a small build and check all parts ran -+AT_SETUP([find-debuginfo sources debugdata gdb-index]) -+AT_KEYWORDS([find-debuginfo] [sources] [debugdata] [gdb-index]) -+FIND_DEBUGINFO_PKG_BUILD_SETUP -+# Sanity check the binaries have debug sections -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [0], [ignore], []) -+# We need to set some environment variables for running find-debuginfo -+# normally set by rpmbuild. -+# -+# generate .gnu_debugdata (-m), .gdb_index (-i) for binaries in subdir_build. -+AT_CHECK([env RPM_BUILD_DIR=${PWD} \ -+ RPM_BUILD_ROOT=${PWD} \ -+ RPM_PACKAGE_NAME=pkg \ -+ RPM_PACKAGE_VERSION=ver \ -+ RPM_PACKAGE_RELEASE=rel \ -+ RPM_ARCH=arch \ -+ find-debuginfo -m -i ${PWD}/subdir_build], -+ [0], [stdout], []) -+# Make sure all three binaries are processed -+AT_CHECK([grep "Extracting debug info from 3 files" stdout], [0], [ignore], []) -+# debug sections should have been removed -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [1], [ignore], []) -+# But they now have a .gnu_debugdata section -+AT_CHECK([$READELF -S subdir_build/foo | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep gnu_debugdata], -+ [0], [ignore], []) -+# There are .debug files with those .debug_ sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep debug_], -+ [0], [ignore], []) -+# The .debug files should also have a .gdb_index sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep gdb_index], -+ [0], [ignore], []) -+# Check all sources are listed in debugsources.list -+AT_DATA([expout], -+[subdir_build/ -+subdir_build/bar.c -+subdir_build/baz.c -+subdir_build/foo.c -+subdir_build/foobar.h -+]) -+AT_CHECK([cat subdir_build/debugsources.list | tr '\0' '\n' | sort -u], -+ [0], [expout], []) -+AT_CLEANUP -+ -+# Run find-debuginfo on a small build and check all parts ran -+# Same as above but run in parallel (-j) -+AT_SETUP([find-debuginfo sources debugdata gdb-index jobs]) -+AT_KEYWORDS([find-debuginfo] [sources] [debugdata] [gdb-index] [jobs]) -+FIND_DEBUGINFO_PKG_BUILD_SETUP -+# Sanity check the binaries have debug sections -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [0], [ignore], []) -+# We need to set some environment variables for running find-debuginfo -+# normally set by rpmbuild. -+# -+# generate .gnu_debugdata (-m), .gdb_index (-i) for binaries in subdir_build. -+AT_CHECK([env RPM_BUILD_DIR=${PWD} \ -+ RPM_BUILD_ROOT=${PWD} \ -+ RPM_PACKAGE_NAME=pkg \ -+ RPM_PACKAGE_VERSION=ver \ -+ RPM_PACKAGE_RELEASE=rel \ -+ RPM_ARCH=arch \ -+ find-debuginfo -m -i -j6 ${PWD}/subdir_build], -+ [0], [stdout], []) -+# Make sure all three binaries are processed -+AT_CHECK([grep "Extracting debug info from 3 files" stdout], [0], [ignore], []) -+# debug sections should have been removed -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [1], [ignore], []) -+# But they now have a .gnu_debugdata section -+AT_CHECK([$READELF -S subdir_build/foo | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep gnu_debugdata], -+ [0], [ignore], []) -+# There are .debug files with those .debug_ sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep debug_], -+ [0], [ignore], []) -+# The .debug files should also have a .gdb_index sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep gdb_index], -+ [0], [ignore], []) -+# Check all sources are listed in debugsources.list -+AT_DATA([expout], -+[subdir_build/ -+subdir_build/bar.c -+subdir_build/baz.c -+subdir_build/foo.c -+subdir_build/foobar.h -+]) -+AT_CHECK([cat subdir_build/debugsources.list | tr '\0' '\n' | sort -u], -+ [0], [expout], []) -+AT_CLEANUP -+ -+# Run find-debuginfo on a small build and check all parts ran -+# Same as above, but now with dwz (but without -j) -+AT_SETUP([find-debuginfo sources debugdata gdb-index dwz]) -+AT_KEYWORDS([find-debuginfo] [sources] [debugdata] [gdb-index] [dwz]) -+# At the moment dwz doesn't support .debug_addr -+AT_SKIP_IF([test "$DWARF_5_DEBUGADDR" = "yes"]) -+FIND_DEBUGINFO_PKG_BUILD_SETUP -+# Sanity check the binaries have debug sections -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [0], [ignore], []) -+# We need to set some environment variables for running find-debuginfo -+# normally set by rpmbuild. -+# -+# generate .gnu_debugdata (-m), .gdb_index (-i) and run dwz (--run-dwz) -+# for binaries in subdir_build. -+AT_CHECK([env RPM_BUILD_DIR=${PWD} \ -+ RPM_BUILD_ROOT=${PWD} \ -+ RPM_PACKAGE_NAME=pkg \ -+ RPM_PACKAGE_VERSION=ver \ -+ RPM_PACKAGE_RELEASE=rel \ -+ RPM_ARCH=arch \ -+ find-debuginfo -m -i --run-dwz ${PWD}/subdir_build], -+ [0], [stdout], []) -+# Make sure all three binaries are processed -+AT_CHECK([grep "Extracting debug info from 3 files" stdout], [0], [ignore], []) -+AT_CHECK([grep "DWARF-compressing 3 files" stdout], [0], [ignore], []) -+# debug sections should have been removed -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [1], [ignore], []) -+# But they now have a .gnu_debugdata section -+AT_CHECK([$READELF -S subdir_build/foo | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep gnu_debugdata], -+ [0], [ignore], []) -+# There are .debug files with those .debug_ sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep debug_], -+ [0], [ignore], []) -+# The .debug files should also have a .gdb_index sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep gdb_index], -+ [0], [ignore], []) -+# There should also be a dwz multi file now -+AT_CHECK([test -f usr/lib/debug/.dwz/pkg-ver-rel.arch], [0], [], []) -+# Check all sources are listed in debugsources.list -+AT_DATA([expout], -+[subdir_build/ -+subdir_build/bar.c -+subdir_build/baz.c -+subdir_build/foo.c -+subdir_build/foobar.h -+]) -+AT_CHECK([cat subdir_build/debugsources.list | tr '\0' '\n' | sort -u], -+ [0], [expout], []) -+AT_CLEANUP -+ -+# Run find-debuginfo on a small build and check all parts ran -+# Same as above plus doing -j jobs -+AT_SETUP([find-debuginfo sources debugdata gdb-index dwz jobs]) -+AT_KEYWORDS([find-debuginfo] [sources] [debugdata] [gdb-index] [dwz] [jobs]) -+# At the moment dwz doesn't support .debug_addr -+AT_SKIP_IF([test "$DWARF_5_DEBUGADDR" = "yes"]) -+FIND_DEBUGINFO_PKG_BUILD_SETUP -+# Sanity check the binaries have debug sections -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [0], [ignore], []) -+# We need to set some environment variables for running find-debuginfo -+# normally set by rpmbuild. -+# -+# generate .gnu_debugdata (-m), .gdb_index (-i) and run dwz (--run-dwz) -+# in parallel (-j6) for binaries in subdir_build. -+AT_CHECK([env RPM_BUILD_DIR=${PWD} \ -+ RPM_BUILD_ROOT=${PWD} \ -+ RPM_PACKAGE_NAME=pkg \ -+ RPM_PACKAGE_VERSION=ver \ -+ RPM_PACKAGE_RELEASE=rel \ -+ RPM_ARCH=arch \ -+ find-debuginfo -m -i --run-dwz -j6 ${PWD}/subdir_build], -+ [0], [stdout], []) -+# Make sure all three binaries are processed -+AT_CHECK([grep "Extracting debug info from 3 files" stdout], [0], [ignore], []) -+AT_CHECK([grep "DWARF-compressing 3 files" stdout], [0], [ignore], []) -+# debug sections should have been removed -+AT_CHECK([$READELF -S subdir_build/foo | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep debug_], [1], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep debug_], [1], [ignore], []) -+# But they now have a .gnu_debugdata section -+AT_CHECK([$READELF -S subdir_build/foo | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/bar | grep gnu_debugdata], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S subdir_build/baz | grep gnu_debugdata], -+ [0], [ignore], []) -+# There are .debug files with those .debug_ sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep debug_], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep debug_], -+ [0], [ignore], []) -+# The .debug files should also have a .gdb_index sections -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/foo.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/bar.debug | grep gdb_index], -+ [0], [ignore], []) -+AT_CHECK([$READELF -S usr/lib/debug/subdir_build/baz.debug | grep gdb_index], -+ [0], [ignore], []) -+# There should also be a dwz multi file now -+AT_CHECK([test -f usr/lib/debug/.dwz/pkg-ver-rel.arch], [0], [], []) -+# Check all sources are listed in debugsources.list -+AT_DATA([expout], -+[subdir_build/ -+subdir_build/bar.c -+subdir_build/baz.c -+subdir_build/foo.c -+subdir_build/foobar.h -+]) -+AT_CHECK([cat subdir_build/debugsources.list | tr '\0' '\n' | sort -u], -+ [0], [expout], []) -+AT_CLEANUP -diff --git a/tests/testsuite.at b/tests/testsuite.at -index baf7ca2c81c6..d7027f0039d5 100644 ---- a/tests/testsuite.at -+++ b/tests/testsuite.at -@@ -10,3 +10,4 @@ AT_INIT - AT_TESTED([debugedit]) - - m4_include([debugedit.at]) -+m4_include([find-debuginfo.at]) --- -2.49.0 - diff --git a/0001-debugedit-Handle-unused-.debug_str_offsets-entries.patch b/0001-debugedit-Handle-unused-.debug_str_offsets-entries.patch deleted file mode 100644 index ef283ba..0000000 --- a/0001-debugedit-Handle-unused-.debug_str_offsets-entries.patch +++ /dev/null @@ -1,244 +0,0 @@ -From 0add2fc587ff07e39bc3a22187c2425a129c7d41 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Mon, 7 Apr 2025 16:27:11 +0200 -Subject: [PATCH] debugedit: Handle unused .debug_str_offsets entries - -As a sanity check we would assert when rewriting a .debug_str index we -hadn't seen while processing the DWARF. This relies on the DWARF -producer/compiler to not emit strings that aren't used. So when -processing/rewriting the .debug_str_offsets we assume all indexes -point to .debugstr offsets we have seen before. - -This assumption doesn't seem to hold for clang++ at the moment. It -does put strings in the .debug_str section referenced from the -.debug_str_offsets section that aren't used anywhere else. So -debugedit will fail with an assert when processing such files. - -We don't want to process the .debug_str_offsets section multiple time -and possibly have to rewrite other str references in other -sections. So instead when we encounter an unseen/unused string we -replace it with a dummy string "". - -To help DWARF producers indentify these unused strings we keep a -reference to the original string table and produce a warning -explaining which .debug_str_offsets table at which index points to the -unseen .debug_str offset. - - debugedit: Warning, .debug_str_offsets table at offset ce2d0 index - [4213] .debug_str [48cad9] entry 'CrossThreadCopierBaseHelper' unused, - replacing with '' - - * tools/debugedit.c (debugedit_stridxentry): New static struct - stridxentry. - (struct strings): Add new field orig_data. - (create_dummy_debugedit_stridxentry): New function. - (string_find_new_entry): Add boolean argument accept_missing. - Return &debugedit_stridxentry if no existing string index - could be found. - (setup_strings): Fill in orig_data field. - (update_strings): New function to set orig_data field. - (orig_str): New function returns the original string at index. - (edit_strp): Call string_find_entry with false. - (update_str_offsets): Call string_find_entry with true, emit - warning if entry returned is &debugedit_stridxentry. - (edit_dwarf2): Call update_strings and - create_dummy_debugedit_stridxentry. - -https://sourceware.org/bugzilla/show_bug.cgi?id=32845 - -Signed-off-by: Mark Wielaard ---- - tools/debugedit.c | 89 +++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 83 insertions(+), 6 deletions(-) - -diff --git a/tools/debugedit.c b/tools/debugedit.c -index 43f9cee65cf8..fcf8f7d6564b 100644 ---- a/tools/debugedit.c -+++ b/tools/debugedit.c -@@ -144,6 +144,15 @@ struct stridxentry - Strent *entry; /* Entry in the new table. */ - }; - -+/* Turns out we do need at least one replacement string when there are -+ strings that are never used in any of the debug sections, but that -+ turn up in the .debug_str_offsets. In that case (which really -+ shouldn't occur because it means the DWARF producer added unused -+ strings to the string table) we (warn and) replace the entry with -+ "". Call create_dummy_debugedit_stridxentry to add the -+ actual string. */ -+static struct stridxentry debugedit_stridxentry = { 0, NULL }; -+ - /* Storage for new string table entries. Keep together in memory to - quickly search through them with tsearch. */ - #define STRIDXENTRIES ((16 * 1024) / sizeof (struct stridxentry)) -@@ -157,6 +166,7 @@ struct strentblock - struct strings - { - Strtab *str_tab; /* The new string table. */ -+ Elf_Data orig_data; /* Original Elf_Data. */ - char *str_buf; /* New Elf_Data d_buf. */ - struct strmemblock *blocks; /* The first strmemblock. */ - struct strmemblock *last_block; /* The currently used strmemblock. */ -@@ -1119,6 +1129,32 @@ new_string_storage (struct strings *strings, size_t size) - return &strings->last_block->memory[stridx]; - } - -+static void -+create_dummy_debugedit_stridxentry (DSO *dso) -+{ -+ if (debugedit_stridxentry.entry != NULL) -+ { -+ fprintf (stderr, "debugedit: " -+ "create_dummy_debugedit_stridxentry called more than once."); -+ exit (-1); -+ } -+ -+ const char *dummy_name = ""; /* Kilroy was here */ -+ const size_t dummy_size = strlen (dummy_name) + 1; -+ -+ Strent *strent; -+ char* dummy_str = new_string_storage (&dso->debug_str, dummy_size); -+ if (dummy_str == NULL) -+ error (1, ENOMEM, "Couldn't allocate new string storage"); -+ memcpy (dummy_str, dummy_name, dummy_size); -+ strent = strtab_add_len (dso->debug_str.str_tab, dummy_str, dummy_size); -+ if (strent == NULL) -+ error (1, ENOMEM, "Could not create new string table entry"); -+ -+ debugedit_stridxentry.idx = (uint32_t) -1; -+ debugedit_stridxentry.entry = strent; -+} -+ - /* Comparison function used for tsearch. */ - static int - strent_compare (const void *a, const void *b) -@@ -1189,12 +1225,14 @@ string_find_new_entry (struct strings *strings, size_t old_idx) - } - - static struct stridxentry * --string_find_entry (struct strings *strings, size_t old_idx) -+string_find_entry (struct strings *strings, size_t old_idx, bool accept_missing) - { - struct stridxentry **ret; - struct stridxentry key; - key.idx = old_idx; - ret = tfind (&key, &strings->strent_root, strent_compare); -+ if (accept_missing && ret == NULL) -+ return &debugedit_stridxentry; - assert (ret != NULL); /* Can only happen for a bad/non-existing old_idx. */ - return *ret; - } -@@ -1291,6 +1329,8 @@ static void - setup_strings (struct strings *strings) - { - strings->str_tab = strtab_init (false); -+ /* call update_strings to fill this in. */ -+ memset (&strings->orig_data, 0, sizeof (strings->orig_data)); - strings->str_buf = NULL; - strings->blocks = NULL; - strings->last_block = NULL; -@@ -1299,6 +1339,21 @@ setup_strings (struct strings *strings) - strings->strent_root = NULL; - } - -+static void -+update_strings (struct strings *strings, struct debug_section *sec) -+{ -+ if (sec->elf_data != NULL) -+ strings->orig_data = *sec->elf_data; -+} -+ -+static const char * -+orig_str (struct strings *strings, size_t idx) -+{ -+ if (idx < strings->orig_data.d_size) -+ return (const char *) strings->orig_data.d_buf + idx; -+ return ""; -+} -+ - /* Noop for tdestroy. */ - static void free_node (void *p __attribute__((__unused__))) { } - -@@ -1707,7 +1762,7 @@ edit_strp (DSO *dso, uint32_t form, unsigned char *ptr, int phase, - struct strings *strings = (form == DW_FORM_line_strp - ? &dso->debug_line_str : &dso->debug_str); - idx = do_read_32_relocated (ptr, sec); -- entry = string_find_entry (strings, idx); -+ entry = string_find_entry (strings, idx, false); - new_idx = strent_offset (entry->entry); - do_write_32_relocated (ptr, new_idx); - } -@@ -2791,6 +2846,7 @@ update_str_offsets (DSO *dso) - while (ptr < endp) - { - /* Read header, unit_length, version and padding. */ -+ unsigned char *index_start = ptr; - if (endp - ptr < 3 * 4) - break; - uint32_t unit_length = read_32 (ptr); -@@ -2803,13 +2859,21 @@ update_str_offsets (DSO *dso) - uint32_t padding = read_16 (ptr); - if (padding != 0) - break; -+ unsigned char *offstart = ptr; - - while (ptr < endidxp) - { - struct stridxentry *entry; - size_t idx, new_idx; - idx = do_read_32_relocated (ptr, str_off_sec); -- entry = string_find_entry (&dso->debug_str, idx); -+ entry = string_find_entry (&dso->debug_str, idx, true); -+ if (entry == &debugedit_stridxentry) -+ error (0, 0, "Warning, .debug_str_offsets table at offset %zx " -+ "index [%zd] .debug_str [%zx] entry '%s' unused, " -+ "replacing with ''\n", -+ (index_start - str_off_sec->data), -+ (ptr - offstart) / sizeof (uint32_t), idx, -+ orig_str (&dso->debug_str, idx)); - new_idx = strent_offset (entry->entry); - write_32_relocated (ptr, new_idx); - } -@@ -2963,6 +3027,9 @@ edit_dwarf2 (DSO *dso) - } - } - -+ update_strings (&dso->debug_str, &debug_sections[DEBUG_STR]); -+ update_strings (&dso->debug_line_str, &debug_sections[DEBUG_LINE_STR]); -+ - if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB) - { - do_read_16 = buf_read_ule16; -@@ -3211,7 +3278,8 @@ edit_dwarf2 (DSO *dso) - struct stridxentry *entry; - size_t idx, new_idx; - idx = do_read_32_relocated (ptr, macro_sec); -- entry = string_find_entry (&dso->debug_str, idx); -+ entry = string_find_entry (&dso->debug_str, idx, -+ false); - new_idx = strent_offset (entry->entry); - write_32_relocated (ptr, new_idx); - } -@@ -3265,8 +3333,17 @@ edit_dwarf2 (DSO *dso) - Make sure everything is in place for phase 1 updating of debug_info - references. */ - if (phase == 0 && need_strp_update) -- edit_dwarf2_any_str (dso, &dso->debug_str, -- &debug_sections[DEBUG_STR]); -+ { -+ /* We might need a dummy .debug_str entry for -+ .debug_str_offsets entries of unused strings. We have to -+ add it unconditionally when there is a .debug_str_offsets -+ section because we don't know if there are any such -+ entries. */ -+ if (debug_sections[DEBUG_STR_OFFSETS].data != NULL) -+ create_dummy_debugedit_stridxentry (dso); -+ edit_dwarf2_any_str (dso, &dso->debug_str, -+ &debug_sections[DEBUG_STR]); -+ } - if (phase == 0 && need_line_strp_update) - edit_dwarf2_any_str (dso, &dso->debug_line_str, - &debug_sections[DEBUG_LINE_STR]); --- -2.49.0 - diff --git a/0001-find-debuginfo-Check-files-are-writable-before-modif.patch b/0001-find-debuginfo-Check-files-are-writable-before-modif.patch deleted file mode 100644 index ab4db5d..0000000 --- a/0001-find-debuginfo-Check-files-are-writable-before-modif.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 67dee55d160e312b9d0db607630eacfaa3ce08e4 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 28 Nov 2024 17:58:54 +0100 -Subject: [PATCH] find-debuginfo: Check files are writable before modifying - them - -Since commit dfe1f7ff3 ("find-debuginfo.sh: Exit with real exit status -in parallel jobs") there is a check whether gdb-add-index worked -correctly and find-debuginfo would fail (even in parallel mode) if an -error occured. - -This turned out to show that gdb-add-index needs write permission to -add the gdb index to the file. This is also the case for a couple of -other things, like running objcopy --merge-notes. debugedit and -add_minidebug already made sure it had write permission. - -To make sure find-debuginfo doesn't (partially) fail extend the -writable check to include the gdb-add-index and objcopy --merge-notes -invocation. ---- - scripts/find-debuginfo.in | 33 +++++++++++++++++++++++++++++++-- - 1 file changed, 31 insertions(+), 2 deletions(-) - -diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in -index a360bf0582dc..4e4ef5a64005 100755 ---- a/scripts/find-debuginfo.in -+++ b/scripts/find-debuginfo.in -@@ -481,14 +481,29 @@ do_file() - $strict && return 2 - fi - -+ # debugedit makes sure to to get write permission to the file and -+ # restores original state after modifications. Other utilities -+ # might not. -+ f_writable="false" -+ if test -w "$f"; then f_writable="true"; fi -+ - # Add .gdb_index if requested. - if $include_gdb_index; then - if type gdb-add-index >/dev/null 2>&1; then -+ if test "$f_writable" = "false"; then -+ chmod u+w "$f" -+ fi - gdb-add-index "$f" || { - status=$? - echo >&2 "*** ERROR:: GDB exited with exit status $status during index generation" -+ if test "$f_writable" = "false"; then -+ chmod u-w "$f" -+ fi - return 2 - } -+ if test "$f_writable" = "false"; then -+ chmod u-w "$f" -+ fi - else - echo >&2 "*** ERROR: GDB index requested, but no gdb-add-index installed" - return 2 -@@ -497,7 +512,13 @@ do_file() - - # Compress any annobin notes in the original binary. - # Ignore any errors, since older objcopy don't support --merge-notes. -+ if test "$f_writable" = "false"; then -+ chmod u+w "$f" -+ fi - objcopy --merge-notes "$f" 2>/dev/null || true -+ if test "$f_writable" = "false"; then -+ chmod u-w "$f" -+ fi - - # A binary already copied into /usr/lib/debug doesn't get stripped, - # just has its file names collected and adjusted. -@@ -507,7 +528,7 @@ do_file() - esac - - mkdir -p "${debugdn}" -- if test -w "$f"; then -+ if test "$f_writable" = "true"; then - strip_to_debug "${debugfn}" "$f" - else - chmod u+w "$f" -@@ -529,7 +550,15 @@ do_file() - application/x-executable*) skip_mini=false ;; - application/x-pie-executable*) skip_mini=false ;; - esac -- $skip_mini || add_minidebug "${debugfn}" "$f" -+ if test "$skip_mini" = "true"; then -+ if test "$f_writable" = "false"; then -+ chmod u+w "$f" -+ fi -+ add_minidebug "${debugfn}" "$f" -+ if test "$f_writable" = "false"; then -+ chmod u-w "$f" -+ fi -+ fi - fi - - echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE" --- -2.47.0 - diff --git a/0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch b/0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch deleted file mode 100644 index 0ed514a..0000000 --- a/0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 64d61a5f7d0ed685880f5c4f4b91f967445ba3a9 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 16 Jan 2025 12:02:11 +0100 -Subject: [PATCH] find-debuginfo: Fix skip_mini (".gnu_debugdata") handling - -The conditional that tests $skip_mini for true/false was inadvertently -flipped, causing the add_minidebug() function to no longer run for the -otherwise eligible binary files. - -Fixes: 971a74d79b48 ("find-debuginfo: Check files are writable before modifying them") - -Reported-by: Michal Domonkos -Signed-off-by: Mark Wielaard ---- - scripts/find-debuginfo.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in -index 4e4ef5a64005..f889e6d3b574 100755 ---- a/scripts/find-debuginfo.in -+++ b/scripts/find-debuginfo.in -@@ -550,7 +550,7 @@ do_file() - application/x-executable*) skip_mini=false ;; - application/x-pie-executable*) skip_mini=false ;; - esac -- if test "$skip_mini" = "true"; then -+ if test "$skip_mini" = "false"; then - if test "$f_writable" = "false"; then - chmod u+w "$f" - fi --- -2.47.1 - diff --git a/0001-find-debuginfo-Make-return-from-do_file-explicit.patch b/0001-find-debuginfo-Make-return-from-do_file-explicit.patch deleted file mode 100644 index ac54f90..0000000 --- a/0001-find-debuginfo-Make-return-from-do_file-explicit.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 1869e3b886c4596fb4ce471dd08121401d207cfa Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 16 Jan 2025 19:09:00 +0100 -Subject: [PATCH] find-debuginfo: Make return from do_file explicit - -Make all returns from do_file explicit so they don't implicitly return -the result of the last command. Also make sure the $temp/linked file -exists, even if it is empty. A file could have hardlinks to files not -under the buildroot. - -https://bugzilla.redhat.com/show_bug.cgi?id=2334760 - -Signed-off-by: Mark Wielaard ---- - scripts/find-debuginfo.in | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in -index a360bf0582dc..d102e8937775 100755 ---- a/scripts/find-debuginfo.in -+++ b/scripts/find-debuginfo.in -@@ -434,6 +434,7 @@ trap 'rm -rf "$temp"' EXIT - - # Build a list of unstripped ELF files and their hardlinks - touch "$temp/primary" -+touch "$temp/linked" - find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \ - \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \ - -print | LC_ALL=C sort | -@@ -458,7 +459,7 @@ do_file() - local nlinks=$1 inum=$2 f=$3 id link linked - - get_debugfn "$f" -- [ -f "${debugfn}" ] && return -+ [ -f "${debugfn}" ] && return 0 - - $verbose && echo "extracting debug info from $f" - # See also cpio SOURCEFILE copy. Directories must match up. -@@ -475,7 +476,7 @@ do_file() - id=$(debugedit -b "$debug_base_name" -d "$debug_dest_name" \ - $no_recompute -i \ - ${build_id_seed:+--build-id-seed="$build_id_seed"} \ -- -l "$SOURCEFILE" "$f") || exit -+ -l "$SOURCEFILE" "$f") || return 1 - if [ -z "$id" ]; then - echo >&2 "*** ${strict_error}: No build ID note found in $f" - $strict && return 2 -@@ -503,7 +504,7 @@ do_file() - # just has its file names collected and adjusted. - case "$dn" in - /usr/lib/debug/*) -- return ;; -+ return 0 ;; - esac - - mkdir -p "${debugdn}" -@@ -544,6 +545,8 @@ do_file() - mkdir -p "$(dirname "$debugfn")" && ln -nf "$link" "$debugfn" - done - fi -+ -+ return 0 - } - - # 16^6 - 1 or about 16 million files --- -2.47.1 - diff --git a/debugedit-5.1-binutils-tools-override.patch b/debugedit-5.1-binutils-tools-override.patch deleted file mode 100644 index ecfd42b..0000000 --- a/debugedit-5.1-binutils-tools-override.patch +++ /dev/null @@ -1,107 +0,0 @@ -commit 737da0cb62a2bd614040c3e11b7016aca743c34f -Author: Mark Wielaard -Date: Thu Feb 20 16:30:07 2025 +0100 - - find-debuginfo: Allow overriding binutils tools - - find-debuginfo relies on a couple of binutils tools (readelf, objcopy - and nm) that might not have been build with cross-arch support. Make - it possible to configure with specific (target) versions and to - override the specific binaries by setting READELF, OBJCOPY or NM - environment variables. - - * Makefile.am (do_subst): Add OBJCOPY and NM substitutions. - * configure.ac: Add OBJCOPY and NM tools override. - * scripts/find-debuginfo.in: Allow READELF, OBJCOPY and NM - environment overrides. - - Signed-off-by: Mark Wielaard - -diff --git a/Makefile.am b/Makefile.am -index 35fd947f8db2..562ffa46fa30 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -34,6 +34,8 @@ CLEANFILES = $(bin_SCRIPTS) - do_subst = ($(SED) -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ - -e 's,[@]VERSION[@],$(VERSION),g' \ - -e 's,[@]READELF[@],$(READELF),g' \ -+ -e 's,[@]OBJCOPY[@],$(OBJCOPY),g' \ -+ -e 's,[@]NM[@],$(NM),g' \ - -e 's,[@]DWZ_J[@],$(DWZ_J),g') - - find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile -diff --git a/configure.ac b/configure.ac -index 32dd27d287a3..ad4d70c63995 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -45,6 +45,8 @@ m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99]) - AC_PROG_LN_S - AC_CHECK_TOOL([LD], [ld]) - AC_CHECK_TOOL([READELF], [readelf]) -+AC_CHECK_TOOL([OBJCOPY], [objcopy]) -+AC_CHECK_TOOL([NM], [nm]) - AM_MISSING_PROG(HELP2MAN, help2man) - - # Whether dwz support -j. -diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in -index 7f2c00728b94..4cc49f2f8cd0 100755 ---- a/scripts/find-debuginfo.in -+++ b/scripts/find-debuginfo.in -@@ -108,6 +108,14 @@ EOF - install_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - PATH=${install_dir}:$PATH - -+# A couple of binutils helper tools are used in this script. -+# Let the user override them by setting them in environment variables. -+# The default is the (target variant) of the tool found when debugedit -+# was configured. -+READELF=${READELF:=@READELF@} -+OBJCOPY=${OBJCOPY:=@OBJCOPY@} -+NM=${NM:=@NM@} -+ - # With -g arg, pass it to strip on libraries or executables. - strip_g=false - -@@ -360,7 +368,7 @@ add_minidebug() - # symbol and NOBITS sections so cannot use --keep-only because that is - # too aggressive. Field $2 is the section name, $3 is the section type - # and $8 are the section flags. -- local remove_sections=`@READELF@ -W -S "$debuginfo" \ -+ local remove_sections=`${READELF} -W -S "$debuginfo" \ - | awk '{ if (index($2,".debug_") != 1 \ - && ($3 == "PROGBITS" || $3 == "NOTE" || $3 == "NOBITS") \ - && index($8,"A") == 0) \ -@@ -368,20 +376,20 @@ add_minidebug() - - # Extract the dynamic symbols from the main binary, there is no need to also have these - # in the normal symbol table -- nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms" -+ ${NM} -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms" - # Extract all the text (i.e. function) symbols from the debuginfo - # Use format sysv to make sure we can match against the actual ELF FUNC - # symbol type. The binutils nm posix format symbol type chars are - # ambigous for architectures that might use function descriptors. -- nm "$debuginfo" --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "FUNC") print $1 }' | sort > "$funcsyms" -+ ${NM} "$debuginfo" --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "FUNC") print $1 }' | sort > "$funcsyms" - # Keep all the function symbols not already in the dynamic symbol table - comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols" - # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections -- objcopy -S $remove_sections --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null -+ ${OBJCOPY} -S $remove_sections --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null - #Inject the compressed data into the .gnu_debugdata section of the original binary - xz "$mini_debuginfo" - mini_debuginfo="${mini_debuginfo}.xz" -- objcopy --add-section .gnu_debugdata="$mini_debuginfo" "$binary" -+ ${OBJCOPY} --add-section .gnu_debugdata="$mini_debuginfo" "$binary" - rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo" - } - -@@ -516,7 +524,7 @@ do_file() - if test "$f_writable" = "false"; then - chmod u+w "$f" - fi -- objcopy --merge-notes "$f" 2>/dev/null || true -+ ${OBJCOPY} --merge-notes "$f" 2>/dev/null || true - if test "$f_writable" = "false"; then - chmod u-w "$f" - fi diff --git a/debugedit-5.3-elflint-test.patch b/debugedit-5.3-elflint-test.patch new file mode 100644 index 0000000..6a13f94 --- /dev/null +++ b/debugedit-5.3-elflint-test.patch @@ -0,0 +1,66 @@ +From 2a1acc601ba086612a80ef87dd35c4f268405b21 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 17 Mar 2026 14:33:10 +0100 +Subject: [PATCH] tests: check eu-elflint works before testing --check-elf + + * tests/find-debuginfo.at: Add AT_SKIP_IF checking eu-elflint. + +https://sourceware.org/bugzilla/show_bug.cgi?id=33991 + +Signed-off-by: Mark Wielaard +--- + tests/find-debuginfo.at | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/tests/find-debuginfo.at b/tests/find-debuginfo.at +index ba4beabffc09..039802311444 100644 +--- a/tests/find-debuginfo.at ++++ b/tests/find-debuginfo.at +@@ -463,6 +463,8 @@ AT_CLEANUP + AT_SETUP([find-debuginfo check-elf]) + AT_KEYWORDS([find-debuginfo] [check-elf]) + FIND_DEBUGINFO_PKG_BUILD_SETUP ++# Make sure eu-elflint --gnu work on the input file. ++AT_SKIP_IF([! eu-elflint --gnu ./subdir_build/bar | grep -q 'No errors']) + # We need to set some environment variables for running find-debuginfo + # normally set by rpmbuild. + AT_CHECK([env RPM_BUILD_DIR=${PWD} \ +@@ -480,6 +482,8 @@ AT_CLEANUP + AT_SETUP([find-debuginfo check-elf debugdata]) + AT_KEYWORDS([find-debuginfo] [check-elf] [debugdata]) + FIND_DEBUGINFO_PKG_BUILD_SETUP ++# Make sure eu-elflint --gnu work on the input file. ++AT_SKIP_IF([! eu-elflint --gnu ./subdir_build/bar | grep -q 'No errors']) + # We need to set some environment variables for running find-debuginfo + # normally set by rpmbuild. + # +@@ -501,6 +505,8 @@ AT_KEYWORDS([find-debuginfo] [check-elf] [debugdata] [gdb-index]) + # Too new gdb with too old gdb + AT_SKIP_IF([test "$GDB_ADD_INDEX_CHECKS_OK" = "no"]) + FIND_DEBUGINFO_PKG_BUILD_SETUP ++# Make sure eu-elflint --gnu work on the input file. ++AT_SKIP_IF([! eu-elflint --gnu ./subdir_build/bar | grep -q 'No errors']) + # We need to set some environment variables for running find-debuginfo + # normally set by rpmbuild. + # +@@ -525,6 +531,8 @@ AT_SKIP_IF([test "$DWARF_5_DEBUGADDR" = "yes"]) + # Too new gdb with too old gdb + AT_SKIP_IF([test "$GDB_ADD_INDEX_CHECKS_OK" = "no"]) + FIND_DEBUGINFO_PKG_BUILD_SETUP ++# Make sure eu-elflint --gnu work on the input file. ++AT_SKIP_IF([! eu-elflint --gnu ./subdir_build/bar | grep -q 'No errors']) + # We need to set some environment variables for running find-debuginfo + # normally set by rpmbuild. + # +@@ -551,7 +559,7 @@ FIND_DEBUGINFO_PKG_BUILD_SETUP + mkdir -p subdir_ar + AT_CHECK([ar q ./subdir_ar/archive.a $(find subdir_build -name '*.o')], + [0], [ignore], [ignore]) +-# Make sure eu-elflint --gnu work on the simple input archive. ++# Make sure eu-elflint --gnu work on the input archive. + # It might not if llvm is used for example. + AT_SKIP_IF([! eu-elflint --gnu ./subdir_ar/archive.a | grep -q 'No errors']) + # We need to set some environment variables for running find-debuginfo +-- +2.53.0 + diff --git a/debugedit.spec b/debugedit.spec index b3201b9..2886429 100644 --- a/debugedit.spec +++ b/debugedit.spec @@ -1,14 +1,13 @@ Name: debugedit -Version: 5.1 -Release: 8%{?dist} +Version: 5.3 +Release: 2%{?dist} Summary: Tools and scripts for creating debuginfo and source file distributions, collect build-ids and rewrite source paths in DWARF data for debugging, tracing and profiling. License: GPL-3.0-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/debugedit/ Source0: https://sourceware.org/pub/debugedit/%{version}/%{name}-%{version}.tar.xz Source1: https://sourceware.org/pub/debugedit/%{version}/%{name}-%{version}.tar.xz.sig -Source2: gpgkey-5C1D1AA44BE649DE760A.gpg -BuildRequires: make gcc +BuildRequires: make gcc gcc-c++ BuildRequires: pkgconfig(libelf) BuildRequires: pkgconfig(libdw) BuildRequires: help2man @@ -26,10 +25,14 @@ BuildRequires: xxhash-static BuildRequires: autoconf BuildRequires: automake +# For configure checks we need full gdb, otherwise gdb-add-index is fine. +# Older gdb-add-index unfortunately don't support --version. +BuildRequires: gdb + # The find-debuginfo.sh script has a couple of tools it needs at runtime. # For strip_to_debug, eu-strip Requires: elfutils -# For add_minidebug, readelf, awk, nm, sort, comm, objcopy, xz +# For ar, add_minidebug, readelf, awk, nm, sort, comm, objcopy, xz Requires: binutils, gawk, coreutils, xz # For find and xargs Requires: findutils @@ -46,12 +49,7 @@ Requires: grep %global _hardened_build 1 -Patch1: 0001-find-debuginfo-Check-files-are-writable-before-modif.patch -Patch2: 0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch -patch3: 0001-find-debuginfo-Make-return-from-do_file-explicit.patch -patch4: debugedit-5.1-binutils-tools-override.patch -patch5: 0001-debugedit-Handle-unused-.debug_str_offsets-entries.patch -patch6: 0001-Add-basic-find-debuginfo-script-tests.patch +Patch1: debugedit-5.3-elflint-test.patch %description The debugedit project provides programs and scripts for creating @@ -63,7 +61,6 @@ binutils. It depends on the elfutils libelf and libdw libraries to read and write ELF files, DWARF data and build-ids. %prep -%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %autosetup -p1 %build @@ -86,13 +83,24 @@ make check %{?_smp_mflags} %doc README %{_bindir}/debugedit %{_bindir}/sepdebugcrcfix +%{_bindir}/debugedit-classify-ar %{_bindir}/find-debuginfo %{_bindir}/find-debuginfo.sh %{_mandir}/man1/debugedit.1* %{_mandir}/man1/sepdebugcrcfix.1* +%{_mandir}/man1/debugedit-classify-ar.1* %{_mandir}/man1/find-debuginfo.1* %changelog +* Tue Apr 28 2026 Mark Wielaard - 5.3-2 +- New upstream 5.3 release +- Drop release gpg key, unsupported by gpgverify. +- Drop all local patches +- Add debugedit-5.3-elflint-test.patch +- Add gcc-c++ as BuildRequires +- Add gdb as BuildRequires +- Install debugedit-classify-ar and man page + * Fri Jun 20 2025 Mark Wielaard - 5.1-8 - Add 0001-Add-basic-find-debuginfo-script-tests.patch diff --git a/sources b/sources index 14db3d8..a91361b 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (debugedit-5.1.tar.xz) = 72f4dcc0fba223a85d261aa38400e229f04c7c96adafe455919a8f702d3d7d9cdfb991b403d53f2ac4948ca19eeb43d3d49c0ea2616065657c120647a30575d3 -SHA512 (debugedit-5.1.tar.xz.sig) = 8fc5072f05df2df630994844bd758dece9479c5f68182c10fd7ba4bc1c9a9601f6e399a2ad3146e58cdef75aa36871b642b64cb53c42cedfb05b310773994e5f +SHA512 (debugedit-5.3.tar.xz) = a02e04f5b91e0ec5d880207658e5b89b28424ffee6aed7374c495c0c49b2f0180eeb2277bdb758a3d245279a2083d5f7b8b4872b8972b92d5c92ef5f1d27d958 +SHA512 (debugedit-5.3.tar.xz.sig) = 51b04d7639b8c2eb619ce08934ea19504a3fc1d3ddf3c46bb0f3c47f1d3b18ccae7590e54b3e2a798078da879eecd50b43c1c350e6cff2564de13df8d1c7cfe7