# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/binutils/parse-config # Copyright (C) 2007 - 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 # --- T2-COPYRIGHT-END --- split_debug() { local tmp="$(mktemp)" # intermediate file pushd $root echo "Splitting debug information" # guard against already existing debug files grep -v "[.]debug$" $builddir/flist.txt | while read f; do # skip if symbolic version link [ -L "$f" ] && continue local dbg="$root/${f/\/bin\//\/bin\/.}.debug" # skip if not an object file $OBJCOPY --only-keep-debug "$f" "$tmp" 2>/dev/null || continue mv "$tmp" "$dbg" # TODO: atomic $OBJCOPY --strip-debug "$f" (cd ${f%/*}; $OBJCOPY --add-gnu-debuglink="${dbg##*/}" "${f##*/}") add_flist "$dbg" done rm $tmp popd } [ "$SDECFG_DEBUG_SEPARATE" = 1 ] && hook_add postflist 5 split_debug