separateDebugInfo: don't create broken symlinks

This commit is contained in:
K900
2025-01-31 19:56:27 +03:00
parent 1ddebfed93
commit 6a12ab0c22

View File

@@ -43,10 +43,11 @@ _separateDebugInfo() {
then
echo "separate-debug-info: warning: multiple files with build id $id found, overwriting"
fi
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug"
# Also a create a symlink <original-name>.debug.
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
(
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug" &&
# Also a create a symlink <original-name>.debug.
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
)
) || rmdir -p "$dst/${id:0:2}"
done < <(find "$prefix" -type f -print0 | sort -z)
}