Subject: [PATCH] Kallsyms problems (was: Re: linux-next: arm build failures)

From: Stephen Rothwell <[email-masked]>
Date: Sat, 20 Jun 2009 15:54:40 +1000

Hi Russell,

On Fri, 19 Jun 2009 16:13:21 +0100 Russell King <[email-masked]> wrote:
>
> On Wed, Jun 17, 2009 at 11:08:04PM +1000, Stephen Rothwell wrote:
> > 
> > On Wed, 17 Jun 2009 09:34:31 +0100 Catalin Marinas <[email-masked]> wrote:
> > >
> > > Stephen Rothwell <[email-masked]> wrote:
> > > > Over the past few days, I have started getting some arm configs (at least
> > > > iop13xx_defconfig and integrator_defconfig, but some others) failing to
> > > > build getting this error:
> > > >
> > > >   SYSMAP  System.map
> > > >   SYSMAP  .tmp_System.map
> > > > Inconsistent kallsyms data
> > > > Try setting CONFIG_KALLSYMS_EXTRA_PASS
> > > >
> > > > Is this something you have seen?  Could it be my toolchain (I am
> > > > currently using gcc 4.4.0 and have not changed it recently)?
> > > 
> > > I reported an error with kallsysms on ARM this Monday leading to
> > > inconsistent data:
> > > 
> > > http://lkml.org/lkml/2009/6/15/233
> > > 
> > > Could it be related?
> > 
> > Could be.  I have added the proposed fix patch to my fixes tree until
> > Linus or Sam gets around to including it.
> 
> No, I don't think it's got anything to do with it.  It's the kallsyms
> generator that's getting confused.
> 
> What's happening is that we're ending up with differences between the
> symbolic information generated for .tmp_vmlinux2 and vmlinux:

I do wonder if the above could be the root cause, though.  Since I added
the added the fix mentioned above to linux-next, my arm builds have not
failed do to this problem.  Or maybe this "fix" just works around another
problem?

In any case, it would be nice if the fix (repeated below) could be sent
to Linus by someone (it also fixes a problem that Dave Miller is seeing).
-- 
Cheers,
Stephen Rothwell                    [email-masked]
http://www.canb.auug.org.au/~sfr/

From: Mike Frysinger <[email-masked]>
Date: Mon, 15 Jun 2009 07:52:48 -0400
Subject: [PATCH] kallsyms: fix inverted valid symbol checking

The previous commit (17b1f0de) introduced a slightly broken consolidation
of the memory text range checking.

Signed-off-by: Mike Frysinger <[email-masked]>
---
 scripts/kallsyms.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 3cb5789..64343cc 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -167,11 +167,11 @@ static int symbol_valid_tr(struct sym_entry *s)
 	for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
 		tr = &text_ranges[i];
 
-		if (s->addr >= tr->start && s->addr < tr->end)
-			return 0;
+		if (s->addr >= tr->start && s->addr <= tr->end)
+			return 1;
 	}
 
-	return 1;
+	return 0;
 }
 
 static int symbol_valid(struct sym_entry *s)
-- 
1.6.3.1