From a744c5314e070fcafa55166ff497587d3d435d66 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 25 Jun 2012 12:33:03 +0300 Subject: [PATCH] - add dwarf compression support to debuginfo generation (#833311) --- rpm-4.10.0-dwz-debuginfo.patch | 101 +++++++++++++++++++++++++++++++++ rpm.spec | 8 ++- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 rpm-4.10.0-dwz-debuginfo.patch diff --git a/rpm-4.10.0-dwz-debuginfo.patch b/rpm-4.10.0-dwz-debuginfo.patch new file mode 100644 index 0000000..41d783b --- /dev/null +++ b/rpm-4.10.0-dwz-debuginfo.patch @@ -0,0 +1,101 @@ +--- rpm-4.10.0/scripts/find-debuginfo.sh 2012-03-20 09:07:25.000000000 +0100 ++++ rpm-4.10.0/scripts/find-debuginfo.sh.jj 2012-06-19 12:32:33.147503858 +0200 +@@ -4,6 +4,8 @@ + # + # Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] + # [-o debugfiles.list] ++# [--run-dwz] [--dwz-low-mem-die-limit N] ++# [--dwz-max-die-limit N] + # [[-l filelist]... [-p 'pattern'] -o debuginfo.list] + # [builddir] + # +@@ -20,6 +22,10 @@ + # The -p argument is an grep -E -style regexp matching the a file name, + # and must not use anchors (^ or $). + # ++# The --run-dwz flag instructs find-debuginfo.sh to run the dwz utility ++# if available, and --dwz-low-mem-die-limit and --dwz-max-die-limit ++# provide detailed limits. See dwz(1) -l and -L option for details. ++# + # All file names in switches are relative to builddir (. if not given). + # + +@@ -32,6 +38,11 @@ strip_r=false + # Barf on missing build IDs. + strict=false + ++# DWZ parameters. ++run_dwz=false ++dwz_low_mem_die_limit= ++dwz_max_die_limit= ++ + BUILDDIR=. + out=debugfiles.list + nout=0 +@@ -40,6 +51,17 @@ while [ $# -gt 0 ]; do + --strict-build-id) + strict=true + ;; ++ --run-dwz) ++ run_dwz=true ++ ;; ++ --dwz-low-mem-die-limit) ++ dwz_low_mem_die_limit=$2 ++ shift ++ ;; ++ --dwz-max-die-limit) ++ dwz_max_die_limit=$2 ++ shift ++ ;; + -g) + strip_g=true + ;; +@@ -266,6 +288,37 @@ while read nlinks inum f; do + fi + done || exit + ++# Invoke the DWARF Compressor utility. ++if $run_dwz && type dwz >/dev/null 2>&1 \ ++ && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then ++ dwz_files="`cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug`" ++ if [ -n "${dwz_files}" ]; then ++ dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}" ++ dwz_multifile_suffix= ++ dwz_multifile_idx=0 ++ while [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}${dwz_multifile_suffix}" ]; do ++ let ++dwz_multifile_idx ++ dwz_multifile_suffix=".${dwz_multifile_idx}" ++ done ++ dwz_multfile_name="${dwz_multifile_name}${dwz_multifile_suffix}" ++ dwz_opts="-h -q -r -m .dwz/${dwz_multifile_name}" ++ mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" ++ [ -n "${dwz_low_mem_die_limit}" ] \ ++ && dwz_opts="${dwz_opts} -l ${dwz_low_mem_die_limit}" ++ [ -n "${dwz_max_die_limit}" ] \ ++ && dwz_opts="${dwz_opts} -L ${dwz_max_die_limit}" ++ ( cd "${RPM_BUILD_ROOT}/usr/lib/debug" && dwz $dwz_opts $dwz_files ) ++ # Remove .dwz directory if empty ++ rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null ++ if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then ++ id="`readelf -Wn "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" \ ++ 2>/dev/null | sed -n 's/^ Build ID: \([0-9a-f]\+\)/\1/p'`" ++ [ -n "$id" ] \ ++ && make_id_link "$id" "/usr/lib/debug/.dwz/${dwz_multifile_name}" .debug ++ fi ++ fi ++fi ++ + # For each symlink whose target has a .debug file, + # make a .debug symlink to that file. + find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print | +--- rpm-4.10.0/macros.in 2012-03-20 09:07:25.000000000 +0100 ++++ rpm-4.10.0/macros.in.jj 2012-06-19 12:32:33.147503858 +0200 +@@ -176,7 +176,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} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\ + %{nil} + + # Template for debug information sub-package. diff --git a/rpm.spec b/rpm.spec index cfca29e..45632d4 100644 --- a/rpm.spec +++ b/rpm.spec @@ -21,7 +21,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}1%{?dist} +Release: %{?snapver:0.%{snapver}.}2%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/rpm-4.10.x/%{name}-%{srcver}.tar.bz2 @@ -51,6 +51,8 @@ Patch301: rpm-4.6.0-niagara.patch Patch302: rpm-4.7.1-geode-i686.patch # Probably to be upstreamed in slightly different form Patch304: rpm-4.9.1.1-ld-flags.patch +# Compressed debuginfo support (#833311) +Patch305: rpm-4.10.0-dwz-debuginfo.patch # Temporary Patch to provide support for updates Patch400: rpm-4.9.1.2-rpmlib-filesystem-check.patch @@ -217,6 +219,7 @@ packages on a system. %patch301 -p1 -b .niagara %patch302 -p1 -b .geode %patch304 -p1 -b .ldflags +%patch305 -p1 -b .dwz-debuginfo %patch400 -p1 -b .rpmlib-filesystem-check @@ -439,6 +442,9 @@ exit 0 %doc COPYING doc/librpm/html/* %changelog +* Mon Jun 25 2012 Panu Matilainen - 4.10.0-2 +- add dwarf compression support to debuginfo generation (#833311) + * Thu May 24 2012 Panu Matilainen - 4.10.0-1 - update to 4.10.0 final