kbuild: kallsyms allow 3-pass generation if symbols size has changed
kallsyms generation is not foolproof, due to some linkers adding symbols (e.g., branch trampolines) when a binary size changes. Have it attempt a 3rd pass automatically if the kallsyms size changes in the 2nd pass. This allows powerpc64 allyesconfig to build without adding another pass when it's not required. This can be solved other ways by directing the linker not to add labels on branch stubs, or to move kallsyms near the end of the image. The former is undesirable for debugging/tracing, and the latter is a more significant change that requires more testing and review. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>zero-colors
parent
1001354ca3
commit
7e2b37c971
|
@ -246,10 +246,14 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
|
||||||
# the right size, but due to the added section, some
|
# the right size, but due to the added section, some
|
||||||
# addresses have shifted.
|
# addresses have shifted.
|
||||||
# From here, we generate a correct .tmp_kallsyms2.o
|
# From here, we generate a correct .tmp_kallsyms2.o
|
||||||
# 2a) We may use an extra pass as this has been necessary to
|
# 3) That link may have expanded the kernel image enough that
|
||||||
# woraround some alignment related bugs.
|
# more linker branch stubs / trampolines had to be added, which
|
||||||
# KALLSYMS_EXTRA_PASS=1 is used to trigger this.
|
# introduces new names, which further expands kallsyms. Do another
|
||||||
# 3) The correct ${kallsymso} is linked into the final vmlinux.
|
# 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.
|
||||||
|
# 4) The correct ${kallsymso} is linked into the final vmlinux.
|
||||||
#
|
#
|
||||||
# a) Verify that the System.map from vmlinux matches the map from
|
# a) Verify that the System.map from vmlinux matches the map from
|
||||||
# ${kallsymso}.
|
# ${kallsymso}.
|
||||||
|
@ -265,8 +269,11 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
|
||||||
vmlinux_link .tmp_kallsyms1.o .tmp_vmlinux2
|
vmlinux_link .tmp_kallsyms1.o .tmp_vmlinux2
|
||||||
kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
|
kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
|
||||||
|
|
||||||
# step 2a
|
# step 3
|
||||||
if [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
|
size1=$(stat -c "%s" .tmp_kallsyms1.o)
|
||||||
|
size2=$(stat -c "%s" .tmp_kallsyms2.o)
|
||||||
|
|
||||||
|
if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
|
||||||
kallsymso=.tmp_kallsyms3.o
|
kallsymso=.tmp_kallsyms3.o
|
||||||
kallsyms_vmlinux=.tmp_vmlinux3
|
kallsyms_vmlinux=.tmp_vmlinux3
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue