From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <nathan@kernel.org>,
Sedat Dilek <sedat.dilek@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH v2] kbuild: fix build failure by scripts/check-local-export
Date: Tue, 7 Jun 2022 07:13:27 +0900 [thread overview]
Message-ID: <8af7aebf-61ae-f126-57fa-8ff358c1841e@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <ce0b0a88-f8cb-ba9c-8a0e-1a818f8c50e0@I-love.SAKURA.ne.jp>
scripts/check-local-export fails with some versions of bash.
CC scripts/mod/empty.o
./scripts/check-local-export: line 54: wait: pid 17328 is not a child of this shell
make[2]: *** [scripts/mod/empty.o] Error 127
make[2]: *** Deleting file `scripts/mod/empty.o'
make[1]: *** [prepare0] Error 2
make: *** [__sub-make] Error 2
Avoid use of bash's built-in wait command, by saving the output from
nm command into a temporary variable.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 31cb50b5590fe911 ("kbuild: check static EXPORT_SYMBOL* by script instead of modpost")
---
Changes in v2:
llvm-nm can't use end-of-options argument, reported-by kernel test robot <lkp@intel.com>
scripts/check-local-export | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/scripts/check-local-export b/scripts/check-local-export
index da745e2743b7..850abc150855 100755
--- a/scripts/check-local-export
+++ b/scripts/check-local-export
@@ -11,9 +11,20 @@ set -e
declare -A symbol_types
declare -a export_symbols
+function die
+{
+ echo "$1" >&2
+ exit 1
+}
+
exit_code=0
-while read value type name
+# If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm)
+# shows 'no symbols' diagnostic and exits with 0. Saving such line into
+# symbol_types is fine because export_symbols will remain empty.
+result=$(${NM} ${1} 2>&1) || die "${result}"
+
+echo "${result}" | while read value type name
do
# Skip the line if the number of fields is less than 3.
#
@@ -37,21 +48,7 @@ do
if [[ ${name} == __ksymtab_* ]]; then
export_symbols+=(${name#__ksymtab_})
fi
-
- # If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm)
- # shows 'no symbols' diagnostic (but exits with 0). It is harmless and
- # hidden by '2>/dev/null'. However, it suppresses real error messages
- # as well. Add a hand-crafted error message here.
- #
- # Use --quiet instead of 2>/dev/null when we upgrade the minimum version
- # of binutils to 2.37, llvm to 13.0.0.
- #
- # Then, the following line will be really simple:
- # done < <(${NM} --quiet ${1})
-done < <(${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } )
-
-# Catch error in the process substitution
-wait $!
+done
for name in "${export_symbols[@]}"
do
--
2.18.4
next prev parent reply other threads:[~2022-06-06 22:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 5:49 5.19-rc1 build fails at scripts/check-local-export Tetsuo Handa
2022-06-06 7:34 ` Michael Ellerman
2022-06-06 15:26 ` [PATCH] kbuild: fix build failure by scripts/check-local-export Tetsuo Handa
2022-06-06 20:16 ` kernel test robot
2022-06-06 22:13 ` Tetsuo Handa [this message]
2022-06-07 8:34 ` [PATCH v2] " Masahiro Yamada
2022-06-07 10:11 ` Tetsuo Handa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8af7aebf-61ae-f126-57fa-8ff358c1841e@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=sedat.dilek@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).