From 4ecf0dd22fe0240516bc76d5b96d66526ca7c89f Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Tue, 16 May 2023 10:45:00 +0200 Subject: [PATCH] find-provides.ksyms, find-requires.ksyms: match only the section being processed Instead of ignoring the section name in the objdump -t output, section name has to be checked in the awk script to produce only the meaningful output; hit when both __kcrctab and __kcrctab_gpl are present. * find-requires.ksyms (all_provides): Pass $sectname to the awk script, check that the relevant field of the input matches it. * find-provides.ksyms: Likewise. Resolves: #2178935 Signed-off-by: Eugene Syromiatnikov --- find-provides.ksyms | 3 ++- find-requires.ksyms | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/find-provides.ksyms b/find-provides.ksyms index f9c40ca..56ee862 100755 --- a/find-provides.ksyms +++ b/find-provides.ksyms @@ -63,8 +63,9 @@ for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do | awk \ -v 'dep_pfx='"$dep_pfx" \ -v 'sectdata='"$SECTDATA" \ + -v 'sectname='"$sectname" \ --non-decimal-data \ - 'match($0, /^([0-9a-f]+) [gl]...... .* [0-9a-f]+ __crc_(.*)$/, a) { printf("%s(%s) = 0x%08s\n", dep_pfx, a[2], substr(sectdata, (strtonum("0x" a[1]) * 2) + 1, 8)) }' + 'match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) && a[2] == sectname { printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata, (strtonum("0x" a[1]) * 2) + 1, 8)) }' done \ | sort -u fi diff --git a/find-requires.ksyms b/find-requires.ksyms index a407f23..25fd02a 100755 --- a/find-requires.ksyms +++ b/find-requires.ksyms @@ -63,8 +63,9 @@ all_provides() { | awk \ -v 'dep_pfx='"$dep_pfx" \ -v 'sectdata='"$SECTDATA" \ + -v 'sectname='"$sectname" \ --non-decimal-data \ - 'match($0, /^([0-9a-f]+) [gl]...... .* [0-9a-f]+ __crc_(.*)$/, a) { printf("%s(%s) = 0x%08s\n", dep_pfx, a[2], substr(sectdata, (strtonum("0x" a[1]) * 2) + 1, 8)) }' + 'match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) && a[2] == sectname { printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata, (strtonum("0x" a[1]) * 2) + 1, 8)) }' done fi