Re: 2.6.7-mm6 - ppc32 inconsistent kallsyms data

Keith Owens
2004-07-06T07:31:54Z

On Tue, 06 Jul 2004 12:06:08 +1000,
Keith Owens <kaos@sgi.com> wrote:
>On Mon, 5 Jul 2004 16:38:18 -0400,
>jhf@rivenstone.net (Joseph Fannin) wrote:
>>On Mon, Jul 05, 2004 at 02:31:20AM -0700, Andrew Morton wrote:
>>> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.7/2.6.7-mm6/
>>
>> I'm getting this while building for ppc32:
>> Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS
>>
>> This didn't happen with -mm6.
>>
>> The help text for CONFIG_KALLSYMS_EXTRA_PASS says I should report a
>>bug, and reads like kallsyms is a utility or part of the toolchain;
>>I think it's talking about the kernel feature though, so I guess
>>I'll report it here. I'll keep this tree around in case any more
>>information is needed.
>
>Run these commands on the tree that needed CONFIG_KALLSYMS_EXTRA_PASS=y
>(assumes Bourne shell)
>
>for i in 1 2 3; do nm .tmp_kallsyms$i.o > .tmp_mapk$i; nm .tmp_vmlinux$i > .tmp_mapv$i; done
>tar cjvf /var/tmp/kallsyms.tar.bz2 .tmp_kallsyms* .tmp_vmlinux* .tmp_map*
>
>Send the tarball to me, not the list.

This is a real linker problem on ppc32. The linker automatically adds
_SDA_BASE_ and _SDA2_BASE_ symbols, these symbols are not defined in
vmlinux.lds.S. The SDA symbols move around as kallsyms data is added
between phases 1 and 2. That movement, together with the stem
compression (which depends on the immediately previous symbol) means
that the compressed symbol table changes size between phases 1 and 2,
which it is not supposed to do.

This problem has been there all along. It showed up now because I
added a test to verify that the kallsyms data is consistent after phase
2, instead of blindly assuming that it is stable. jhf, can you verify
that this patch removes the need for an extra kallsyms pass?

--- kallsyms-ppc32 ---

PPC small data area base symbols shift between kallsyms phases 1 and 2,
which makes the kallsyms data unstable. Exclude them from the kallsyms
list.

Signed-off-by: Keith Owens <kaos@sgi.com>

Index: 2.6.7-mm6/scripts/kallsyms.c
===================================================================
--- 2.6.7-mm6.orig/scripts/kallsyms.c 2004-07-06 17:26:14.000000000 +1000
+++ 2.6.7-mm6/scripts/kallsyms.c 2004-07-06 17:26:33.000000000 +1000
@@ -83,6 +83,11 @@ symbol_valid(struct sym_entry *s)
strcmp(s->sym, "kallsyms_names") == 0)
return 0;

+ /* Exclude linker generated symbols which vary between passes */
+ if (strstr(s->sym, "_SDA_BASE_") || /* ppc */
+ strcmp(s->sym, "_SDA2_BASE_") == 0) /* ppc */
+ return 0;
+
return 1;
}