Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Andrew Morton <akpm@linux-foundation.org>, ralf@linux-mips.org
Cc: Hugh Dickins <hugh@veritas.com>,
	Paulo Marques <pmarques@grupopie.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols)
Date: Fri, 12 Sep 2008 15:28:56 -0400	[thread overview]
Message-ID: <87vdx1xix3.wl%ysato@users.sourceforge.jp> (raw)
In-Reply-To: <87y722qaoy.wl%ysato@users.sourceforge.jp>

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>

           reply	other threads:[~2008-09-12 19:29 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <87y722qaoy.wl%ysato@users.sourceforge.jp>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdx1xix3.wl%ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=akpm@linux-foundation.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=pmarques@grupopie.com \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox