aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--NEWS2
-rw-r--r--UPSTREAM1
-rw-r--r--build.macros.in7
-rw-r--r--dwz.macros.in39
-rwxr-xr-xfind-debuginfo.sh37
6 files changed, 86 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index c83f107..eba404a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,8 @@ pkg_gdata = \
rpmrc
pkg_sysconf_macros_tmp = \
- build.macros
+ build.macros \
+ dwz.macros
pkg_data_in = $(pkg_gdata:=.in)
diff --git a/NEWS b/NEWS
index cb04589..ede6095 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- add support for mini debug packages
+ (https://fedoraproject.org/wiki/Features/MiniDebugInfo)
- document Mageia divergences with upstream
- fix typo that breaks emiting maven provides
- generate a perlapi-<version> provide when libperl.so is found
diff --git a/UPSTREAM b/UPSTREAM
index b6e7b79..8ea13a9 100644
--- a/UPSTREAM
+++ b/UPSTREAM
@@ -11,6 +11,7 @@ Those that could be replaced by patches:
+ allow for for only stripping files without creating debug package contents
by setting DISABLE_DEBUG environment variable
+ check real debug directory
+ ~ minidebug (merged soon)
Other divergences:
diff --git a/build.macros.in b/build.macros.in
index d90e846..aad0ffe 100644
--- a/build.macros.in
+++ b/build.macros.in
@@ -155,6 +155,11 @@ GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} -
%__distro_section %{?distro_section:%distro_section}%{?!distro_section:core}
%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}%{?distsuffix:%distsuffix}%{?!distsuffix:.mga}%{?distro_release:%distro_release}%([ "%{__distro_section}" != "core" ] && echo .%__distro_section)
+# Include minimal debug information in build binaries.
+# Requires _enable_debug_packages.
+#
+#%_include_minidebuginfo 0
+
#------------------------------------------------------------------------------
# definions merged from manbo-setup-build
#
@@ -303,7 +308,7 @@ export CFLAGS="%optflags"; export CXXFLAGS="%optflags"; export RPM_OPT_FLAGS="%o
%{nil}
%__debug_install_post \
- @RPMVENDORDIR@/find-debuginfo.sh "%{_builddir}/%{?buildsubdir}"\
+ @RPMVENDORDIR@/find-debuginfo.sh %{?_include_minidebuginfo:-m} "%{_builddir}/%{?buildsubdir}"\
%{nil}
diff --git a/dwz.macros.in b/dwz.macros.in
new file mode 100644
index 0000000..f1e4813
--- /dev/null
+++ b/dwz.macros.in
@@ -0,0 +1,39 @@
+# Macros for reducing debug info size using dwz(1) utility.
+
+# The two default values below should result in dwz taking at most
+# 3GB of RAM or so on 64-bit hosts and 2.5GB on 32-bit hosts
+# on the largest *.debug files (in mid 2012 those are
+# libreoffice-debuginfo, debuginfos containing
+# libxul.so.debug and libwebkitgtk-*.so.*.debug).
+# This needs to be tuned based on the amount of available RAM
+# on build boxes for each architecture as well as virtual address
+# space limitations if dwz is 32-bit program. While it needs less
+# memory than 64-bit program because pointers are smaller, it can
+# never have more than 4GB-epsilon of RAM and on some architecture
+# even less than that (e.g. 2GB).
+
+# Number of debugging information entries (DIEs) above which
+# dwz will stop considering file for multifile optimizations
+# and enter a low memory mode, in which it will optimize
+# in about half the memory needed otherwise.
+%_dwz_low_mem_die_limit 10000000
+# Number of DIEs above which dwz will stop processing
+# a file altogether.
+%_dwz_max_die_limit 50000000
+
+# On x86_64 increase the higher limit to make libwebkit* optimizable.
+# libwebkit* in mid 2012 contains roughly 87mil DIEs, and 64-bit
+# dwz is able to optimize it from ~1.1GB to ~410MB using 5.2GB of RAM.
+%_dwz_max_die_limit_x86_64 110000000
+
+# On ARM, build boxes often have only 512MB of RAM and are very slow.
+# Lower both the limits.
+%_dwz_low_mem_die_limit_armv5tel 4000000
+%_dwz_low_mem_die_limit_armv7hl 4000000
+%_dwz_max_die_limit_armv5tel 10000000
+%_dwz_max_die_limit_armv7hl 10000000
+
+%_dwz_limit() %{expand:%%{?%{1}_%{_arch}}%%{!?%{1}_%{_arch}:%%%{1}}}
+%_find_debuginfo_dwz_opts --run-dwz\\\
+ --dwz-low-mem-die-limit %{_dwz_limit _dwz_low_mem_die_limit}\\\
+ --dwz-max-die-limit %{_dwz_limit _dwz_max_die_limit}
diff --git a/find-debuginfo.sh b/find-debuginfo.sh
index 3427fdb..c2bc7df 100755
--- a/find-debuginfo.sh
+++ b/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 filelist]... [-p 'pattern'] -o debuginfo.list]
# [builddir]
@@ -29,6 +29,9 @@ strip_g=false
# with -r arg, pass --reloc-debug-sections to eu-strip.
strip_r=false
+# with -m arg, add minimal debuginfo to binary.
+include_minidebug=false
+
# Barf on missing build IDs.
strict=false
@@ -43,6 +46,9 @@ while [ $# -gt 0 ]; do
-g)
strip_g=true
;;
+ -m)
+ include_minidebug=true
+ ;;
-o)
if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then
out=$2
@@ -106,6 +112,32 @@ strip_to_debug()
[ -n "$DISABLE_DEBUG" ] || chmod 444 "$1" || exit
}
+add_minidebug()
+{
+ local debuginfo="$1"
+ local binary="$2"
+
+ local dynsyms=`mktemp`
+ local funcsyms=`mktemp`
+ local keep_symbols=`mktemp`
+ local mini_debuginfo=`mktemp`
+
+ # 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"
+ # Extract all the text (i.e. function) symbols from the debuginfo
+ nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") 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-section .gdb_index --remove-section .comment --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"
+ rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo"
+}
+
# Make a relative symlink to $1 called $3$2
shopt -s extglob
link_relative()
@@ -272,6 +304,9 @@ while read nlinks inum f; do
chmod u-w "$f"
fi
+ $include_minidebug && add_minidebug "${debugfn}" "$f"
+
+
if [ -n "$id" ]; then
make_id_link "$id" "$dn/$(basename $f)"
make_id_link "$id" "/usr/lib/debug$dn/$bn" .debug