find-provides.ksyms, find-requires.ksyms: work around printed __crc_* type change

Commit binutils-2_33~1385[1] has changed (and binutils-2_35~1768[2]
has not reverted) the calculated type for symbols in read-write .rodata section
from 'R' to 'D' on architectures where CONFIG_MODULE_REL_CRCS is enabled
(namely, ppc64* and s390*), since, apparently, many kernel modules have it indeed
read-write.  Work around it by matching both D and R as possible __crc_* symbol
type.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a288c270991d
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=49d9fd42acef

* find-provides.ksyms: Match D as possible __crc_* symbol type in
addition to R.
* find-requires.ksyms: Likewise.
* kernel-srpm-macros.spec (Release): Bump to 11%{?dist}.
(%changelog): Mention the change.

Resolves: #2055464
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
Eugene Syromiatnikov 2022-02-17 04:41:45 +01:00
parent 4eeb063077
commit 297a5b711f
2 changed files with 16 additions and 2 deletions

View File

@ -48,7 +48,14 @@ for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
else else
RODATA=$ELFRODATA RODATA=$ELFRODATA
fi fi
for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do # Commit binutils-2_33~1385[1] has changed (and binutils-2_35~1768[2]
# has not reverted it) the calculated type for symbols in read-write
# .rodata section from 'R' to 'D', since, apparently, many kernel
# modules have it indeed read-write.
#
# [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a288c270991d
# [2] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=49d9fd42acef
for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) [DR] __crc_(.+):0x\1 \2:p'); do
echo $sym $RODATA echo $sym $RODATA
done \ done \
| awk --non-decimal-data '{printf("'"${dep_pfx}"'(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \ | awk --non-decimal-data '{printf("'"${dep_pfx}"'(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \

View File

@ -48,7 +48,14 @@ all_provides() {
else else
RODATA=$ELFRODATA RODATA=$ELFRODATA
fi fi
for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do # Commit binutils-2_33~1385[1] has changed (and binutils-2_35~1768[2]
# has not reverted it) the calculated type for symbols in read-write
# .rodata section from 'R' to 'D', since, apparently, many kernel
# modules have it indeed read-write.
#
# [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a288c270991d
# [2] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=49d9fd42acef
for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) [DR] __crc_(.+):0x\1 \2:p'); do
echo $sym $RODATA echo $sym $RODATA
done \ done \
| awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}' | awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}'