From 3ae079dc5650e5af73516198b429d56d9131d637 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 13 Jan 2012 14:34:58 -0500 Subject: add support for compressing debug sections to save space Since binutils/gdb can compress the .debug* sections with zlib into .zdebug*, we should be able to save quite a bit of space -- on my system, I saw /usr/lib/debug/ go from ~20GB to ~7.5GB. This requires binutils/gdb to be built with USE=zlib which is why this defaults to off. Signed-off-by: Mike Frysinger --- bin/ebuild-helpers/prepstrip | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index ee547f235..daaa25250 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -15,7 +15,7 @@ exp_tf() { eval ${var}_${flag}=$(tf has ${flag} ${!var}) done } -exp_tf FEATURES installsources nostrip splitdebug +exp_tf FEATURES compressdebug installsources nostrip splitdebug exp_tf RESTRICT binchecks installsources strip [[ " ${FEATURES} " == *" force-prefix "* ]] || \ @@ -121,7 +121,9 @@ save_elf_debug() { if [[ -e ${T}/prepstrip.split.debug ]] ; then mv "${T}"/prepstrip.split.debug "${y}" else - ${OBJCOPY} --only-keep-debug "${x}" "${y}" + local objcopy_flags="--only-keep-debug" + ${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections" + ${OBJCOPY} ${objcopy_flags} "${x}" "${y}" ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}" fi local args="a-x,o-w" -- cgit v1.2.3-1-g7c22