Skip to content

Commit 51f6ad1

Browse files
Hello71thesamesam
authored andcommitted
estrip: Don't use splitdebug for .o files
As the process_ar comment explained, object files cannot be splitdebug. Bug: https://bugs.gentoo.org/787623 ("www-client/firefox[clang]: .gnu_debuglink is busted when using LLD") Fixes: 51579fb ("prepstrip: add support for elfutils strip") Signed-off-by: Alex Xu (Hello71) <[email protected]> Signed-off-by: Sam James <[email protected]>
1 parent 5c16a81 commit 51f6ad1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

bin/estrip

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,6 @@ dedup_elf_debug() {
280280

281281
# Usage: save_elf_debug <src> <inode_debug> [splitdebug]
282282
save_elf_debug() {
283-
${FEATURES_splitdebug} || return 0
284-
${PORTAGE_RESTRICT_splitdebug} && return 0
285-
286283
debug-print-function "${FUNCNAME}" "$@"
287284

288285
# NOTE: Debug files must be installed in
@@ -390,7 +387,7 @@ process_elf() {
390387

391388
if ${strip_this} ; then
392389
# See if we can split & strip at the same time
393-
if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then
390+
if ${splitdebug} && [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then
394391
local shortname="${x##*/}.debug"
395392
local splitdebug="${tmpdir}/splitdebug/${shortname}.${BASHPID:-$(__bashpid)}"
396393

@@ -401,7 +398,9 @@ process_elf() {
401398
"${x}"
402399
save_elf_debug "${x}" "${inode_link}_debug" "${splitdebug}"
403400
else
404-
save_elf_debug "${x}" "${inode_link}_debug"
401+
if ${splitdebug} ; then
402+
save_elf_debug "${x}" "${inode_link}_debug"
403+
fi
405404
${already_stripped} || ${STRIP} ${strip_flags} "${x}"
406405
fi
407406
fi
@@ -431,7 +430,7 @@ process_ar() {
431430
# There is no concept of splitdebug for objects not yet
432431
# linked in (only for finally linked ELFs), so we have to
433432
# retain the debug info in the archive itself.
434-
if ! ${FEATURES_splitdebug} || ${PORTAGE_RESTRICT_splitdebug} ; then
433+
if ! ${splitdebug} ; then
435434
${STRIP} -g "${x}" && ${RANLIB} "${x}"
436435
fi
437436
fi
@@ -542,6 +541,12 @@ do
542541
set +o noglob
543542
fi
544543

544+
if ${FEATURES_splitdebug} && ! ${PORTAGE_RESTRICT_splitdebug} ; then
545+
splitdebug=true
546+
else
547+
splitdebug=false
548+
fi
549+
545550
# In Prefix we are usually an unprivileged user, so we can't strip
546551
# unwritable objects. Make them temporarily writable for the
547552
# stripping.
@@ -564,6 +569,7 @@ do
564569
${f} == *"SB shared object"* ]] ; then
565570
process_elf "${x}" "${inode_link}" ${PORTAGE_STRIP_FLAGS}
566571
elif [[ ${f} == *"SB relocatable"* ]] ; then
572+
[[ ${x} == *.ko ]] || splitdebug=false
567573
process_elf "${x}" "${inode_link}" ${SAFE_STRIP_FLAGS}
568574
fi
569575

0 commit comments

Comments
 (0)