Due to Debian bug #950254 the hook-functions copies libgcc_s.so.1 into the initramfs image. But this breaks architectures which ship other versions of libgcc_s, e.g. hppa (libgcc_s.so.4) or m68k (libgcc_s.so.2).
Fix it by searching the relevant libgcc_so files. The fix is modelled after the btrfs hook functions in /usr/share/initramfs-tools/hooks/btrfs. Tested on hppa. Signed-off-by: Helge Deller <del...@gmx.de> Noticed-by: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959768 Fixes: f2ac13e8881f ("hook-functions: copy_exec: Copy libgcc_s.so.0 along with libpthread.so") diff -up ./hook-functions.org ./hook-functions --- ./hook-functions.org 2020-05-27 21:57:26.994595173 +0000 +++ ./hook-functions 2020-05-27 21:57:30.182574623 +0000 @@ -182,7 +182,7 @@ copy_file() { # Location of the image dir is assumed to be $DESTDIR # We never overwrite the target if it exists. copy_exec() { - local src target x nonoptlib ret + local src target x nonoptlib ret libgcc src="${1}" target="${2:-$1}" @@ -209,7 +209,10 @@ copy_exec() { # Handle common dlopen() dependency (Debian bug #950254) case "${x}" in */libpthread.so.*) - copy_exec "${x%/*}/libgcc_s.so.1" || return + LIBC_DIR=$(dirname "${x}") + find -L "$LIBC_DIR" -maxdepth 1 -name 'libgcc_s.*' -type f | while read -r libgcc; do + copy_exec "${libgcc}" || return + done ;; esac