debuginfo: strip --reloc-debug-sections for kernel modules

`--reloc-debug-sections` resolves trivial relocs between debug
sections and designed for use on kernel modules debug (.ko.debug)
reducing their sizes.
This commit is contained in:
Виталий Чикунов 2020-12-15 04:36:52 +03:00
parent f5fcb8f43d
commit 457fef1d64

View File

@ -18,9 +18,11 @@ mkdir -p .tmp
f=$1
rezip=
elfcompress=
strip_rel=
if [ -z "${f#./lib/modules/*.ko}" ]; then
elfcompress=yes
strip_rel="--reloc-debug-sections"
elif [ -z "${f#./lib/modules/*.ko.[gx]z}" ]; then
rezip=${f##*.}
rezip=${rezip/gz/gzip}
@ -28,6 +30,7 @@ elif [ -z "${f#./lib/modules/*.ko.[gx]z}" ]; then
$rezip --decompress --force "$f"
f=${f%.[gx]z}
elfcompress=yes
strip_rel="--reloc-debug-sections"
elif [ -z "${f##./boot/vmlinuz-*}" ]; then
# Compressed kernel: trigger extraction of vmlinux from the source.
kver=${f#./boot/vmlinuz-}
@ -81,7 +84,7 @@ if [ ! -s .tmp/src.$$ ] && [ -x /usr/bin/eu-elfcompress ]; then
fi
if [ -n "$strip" ]; then
mkdir -p "${debugf%/*}"
LD_ORIGIN_PATH=/usr/bin eu-strip $strip --remove-comment -f "$debugf" "$f"
LD_ORIGIN_PATH=/usr/bin eu-strip $strip $strip_rel --remove-comment -f "$debugf" "$f"
if [ -n "$elfcompress" ] && [ -x /usr/bin/eu-elfcompress ]; then
LD_ORIGIN_PATH=/usr/bin eu-elfcompress --quiet "$debugf"