summaryrefslogtreecommitdiffstats
path: root/scripts/gen_autoksyms.sh
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-04-07 00:30:20 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-08 03:16:59 +0900
commit9413e7640564fe70b24ea1a9ff3fb92c5bb52fcb (patch)
treeefb106529373b6c24577df146c8e3afc90fe0e8e /scripts/gen_autoksyms.sh
parentb3591e061919c837c14680c1ceff8f009ed0afb4 (diff)
downloadlinux-9413e7640564fe70b24ea1a9ff3fb92c5bb52fcb.tar.bz2
kbuild: split the second line of *.mod into *.usyms
The *.mod files have two lines; the first line lists the member objects of the module, and the second line, if CONFIG_TRIM_UNUSED_KSYMS=y, lists the undefined symbols. Currently, we generate *.mod after constructing composite modules, otherwise, we cannot compute the second line. No prerequisite is required to print the first line. They are orthogonal. Splitting them into separate commands will ease further cleanups. This commit splits the list of undefined symbols out to *.usyms files. Previously, the list of undefined symbols ended up with a very long line, but now it has one symbol per line. Use sed like we did before commit 7d32358be8ac ("kbuild: avoid split lines in .mod files"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/gen_autoksyms.sh')
-rwxr-xr-xscripts/gen_autoksyms.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh
index 120225c541c5..faacf7062122 100755
--- a/scripts/gen_autoksyms.sh
+++ b/scripts/gen_autoksyms.sh
@@ -2,13 +2,10 @@
# SPDX-License-Identifier: GPL-2.0-only
# Create an autoksyms.h header file from the list of all module's needed symbols
-# as recorded on the second line of *.mod files and the user-provided symbol
-# whitelist.
+# as recorded in *.usyms files and the user-provided symbol whitelist.
set -e
-output_file="$1"
-
# Use "make V=1" to debug this script.
case "$KBUILD_VERBOSE" in
*1*)
@@ -16,6 +13,15 @@ case "$KBUILD_VERBOSE" in
;;
esac
+read_modorder=
+
+if [ "$1" = --modorder ]; then
+ shift
+ read_modorder=1
+fi
+
+output_file="$1"
+
needed_symbols=
# Special case for modversions (see modpost.c)
@@ -41,10 +47,8 @@ cat > "$output_file" << EOT
EOT
-[ -f modules.order ] && modlist=modules.order || modlist=/dev/null
-
{
- sed 's/ko$/mod/' $modlist | xargs -n1 sed -n -e '2p'
+ [ -n "${read_modorder}" ] && sed 's/ko$/usyms/' modules.order | xargs cat
echo "$needed_symbols"
[ -n "$ksym_wl" ] && cat "$ksym_wl"
} | sed -e 's/ /\n/g' | sed -n -e '/^$/!p' |