From 0a8324122a48fe9811ab118f7f6ae3cf65416e0c 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. 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 74556e9..e5f139c 100755 --- a/find-provides.ksyms +++ b/find-provides.ksyms @@ -62,8 +62,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 13bad46..4f17abb 100755 --- a/find-requires.ksyms +++ b/find-requires.ksyms @@ -62,8 +62,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