On Wed, 2016-05-11 at 22:29 +0300, Panu Matilainen wrote:
> On 05/11/2016 05:41 PM, Mark Wielaard wrote:
> > The original rpm-4.10.0-minidebuginfo.patch in Fedora was created by
> > Panu Matilainen and Lubos Kardos.
>
> Credit where credit is due: I merely added the patch into Fedora,
> minidebuginfo was actually implemented by Alexander Larsson, the
> original submission being here I think:
> http://lists.rpm.org/pipermail/rpm-maint/2012-June/003214.html
Sorry, I should have remembered. I discussed things with Alex when I
implemented the elfutils support. My apologies.
I have updated the commit message to more accurately describe the
origin. Do you need a signed-off-by from Alex too?
Alex, the patch below is what you submitted originally in the thread
above, plus a bug fix when using strip -g by Lubos and some macro tweaks
and two testcases for upstream rpm written by me.
Thanks,
Mark
From ed8f32d8cfe4eec4558c17ca66df8a642aa6e690 Mon Sep 17 00:00:00 2001
From: Mark Wielaard
Date: Wed, 11 May 2016 16:24:10 +0200
Subject: [PATCH] Add find-debuginfo.sh -m minisymtab support.
Support for minisymtab (a minimal function symbol table in a compressed
section in the main binary) has been in gdb and elfutils based tools
since some years. Fedora has had this as rpm-4.10.0-minidebuginfo.patch
since 2012.
The patch adjusts macros to pass -m to find-debuginfo.sh when
_include_minidebuginfo has been set. find-debuginfo.sh now takes -m
as argument to generate the .gnu_debugdata ELF section to be added
to the main executable.
To support the testcases a new macros.debug is added that is used to
generate debuginfo packages in the rpmbuild.at testsuite.
The original support was added to Fedora rpm by Alexander Larsson.
Lubos Kardos fixed a bug in it when strip -g was used. I added some
configuration macros and two testcases to check the basic support works
and for the strip -g bug.
Signed-off-by: Mark Wielaard
---
Makefile.am | 3 ++
macros.debug | 30 ++
macros.in | 8 -
scripts/find-debuginfo.sh | 37 ++-
tests/rpmbuild.at | 77 +++
5 files changed, 153 insertions(+), 2 deletions(-)
create mode 100644 macros.debug
diff --git a/Makefile.am b/Makefile.am
index 939a6a0..157e79d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -198,6 +198,9 @@ macros: $(top_srcdir)/macros.in
CLEANFILES += macros
EXTRA_DIST += macros.in
+# Used for the testsuite to test creating debuginfo packages
+EXTRA_DIST += macros.debug
+
noinst_DATA += platform
platform: $(top_srcdir)/platform.in
@$(SED) \
diff --git a/macros.debug b/macros.debug
new file mode 100644
index 000..bb2c02f
--- /dev/null
+++ b/macros.debug
@@ -0,0 +1,30 @@
+# macros to include to generate debuginfo
+
+%_enable_debug_packages 1
+%_include_minidebuginfo 1
+
+# Expanded at end of %install scriptlet
+
+%__arch_install_post %{nil}
+
+%__os_install_post \
+%{_rpmconfigdir}/brp-compress \
+%{!?__debug_package:\
+%{_rpmconfigdir}/brp-strip %{__strip} \
+%{_rpmconfigdir}/brp-strip-comment-note %{__strip} %{__objdump} \
+} \
+%{_rpmconfigdir}/brp-strip-static-archive %{__strip} \
+%{nil}
+
+%__spec_install_post\
+%{?__debug_package:%{__debug_install_post}}\
+%{__arch_install_post}\
+%{__os_install_post}\
+%{nil}
+
+%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
+%%install\
+%{nil}
+
+# Should missing buildids terminate a build?
+%_missing_build_ids_terminate_build1
diff --git a/macros.in b/macros.in
index f9172d0..58b122f 100644
--- a/macros.in
+++ b/macros.in
@@ -178,7 +178,7 @@
# the script. See the script for details.
#
%__debug_install_post \
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
%{nil}
# Template for debug information sub-package.
@@ -441,6 +441,12 @@ package or when debugging this package.\
#%_missing_build_ids_terminate_build 1
#
+# Include minimal debug information in build binaries.
+# Requires _enable_debug_packages.
+#
+#%_include_minidebuginfo 1
+
+#
# Use internal dependency generator rather than external helpers?
%_use_internal_dependency_generator 1
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 17522e0..5c2c381 100644
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -2,7 +2,7 @@
#find-debuginfo.sh - automagically generate debug info and file list
#for inclusion in an rpm spec file.
#
-# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
+# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m]
# [-o debugfiles.list]
# [[-l