linux-mips
[Top] [All Lists]

Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symb

To: Andrew Morton <akpm@linux-foundation.org>, ralf@linux-mips.org
Subject: Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols)
From: Yoshinori Sato <ysato@users.sourceforge.jp>
Date: Fri, 12 Sep 2008 15:28:56 -0400
Cc: Hugh Dickins <hugh@veritas.com>, Paulo Marques <pmarques@grupopie.com>, lkml <linux-kernel@vger.kernel.org>, linux-mips@linux-mips.org
In-reply-to: <87y722qaoy.wl%ysato@users.sourceforge.jp>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <87fxphzan5.wl%ysato@users.sourceforge.jp> <489AE3C5.2000807@grupopie.com> <87zlnotn2l.wl%ysato@users.sourceforge.jp> <20080907235627.293b0a4b.akpm@linux-foundation.org> <87vdx673sw.wl%ysato@users.sourceforge.jp> <Pine.LNX.4.64.0809090034570.16820@blonde.site> <87y722qaoy.wl%ysato@users.sourceforge.jp>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/22.2 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)
At Mon, 08 Sep 2008 23:07:09 -0400,
Yoshinori Sato wrote:
> 
> At Tue, 9 Sep 2008 00:39:40 +0100 (BST),
> Hugh Dickins wrote:
> > 
> > On Mon, 8 Sep 2008, Yoshinori Sato wrote:
> > > At Sun, 7 Sep 2008 23:56:27 -0700,
> > > Andrew Morton wrote:
> > > > 
> > > > This patch broke kallsyms on powerpc.  Please see
> > > > http://ozlabs.org/pipermail/linuxppc-dev/2008-September/062549.html
> > > 
> > > Hmm...
> > > h8300 local symbol head of '.L'.
> > > But powerpc don't have '.L' pattern.
> > > I think add condition "str[1] == 'L'".
> > 
> > No, that won't work right on PowerPC if there's function called
> > something like LookUpTable: we want the symbol ".LookUpTable".
> > 
> > Hugh
> 
> OK.
> This case can't pattern match.
> I Add h8300 special mode.
> 
> -- 
> Yoshinori Sato
> <ysato@users.sourceforge.jp>

It's OK?
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index a556447..644beb6 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -37,6 +37,7 @@ KBUILD_CFLAGS += -D__linux__
 KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
 KBUILD_AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y)
 LDFLAGS += $(ldflags-y)
+KALLSYMS += --symbol-prefix='_' --exclude-prefix='.'
 
 CROSS_COMPILE = h8300-elf-
 LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 9aab51c..582fb2e 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -649,6 +649,8 @@ core-y                      += arch/mips/kernel/ 
arch/mips/mm/ arch/mips/math-emu/
 
 drivers-$(CONFIG_OPROFILE)     += arch/mips/oprofile/
 
+KSYMALL += --exclude-prefix='$'
+
 ifdef CONFIG_LASAT
 rom.bin rom.sw: vmlinux
        $(Q)$(MAKE) $(build)=arch/mips/lasat/image $@
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index ad2434b..7e0d79d 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -37,6 +37,7 @@ static unsigned int table_size, table_cnt;
 static unsigned long long _text, _stext, _etext, _sinittext, _einittext;
 static int all_symbols = 0;
 static char symbol_prefix_char = '\0';
+static char exclude_prefix_char = '\0';
 
 int token_profit[0x10000];
 
@@ -47,7 +48,10 @@ unsigned char best_table_len[256];
 
 static void usage(void)
 {
-       fprintf(stderr, "Usage: kallsyms [--all-symbols] 
[--symbol-prefix=<prefix char>] < in.map > out.S\n");
+       fprintf(stderr, "Usage: kallsyms [--all-symbols]"
+                       " [--symbol-prefix=<prefix char>]"
+                       " [--exclude-prefix=<prefix char>]"
+                       " < in.map > out.S\n");
        exit(1);
 }
 
@@ -105,8 +109,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
        else if (toupper(stype) == 'U' ||
                 is_arm_mapping_symbol(sym))
                return -1;
-       /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
-       else if (str[0] == '$')
+       /* exclude also local symbols */
+       else if (exclude_prefix_char && str[0] == exclude_prefix_char)
                return -1;
        /* exclude debugging symbols */
        else if (stype == 'N')
@@ -543,6 +547,12 @@ int main(int argc, char **argv)
                                if ((*p == '"' && *(p+2) == '"') || (*p == '\'' 
&& *(p+2) == '\''))
                                        p++;
                                symbol_prefix_char = *p;
+                       } else if (strncmp(argv[i], "--exclude-prefix=", 17) == 
0) {
+                               char *p = &argv[i][17];
+                               /* skip quote */
+                               if ((*p == '"' && *(p+2) == '"') || (*p == '\'' 
&& *(p+2) == '\''))
+                                       p++;
+                               exclude_prefix_char = *p;
                        } else
                                usage();
                }

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols), Yoshinori Sato <=