|
Panu Matilainen |
7f2e4e |
--- rpm-4.10.0/macros.in 2012-06-11 11:16:21.216952339 +0200
|
|
Panu Matilainen |
7f2e4e |
+++ rpm-4.10.0/macros.in.minidebug 2012-06-11 11:16:23.686912455 +0200
|
|
Panu Matilainen |
7f2e4e |
@@ -175,7 +175,7 @@
|
|
Panu Matilainen |
7f2e4e |
# the script. See the script for details.
|
|
Panu Matilainen |
7f2e4e |
#
|
|
Panu Matilainen |
7f2e4e |
%__debug_install_post \
|
|
Panu Matilainen |
7f2e4e |
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
|
|
Panu Matilainen |
7f2e4e |
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
|
|
Panu Matilainen |
7f2e4e |
%{nil}
|
|
Panu Matilainen |
7f2e4e |
|
|
Panu Matilainen |
7f2e4e |
# Template for debug information sub-package.
|
|
Panu Matilainen |
7f2e4e |
@@ -418,6 +418,12 @@ package or when debugging this package.\
|
|
Panu Matilainen |
7f2e4e |
#%_missing_build_ids_terminate_build 1
|
|
Panu Matilainen |
7f2e4e |
|
|
Panu Matilainen |
7f2e4e |
#
|
|
Panu Matilainen |
7f2e4e |
+# Include minimal debug information in build binaries.
|
|
Panu Matilainen |
7f2e4e |
+# Requires _enable_debug_packages.
|
|
Panu Matilainen |
7f2e4e |
+#
|
|
Panu Matilainen |
7f2e4e |
+#%_include_minidebuginfo 1
|
|
Panu Matilainen |
7f2e4e |
+
|
|
Panu Matilainen |
7f2e4e |
+#
|
|
Panu Matilainen |
7f2e4e |
# Use internal dependency generator rather than external helpers?
|
|
Panu Matilainen |
7f2e4e |
%_use_internal_dependency_generator 1
|
|
Panu Matilainen |
7f2e4e |
|
|
Panu Matilainen |
7f2e4e |
--- rpm-4.10.0/scripts/find-debuginfo.sh 2012-06-11 11:16:09.698138273 +0200
|
|
Panu Matilainen |
7f2e4e |
+++ rpm-4.10.0/scripts/find-debuginfo.sh.minidebug 2012-06-11 11:16:13.399078526 +0200
|
|
Panu Matilainen |
7f2e4e |
@@ -2,7 +2,7 @@
|
|
Panu Matilainen |
7f2e4e |
#find-debuginfo.sh - automagically generate debug info and file list
|
|
Panu Matilainen |
7f2e4e |
#for inclusion in an rpm spec file.
|
|
Panu Matilainen |
7f2e4e |
#
|
|
Panu Matilainen |
7f2e4e |
-# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
|
|
Panu Matilainen |
7f2e4e |
+# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m]
|
|
Panu Matilainen |
7f2e4e |
# [-o debugfiles.list]
|
|
Panu Matilainen |
7f2e4e |
# [--run-dwz] [--dwz-low-mem-die-limit N]
|
|
Panu Matilainen |
7f2e4e |
# [--dwz-max-die-limit N]
|
|
Panu Matilainen |
7f2e4e |
@@ -29,6 +29,9 @@ strip_g=false
|
|
Panu Matilainen |
7f2e4e |
# with -r arg, pass --reloc-debug-sections to eu-strip.
|
|
Panu Matilainen |
7f2e4e |
strip_r=false
|
|
Panu Matilainen |
7f2e4e |
|
|
Panu Matilainen |
7f2e4e |
+# with -m arg, add minimal debuginfo to binary.
|
|
Panu Matilainen |
7f2e4e |
+include_minidebug=false
|
|
Panu Matilainen |
7f2e4e |
+
|
|
Panu Matilainen |
7f2e4e |
# Barf on missing build IDs.
|
|
Panu Matilainen |
7f2e4e |
strict=false
|
|
Panu Matilainen |
7f2e4e |
|
|
Panu Matilainen |
7f2e4e |
@@ -43,6 +46,9 @@ while [ $# -gt 0 ]; do
|
|
Panu Matilainen |
7f2e4e |
-g)
|
|
Panu Matilainen |
7f2e4e |
strip_g=true
|
|
Panu Matilainen |
7f2e4e |
;;
|
|
Panu Matilainen |
7f2e4e |
+ -m)
|
|
Panu Matilainen |
7f2e4e |
+ include_minidebug=true
|
|
Panu Matilainen |
7f2e4e |
+ ;;
|
|
Panu Matilainen |
7f2e4e |
-o)
|
|
Panu Matilainen |
7f2e4e |
if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then
|
|
Panu Matilainen |
7f2e4e |
out=$2
|
|
Panu Matilainen |
7f2e4e |
@@ -105,6 +111,32 @@ strip_to_debug()
|
|
Panu Matilainen |
7f2e4e |
chmod 444 "$1" || exit
|
|
Panu Matilainen |
7f2e4e |
}
|
|
Panu Matilainen |
7f2e4e |
|
|
Panu Matilainen |
7f2e4e |
+add_minidebug()
|
|
Panu Matilainen |
7f2e4e |
+{
|
|
Panu Matilainen |
7f2e4e |
+ local debuginfo="$1"
|
|
Panu Matilainen |
7f2e4e |
+ local binary="$2"
|
|
Panu Matilainen |
7f2e4e |
+
|
|
Panu Matilainen |
7f2e4e |
+ local dynsyms=`mktemp`
|
|
Panu Matilainen |
7f2e4e |
+ local funcsyms=`mktemp`
|
|
Panu Matilainen |
7f2e4e |
+ local keep_symbols=`mktemp`
|
|
Panu Matilainen |
7f2e4e |
+ local mini_debuginfo=`mktemp`
|
|
Panu Matilainen |
7f2e4e |
+
|
|
Panu Matilainen |
7f2e4e |
+ # Extract the dynamic symbols from the main binary, there is no need to also have these
|
|
Panu Matilainen |
7f2e4e |
+ # in the normal symbol table
|
|
Panu Matilainen |
7f2e4e |
+ nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
|
|
Panu Matilainen |
7f2e4e |
+ # Extract all the text (i.e. function) symbols from the debuginfo
|
|
Panu Matilainen |
7f2e4e |
+ nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
|
|
Panu Matilainen |
7f2e4e |
+ # Keep all the function symbols not already in the dynamic symbol table
|
|
Panu Matilainen |
7f2e4e |
+ comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
|
|
Panu Matilainen |
7f2e4e |
+ # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
|
|
Panu Matilainen |
7f2e4e |
+ objcopy -S --remove-section .gdb_index --remove-section .comment --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null
|
|
Panu Matilainen |
7f2e4e |
+ #Inject the compressed data into the .gnu_debugdata section of the original binary
|
|
Panu Matilainen |
7f2e4e |
+ xz "$mini_debuginfo"
|
|
Panu Matilainen |
7f2e4e |
+ mini_debuginfo="${mini_debuginfo}.xz"
|
|
Panu Matilainen |
7f2e4e |
+ objcopy --add-section .gnu_debugdata="$mini_debuginfo" "$binary"
|
|
Panu Matilainen |
7f2e4e |
+ rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo"
|
|
Panu Matilainen |
7f2e4e |
+}
|
|
Panu Matilainen |
7f2e4e |
+
|
|
Panu Matilainen |
7f2e4e |
# Make a relative symlink to $1 called $3$2
|
|
Panu Matilainen |
7f2e4e |
shopt -s extglob
|
|
Panu Matilainen |
7f2e4e |
link_relative()
|
|
Panu Matilainen |
7f2e4e |
@@ -260,6 +292,9 @@ while read nlinks inum f; do
|
|
Panu Matilainen |
7f2e4e |
chmod u-w "$f"
|
|
Panu Matilainen |
7f2e4e |
fi
|
|
Panu Matilainen |
7f2e4e |
|
|
Lubos Kardos |
fa230e |
+ # strip -g implies we have full symtab, don't add mini symtab in that case.
|
|
Lubos Kardos |
dabd09 |
+ $strip_g || ($include_minidebug && add_minidebug "${debugfn}" "$f")
|
|
Panu Matilainen |
7f2e4e |
+
|
|
Panu Matilainen |
7f2e4e |
if [ -n "$id" ]; then
|
|
Panu Matilainen |
7f2e4e |
make_id_link "$id" "$dn/$(basename $f)"
|
|
Panu Matilainen |
7f2e4e |
make_id_link "$id" "/usr/lib/debug$dn/$bn" .debug
|