Linux commit v5.19-rc1~139^2~2 ("kbuild: link symbol CRCs at final link,
removing CONFIG_MODULE_REL_CRCS") has broken the assumption aobut
the placement of non-absolute CRC symbols in .rodata (and also affects
the architectures that used to have these symbols as absolute); rewrite
the parsing by utilising "objdump -t" output to figure out
the section(s) where the __crc_* symbols are stored and process
it instead of the hard-coded ".rodata" section. The change also speeds
up the processing a bit, around 33% on synthetic tests:
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.ppc64le -name "*.ko.xz" | find-provides.ksyms.old > /dev/null 2> /dev/null'
sh -c 10.36s user 5.58s system 137% cpu 11.613 total
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.ppc64le -name "*.ko.xz" | find-provides.ksyms.new > /dev/null 2> /dev/null'
sh -c 7.82s user 4.59s system 142% cpu 8.686 total
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.ppc64le -name "*.ko.xz" -exec sh -c "echo {} | find-provides.ksyms.old" \; > /dev/null 2> /dev/null'
sh -c 11.85s user 6.76s system 129% cpu 14.318 total
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.ppc64le -name "*.ko.xz" -exec sh -c "echo {} | find-provides.ksyms.new" \; > /dev/null 2> /dev/null'
sh -c 8.91s user 5.51s system 135% cpu 10.647 total
* find-provides.ksyms: Process "objdump -t" output to get the list
of sections where __crc_* symbol contents are placed; retrieve
each one with "readelf -R" and supply it to an awk script that cuts
the required part of it for each __crc_* symbol in that section.
* find-requires.ksyms (all_provides): Likewise.
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Resolves: #2135047
Avoid running sed on the whole "nm" output and also avoid "sed | awk"
pipe in favor of a single awk call. Overall, this gives around 20%
speedup on some quick synthetic tests:
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.x86_64 -name "*.ko.xz" | find-provides.ksyms.old > /dev/null 2> /dev/null'
sh -c 14.20s user 8.93s system 144% cpu 16.014 total
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.x86_64 -name "*.ko.xz" | find-provides.ksyms.new > /dev/null 2> /dev/null'
sh -c 12.01s user 7.46s system 143% cpu 13.567 total
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.x86_64 -name "*.ko.xz" -exec sh -c "echo {} | find-provides.ksyms.old" \; > /dev/null 2> /dev/null'
sh -c 16.31s user 10.77s system 134% cpu 20.092 total
$ time sh -c 'find ./lib/modules/5.14.0-258.el9.x86_64 -name "*.ko.xz" -exec sh -c "echo {} | find-provides.ksyms.new" \; > /dev/null 2> /dev/null'
sh -c 13.95s user 8.92s system 135% cpu 16.836 total
* find-provides.ksyms: Check presence of absolute __crc_* symbols with
"grep -q" exit code and not presence of sed output; rewrite awk script to match
the __crc_* symbols instead of preprocessing the nm output with sed.
* find-requires.ksyms: Likewise.
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Resolves: #2135047
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>
It leads to some regressions in requires generation precision, though,
as it is no longer possible to exclude requires that are satisfied
by other kmods in the package. And calling a script on each file (instead
of calling it on the whole file list at once) does not make things faster,
either (so much for "sanity and benefit").
* find-provides.ksyms: Check for "$@" as well.
* find-requires.ksyms: Likewise.
* kernel-srpm-macros.spec (Source104, Source105, Source106): New
attribute files.
(%install): Install firmware.prov and modalias.prov with executable bit;
install provided_ksyms.attr, required_ksyms.attr, and modalias.attr into
"%{buildroot}%{_fileattrsdir}".
(%files -n kernel-rpm-macros): Add provided_ksyms.attr,
required_ksyms.attr, and modalias.attr.
kmodtool: Remove "%global _use_internal_dependency_generator 0".
macros.kmp: Remove %__find_provides and %__find_requires.
* modalias.attr: New file.
* provided_ksyms.attr: Likewise.
* required_ksyms.attr: Likewise.
Resolves: #1942072Resolves: #1942563
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
- Add support for compressed kernel modules to find-provides.ksyms,
find-requires.ksyms, firmware.prov (#1622019)
* find-provides.ksyms: Try to process files whose names end with
something else than "*.ko" by guessing a decompressor and uncompressing
it in a temporary file and parsing it instead.
* find-requires.ksyms (all_provides): Likewise.
Add "(\.gz|\.bz2|\.xz)?" to the end of the module path matching regular
expression.
* firmware.prov: Add "(\.gz|\.bz2|\.xz)?" to the end of the module path
matching regular expression.
Resolves: #1942537
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Generate colon-separated pairs of symbol_name:version and then run joins
over them instead over just symbol names.
Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
No changes are being made to the individual files added here; they're
1:1 copies of the ones in redhat-rpm-config.
Note the kernel-rpm-macros version - the latest c9s build is versioned
after its parent SRPM which is redhat-rpm-config-184-1, so we need to
make this one NVR-newer to allow for clean upgrades.
The respective removals from redhat-rpm-config are tracked in #1959924.
Resolves: #1959914