process-debuginfo: Add .gnu_debuglink symlink for vmlinux

`eu-strip --strip-all` started to strip .symtab for un-def kernel
triggering different code path in crash(8) thus making it follow
value of `.gnu_debuglink` section and miss vmlinux.debug.

Also, this seems to be more portable overall - we can find vmlinux by
prepending `/usr/lib/debug` or by appending `.debug`.

With educated guess we assume eu-strip will put "BASENAME.debug" in
`.gnu_debuglink`.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
Виталий Чикунов 2023-11-17 04:43:09 +03:00
parent d92345495d
commit 894f4140ce
2 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,9 @@ while read -r f; do
else
Warning "Expected $f not found."
fi
if [ -L ".$f.debug" ] && [ -e ".$f.debug" ]; then
printf '%s\n' "$f.debug" >> .tmp/links
fi
fi
fbin=$f # Actual binary for linking

View File

@ -20,6 +20,7 @@ rezip=
elfcompress=
strip_rel=
strip_btf='--keep-section=.BTF'
debuglink=
if [ -z "${f#./lib/modules/*.ko}" ]; then
elfcompress=yes
@ -56,6 +57,7 @@ elif [ -z "${f##./boot/vmlinuz-*}" ]; then
if [ -f "$vmlinuxs" ]; then
install -pD -m644 "$vmlinuxs" "$vmlinuxd"
f=$vmlinuxd
debuglink="$vmlinuxd.debug"
else
Warning "vmlinux not found in $RPM_BUILD_DIR for -debuginfo"
exit
@ -104,6 +106,7 @@ fi
if [ -n "$strip" ]; then
mkdir -p "${debugf%/*}"
LD_ORIGIN_PATH=/usr/bin eu-strip $strip $strip_rel $strip_btf --remove-comment -f "$debugf" "$f"
[ -z "$debuglink" ] || ln -sr "$debugf" "$debuglink"
if [ -n "$elfcompress" ] && [ -x /usr/bin/eu-elfcompress ]; then
LD_ORIGIN_PATH=/usr/bin eu-elfcompress --quiet "$debugf"