blob: 23cf1737a699ae3fca6cb6c1dd939311a09987f8 [file] [log] [blame]
From 90f494bc82b3fb312f50f126b4b2b4b642ff4182 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <linux@roeck-us.net>
Date: Wed, 9 Jun 2021 05:43:06 -0700
Subject: [PATCH] CHROMIUM: kallsyms: Display differences between kallsyms
passes
When kallsyms passes result in differences which cause build failures, it is
difficult to identify offending symbols. Display symbol file differences to
help tracking down the problem.
This patch is intended to be a temporary measure to track down the symbol
file differences and to determine if useful output can be generated. Once
we know this, the plan is to submit a cleaned up version of this patch into
the upstream kernel.
BUG=b:187795050
TEST=Kernel build
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Change-Id: I0f7e80daac1537d2d8c5b722750ad1a44e3f4c08
Signed-off-by: Guenter Roeck <groeck@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2949947
---
scripts/link-vmlinux.sh | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index f7b2503cdba95610e210de1da71fa5f56d03600a..f63a02a40b96c5554b251bee0800e8b39750b743 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -163,6 +163,19 @@ kallsyms()
info KSYMS "${2}.S"
scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"
+kallsyms_diff()
+{
+ if [ "${quiet}" != "silent_" ]; then
+ local ksym_prev="${kallsymso_prev}.sym"
+ local ksym="${kallsymso}.sym"
+
+ echo "Symbol file differences:"
+ objdump --syms "${kallsymso_prev}" > "${ksym_prev}"
+ objdump --syms "${kallsymso}" > "${ksym}"
+ diff -I ".tmp_vmlinux.kallsyms" -u "${ksym_prev}" "${ksym}"
+ fi
+}
+
info AS "${2}.o"
${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \
${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} -c -o "${2}.o" "${2}.S"
@@ -279,6 +292,13 @@ if is_enabled CONFIG_KALLSYMS; then
if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
vmlinux_link .tmp_vmlinux3
sysmap_and_kallsyms .tmp_vmlinux3
+ size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
+ size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
+ fi
+
+ # Display symbol file differences if they will result in a build failure
+ if [ $size1 -ne $size2 ]; then
+ kallsyms_diff
fi
fi
@@ -307,6 +327,8 @@ if is_enabled CONFIG_KALLSYMS; then
if ! cmp -s System.map "${kallsyms_sysmap}"; then
echo >&2 Inconsistent kallsyms data
echo >&2 'Try "make KALLSYMS_EXTRA_PASS=1" as a workaround'
+ echo >&2 System.map differences:
+ diff -u System.map .tmp_System.map >&2
exit 1
fi
fi
--
2.46.0.rc2.264.g509ed76dc8-goog