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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>

It's OK?
Signed-off-by: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxxx>


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux