--- rpm-5.4.9/configure.ac.strip_reloc_debug~ 2012-05-04 10:41:08.000000000 +0200 +++ rpm-5.4.9/configure.ac 2012-05-15 02:03:16.448634686 +0200 @@ -625,6 +625,35 @@ AC_PATH_PROG(__STRIP, strip, %{_bindir}/ AC_CHECK_PROGS(LIBTOOLIZE, libtoolize glibtoolize, libtoolize) AC_SUBST(LIBTOOLIZE) +# check for elfutils eu-strip --reloc-debug_sections +# elfutils-0.153 introduce the --reloc-debug-sections +# This is a new option to eu-strip that strips +# out/resolves relocations between .debug_* elf sections in ET_REL files. +# This can save a lot of space for kernel module. +# Use this option in find-debuginfo if supported +# Check also for the eu_strip path and AC_SUBST it if found +# not used really today +old_PATH=$PATH +PATH=$MYPATH +AC_CACHE_CHECK([whether eu-strip supports --reloc-debug-sections], [ac_cv_path_EU_STRIP], + [AC_PATH_PROGS_FEATURE_CHECK([EU_STRIP], [eu-strip strip], + [[eu_stripout=`$ac_path_EU_STRIP --help | grep "\--reloc-debug-sections"` + test "x$eu_stripout" != x \ + && ac_cv_path_EU_STRIP=$ac_path_EU_STRIP debuginfo_eu_strip_reloc_debug_sections="-r"]], + [[ debuginfo_eu_strip_reloc_debug_sections="" ]] +)]) +PATH=$old_PATH +AC_SUBST([debuginfo_eu_strip_reloc_debug_sections]) +AS_IF([test "x$ac_cv_path_EU_STRIP" != x], [ + AC_SUBST([EU_STRIP], [$ac_cv_path_EU_STRIP]) +], [ + AC_SUBST([EU_STRIP], [:]) + AC_MSG_RESULT([no]) +]) + + + + dnl # check for id -u AC_MSG_CHECKING(whether id supports -u) if ${__ID} -u 2>&1 > /dev/null; then --- rpm-5.4.9/macros/macros.in.strip_reloc_debug~ 2012-05-15 02:03:16.377634331 +0200 +++ rpm-5.4.9/macros/macros.in 2012-05-15 02:03:16.449634691 +0200 @@ -148,7 +148,7 @@ # the script. See the script for details. # %__debug_install_post \ - %{_rpmhome}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\ + %{_rpmhome}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} @debuginfo_eu_strip_reloc_debug_sections@ "%{_builddir}/%{?buildsubdir}"\ %{nil} # Template for debug information sub-package. --- rpm-5.4.9/macros/macros.rpmbuild.in.strip_reloc_debug~ 2011-10-21 17:39:02.000000000 +0200 +++ rpm-5.4.9/macros/macros.rpmbuild.in 2012-05-15 02:03:16.450634696 +0200 @@ -21,6 +21,7 @@ %__ranlib @RANLIB@ %__remsh %{__rsh} %__strip @__STRIP@ +%__eu_strip @__EU_STRIP@ # XXX avoid failures if tools are not installed when rpm is built. %__libtoolize @LIBTOOLIZE@ --- rpm-5.4.9/scripts/find-debuginfo.sh.strip_reloc_debug~ 2012-05-08 05:10:17.000000000 +0200 +++ rpm-5.4.9/scripts/find-debuginfo.sh 2012-05-15 02:04:42.628066270 +0200 @@ -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] +# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] # [-o debugfiles.list] # [[-l filelist]... [-p 'pattern'] -o debuginfo.list] # [builddir] @@ -18,12 +18,16 @@ # the -l filelist file, or whose names match the -p pattern. # The -p argument is an egrep-style regexp matching the a file name, # and must not use anchors (^ or $). +# The -r flag says to use eu-strip --reloc-debug-sections. # # All file names in switches are relative to builddir (. if not given). # # With -g arg, pass it to strip on libraries. strip_g=false +# with -r arg, pass --reloc-debug-sections to eu-strip. +strip_r=false + # Barf on missing build IDs. strict=false @@ -40,6 +44,9 @@ while [ $# -gt 0 ]; do -g) strip_g=true ;; + -r) + strip_r=true + ;; -o) if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then out=$2 @@ -90,12 +97,13 @@ debugdir="${RPM_BUILD_ROOT}/usr/lib/debu strip_to_debug() { local g= + $strip_r && r=--reloc-debug-sections $strip_g && case "$(file -bi "$2")" in application/x-sharedlib*) g=-g ;; esac [ -n "$EXCLUDE_FULL_REGEXP" ] && grep -E -q "$EXCLUDE_FULL_REGEXP" <<< "$2" && g=-g - eu-strip --remove-comment $g $([ -n "$DISABLE_DEBUG" ] || echo -f "$1") "$2" || exit + eu-strip --remove-comment $g $([ -n "$DISABLE_DEBUG" ] || echo $r -f "$1") "$2" || exit [ -n "$DISABLE_DEBUG" ] || chmod 444 "$1" || exit }