Save sources for all ELF types. Only splitdebug and strip relocatables that are kernel modules. This way we keep the debug information in regular relocatables (like /usr/lib/crt1.o) so that they end up in binaries when linked in. Index: bin/prepstrip =================================================================== --- bin/prepstrip (revision 7189) +++ bin/prepstrip (working copy) @@ -25,9 +25,8 @@ banner=1 -save_elf_debug() { +save_elf_sources() { local x=$1 - local y="${D}usr/lib/debug/${x:${#D}}.debug" if hasq installsources ${FEATURES} && [ -x /usr/bin/debugedit ] ; then local sources_dir=/usr/src/debug/${CATEGORY}/${PF} @@ -40,12 +39,17 @@ rsync -rtL0 --files-from=- "${WORKDIR}/" "${D}${sources_dir}/" ) fi fi +} +save_elf_debug() { + local x=$1 + local y="${D}usr/lib/debug/${x:${#D}}.debug" + hasq splitdebug ${FEATURES} || return 0 [[ -z "${NOSTRIP}" ]] || return 0 # dont save debug info twice. - [[ ${x:7} == ".debug" ]] && return 0 + [[ ${x: -6} == ".debug" ]] && return 0 mkdir -p $(dirname "${y}") ${OBJCOPY} --only-keep-debug "${x}" "${y}" @@ -87,18 +91,22 @@ done set +o noglob + [[ -n ${NOSTRIP} ]] && stripitbaby=0 + if [[ ${f} == *"current ar archive"* ]] ; then vecho " ${x:${#D}}" - [[ -n ${NOSTRIP} ]] && continue [[ ${stripitbaby} -eq 1 ]] && ${STRIP} -g "${x}" - elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* || ${f} == *"SB relocatable"* ]] ; then + elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then vecho " ${x:${#D}}" - [[ ${f} != *"SB relocatable"* ]] && save_elf_debug "${x}" - [[ -n ${NOSTRIP} ]] && continue - if [[ ${stripitbaby} -eq 1 ]] ; then - [[ ${f} == *"SB relocatable"* ]] \ - && ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" \ - || ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" + save_elf_sources "${x}" + save_elf_debug "${x}" + [[ ${stripitbaby} -eq 1 ]] && ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" + elif [[ ${f} == *"SB relocatable"* ]] ; then + vecho " ${x:${#D}}" + save_elf_sources "${x}" + if [[ ${x: -3} == ".ko" ]] ; then + save_elf_debug "${x}" + [[ ${stripitbaby} -eq 1 ]] && ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" fi fi done