From: Guenter Roeck <linux@roeck-us.net>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH] kbuild: Try up to eight kallsyms link passes
Date: Thu, 10 Sep 2020 08:32:04 -0700 [thread overview]
Message-ID: <20200910153204.156871-1-linux@roeck-us.net> (raw)
Since v5.8, powerpc:allmodconfig often fails to build with the following
error message.
Inconsistent kallsyms data
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
Setting KALLSYMS_EXTRA_PASS=1 does not help. As it turns out, the build
currently needs up to four link passes to succeed.
Similar problems have been observed over time for other architectures.
Make the number of link passes dynamic to solve the problem. Try up to
eight passes before giving up. If KALLSYMS_EXTRA_PASS is set, add one
additional pass after succeeding.
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
scripts/link-vmlinux.sh | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index e6e2d9e5ff48..72abdee0e649 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -316,11 +316,10 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
# From here, we generate a correct .tmp_kallsyms2.o
# 3) That link may have expanded the kernel image enough that
# more linker branch stubs / trampolines had to be added, which
- # introduces new names, which further expands kallsyms. Do another
- # pass if that is the case. In theory it's possible this results
- # in even more stubs, but unlikely.
- # KALLSYMS_EXTRA_PASS=1 may also used to debug or work around
- # other bugs.
+ # introduces new names, which further expands kallsyms. Try up
+ # to eight passes to handle that situation before giving up.
+ # KALLSYMS_EXTRA_PASS=1 may be used to add an extra step
+ # for debugging or to work around other bugs.
# 4) The correct ${kallsymso} is linked into the final vmlinux.
#
# a) Verify that the System.map from vmlinux matches the map from
@@ -329,13 +328,21 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
kallsyms_step 1
kallsyms_step 2
- # step 3
- size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
- size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
-
- if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
- kallsyms_step 3
- fi
+ # step n
+ step=3
+ while [ $step -le 8 ]; do
+ size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
+ size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
+
+ if [ $size1 -eq $size2 ]; then
+ if [ -z "${KALLSYMS_EXTRA_PASS}" ]; then
+ break
+ fi
+ KALLSYMS_EXTRA_PASS=""
+ fi
+ kallsyms_step $step
+ step="$(expr $step + 1)"
+ done
fi
vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
--
2.17.1
next reply other threads:[~2020-09-10 19:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 15:32 Guenter Roeck [this message]
2020-09-22 3:29 ` [PATCH] kbuild: Try up to eight kallsyms link passes Guenter Roeck
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=20200910153204.156871-1-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=geert@linux-m68k.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
/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).