New debugedit support for FEATURES=splitdebug, by Sven Wegener:
authorZac Medico <zmedico@gentoo.org>
Wed, 10 Sep 2008 20:46:05 +0000 (20:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 10 Sep 2008 20:46:05 +0000 (20:46 -0000)
This will create new-style buildid symlinks for the splitted debuginfo and also
a symlink to the binary that belongs to the debuginfo. Requires debugedit from
rpm 5. Old versions of debugedit ignore all unkown command line arguments, so
this is a no-op for them.

Information: http://fedoraproject.org/wiki/Releases/FeatureBuildId
New debugedit tarball: http://dev.gentoo.org/~swegener/distfiles/debugedit-5.0.0.tar.bz2

svn path=/main/trunk/; revision=11500

bin/prepstrip

index bc2fa79cf08be6bc4d93aea1126e6e61ec4ae7c6..33bdb220991795414a9b90b544ef778e7adf7b9b 100755 (executable)
@@ -56,12 +56,23 @@ save_elf_debug() {
        # dont save debug info twice
        [[ ${x} == *".debug" ]] && return 0
 
+       # this will recompute the build-id, but for now that's ok
+       local buildid="$( type -P debugedit >/dev/null && debugedit -i "${x}" )"
+
        mkdir -p $(dirname "${y}")
        ${OBJCOPY} --only-keep-debug "${x}" "${y}"
        ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
        [[ -g ${x} ]] && chmod go-r "${y}"
        [[ -u ${x} ]] && chmod go-r "${y}"
        chmod a-x,o-w "${y}"
+
+       if [[ -n ${buildid} ]] ; then
+               local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}"
+               local buildid_file="${buildid_dir}/${buildid:2}"
+               mkdir -p "${buildid_dir}"
+               ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug"
+               ln -s "/${x:${#D}}" "${buildid_file}"
+       fi
 }
 
 # The existance of the section .symtab tells us that a binary is stripped.