* [PATCH] kallsyms exclude local symbols @ 2008-08-07 4:55 Yoshinori Sato 2008-08-07 12:00 ` Paulo Marques 0 siblings, 1 reply; 9+ messages in thread From: Yoshinori Sato @ 2008-08-07 4:55 UTC (permalink / raw) To: Andrew Morton; +Cc: lkml h8300's nm output include '.Lfoo' local symbols. This is head of System.map 00000000 T __vector 00000100 T _interrupt_redirect_table 00000100 T _text 00000200 T __start 00000200 T __stext 0000024c t _exit 00000252 T __platform_gpio_table 0000025a t gpio_table 00000270 t .LFB1596 00000270 t .LM1 00000270 t .LM2 00000270 t .Ltext0 00000270 t _run_init_process 0000027a t .LM3 00000286 t .LFB1597 00000286 t .LFE1596 00000286 t .LM4 00000286 t .LM5 00000286 t _init_post 0000028a t .LM6 00000296 t .LM7 000002aa t .LM8 000002ba t .L199 000002ba t .LM9 000002c0 t .LM10 exclude local symbol patch. Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> --- scripts/kallsyms.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index ad2434b..a1652da 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -106,7 +106,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) is_arm_mapping_symbol(sym)) return -1; /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ - else if (str[0] == '$') + else if (str[0] == '$' || str[0] == '.') return -1; /* exclude debugging symbols */ else if (stype == 'N') -- 1.5.6.3 -- Yoshinori Sato <ysato@users.sourceforge.jp> ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] kallsyms exclude local symbols 2008-08-07 4:55 [PATCH] kallsyms exclude local symbols Yoshinori Sato @ 2008-08-07 12:00 ` Paulo Marques 2008-08-07 23:36 ` [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) Yoshinori Sato 0 siblings, 1 reply; 9+ messages in thread From: Paulo Marques @ 2008-08-07 12:00 UTC (permalink / raw) To: Yoshinori Sato; +Cc: Andrew Morton, lkml Yoshinori Sato wrote: > h8300's nm output include '.Lfoo' local symbols. > [...] > /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ > - else if (str[0] == '$') > + else if (str[0] == '$' || str[0] == '.') The comment above needs some updating too. Something along these lines: /* exclude also MIPS ELF local symbols (eg. $L123) and h8300 (eg .LM10) */ Other than that, the patch seems fine. -- Paulo Marques - www.grupopie.com "...so she told me it was either her or the ham radio, over." ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-08-07 12:00 ` Paulo Marques @ 2008-08-07 23:36 ` Yoshinori Sato 2008-09-08 6:56 ` Andrew Morton 0 siblings, 1 reply; 9+ messages in thread From: Yoshinori Sato @ 2008-08-07 23:36 UTC (permalink / raw) To: Andrew Morton, Paulo Marques; +Cc: lkml At Thu, 07 Aug 2008 13:00:05 +0100, Paulo Marques wrote: > > Yoshinori Sato wrote: > > h8300's nm output include '.Lfoo' local symbols. > > [...] > > /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ > > - else if (str[0] == '$') > > + else if (str[0] == '$' || str[0] == '.') > > The comment above needs some updating too. Something along these lines: > > /* exclude also MIPS ELF local symbols (eg. $L123) and h8300 (eg .LM10) */ > > Other than that, the patch seems fine. > > -- > Paulo Marques - www.grupopie.com > > "...so she told me it was either her or the ham radio, over." Thanks reply. Update comment. And same problem in modpost. Warning message dirty. WARNING: vmlinux.o(.text+0x304b): Section mismatch in reference from the variable .LM10 to the variable .init.text:_free_area_init The function .LM10() references the variable __init _free_area_init. This is often because .LM10 lacks a __init annotation or the annotation of _free_area_init is wrong. fix it. WARNING: vmlinux.o(.text+0x304b): Section mismatch in reference from the variable _paging_init to the variable .init.text:___alloc_bootmem The function _paging_init() references the variable __init ___alloc_bootmem. This is often because _paging_init lacks a __init annotation or the annotation of ___alloc_bootmem is wrong. Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> --- scripts/kallsyms.c | 5 +++-- scripts/mod/modpost.c | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index ad2434b..64ad9cf 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -105,8 +105,9 @@ 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 MIPS ELF (e.g. $L123) and h8300 elf (e.g. .LM123) + local symbols */ + else if (str[0] == '$' || str[0] == '.') return -1; /* exclude debugging symbols */ else if (stype == 'N') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 418cd7d..e07f4ba 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1042,7 +1042,9 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) { const char *name = elf->strtab + sym->st_name; - if (!name || !strlen(name)) + if (!name || !strlen(name) || + /* exclude h8300 elf local symbols (e.g. .LM123) */ + name[0] == '.') return 0; return !is_arm_mapping_symbol(name); } -- 1.5.6.3 -- Yoshinori Sato <ysato@users.sourceforge.jp> ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-08-07 23:36 ` [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) Yoshinori Sato @ 2008-09-08 6:56 ` Andrew Morton 2008-09-08 19:20 ` Paulo Marques 2008-09-08 20:58 ` Yoshinori Sato 0 siblings, 2 replies; 9+ messages in thread From: Andrew Morton @ 2008-09-08 6:56 UTC (permalink / raw) To: Yoshinori Sato; +Cc: Paulo Marques, lkml On Thu, 07 Aug 2008 19:36:18 -0400 Yoshinori Sato <ysato@users.sourceforge.jp> wrote: > At Thu, 07 Aug 2008 13:00:05 +0100, > Paulo Marques wrote: > > > > Yoshinori Sato wrote: > > > h8300's nm output include '.Lfoo' local symbols. > > > [...] > > > /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ > > > - else if (str[0] == '$') > > > + else if (str[0] == '$' || str[0] == '.') > > > > The comment above needs some updating too. Something along these lines: > > > > /* exclude also MIPS ELF local symbols (eg. $L123) and h8300 (eg .LM10) */ > > > > Other than that, the patch seems fine. > > > > -- > > Paulo Marques - www.grupopie.com > > > > "...so she told me it was either her or the ham radio, over." > > Thanks reply. > > Update comment. > And same problem in modpost. > > Warning message dirty. > WARNING: vmlinux.o(.text+0x304b): Section mismatch in reference from the variable .LM10 to the variable .init.text:_free_area_init > The function .LM10() references > the variable __init _free_area_init. > This is often because .LM10 lacks a __init > annotation or the annotation of _free_area_init is wrong. > > fix it. > WARNING: vmlinux.o(.text+0x304b): Section mismatch in reference from the variable _paging_init to the variable .init.text:___alloc_bootmem > The function _paging_init() references > the variable __init ___alloc_bootmem. > This is often because _paging_init lacks a __init > annotation or the annotation of ___alloc_bootmem is wrong. > > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> > > --- > scripts/kallsyms.c | 5 +++-- > scripts/mod/modpost.c | 4 +++- > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > index ad2434b..64ad9cf 100644 > --- a/scripts/kallsyms.c > +++ b/scripts/kallsyms.c > @@ -105,8 +105,9 @@ 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 MIPS ELF (e.g. $L123) and h8300 elf (e.g. .LM123) > + local symbols */ > + else if (str[0] == '$' || str[0] == '.') > return -1; > /* exclude debugging symbols */ > else if (stype == 'N') > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 418cd7d..e07f4ba 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -1042,7 +1042,9 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) > { > const char *name = elf->strtab + sym->st_name; > > - if (!name || !strlen(name)) > + if (!name || !strlen(name) || > + /* exclude h8300 elf local symbols (e.g. .LM123) */ > + name[0] == '.') > return 0; > return !is_arm_mapping_symbol(name); > } This patch broke kallsyms on powerpc. Please see http://ozlabs.org/pipermail/linuxppc-dev/2008-September/062549.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-09-08 6:56 ` Andrew Morton @ 2008-09-08 19:20 ` Paulo Marques 2008-09-08 20:58 ` Yoshinori Sato 1 sibling, 0 replies; 9+ messages in thread From: Paulo Marques @ 2008-09-08 19:20 UTC (permalink / raw) To: Andrew Morton; +Cc: Yoshinori Sato, lkml Andrew Morton wrote: > This patch broke kallsyms on powerpc. Please see > http://ozlabs.org/pipermail/linuxppc-dev/2008-September/062549.html I've just looked at that post and it seems that there are a lot of regular symbols that start with '.' on powerpc (see: http://userweb.kernel.org/~akpm/nm-n.txt ). I guess the best solution would be to change the patch to use that filter only when the target architecture is h8300, so that it doesn't mess with other architectures. -- Paulo Marques - www.grupopie.com "To be, or not to be? That is ..... liable to be removed at -O2 and above." ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-09-08 6:56 ` Andrew Morton 2008-09-08 19:20 ` Paulo Marques @ 2008-09-08 20:58 ` Yoshinori Sato 2008-09-08 23:39 ` Hugh Dickins 1 sibling, 1 reply; 9+ messages in thread From: Yoshinori Sato @ 2008-09-08 20:58 UTC (permalink / raw) To: Andrew Morton; +Cc: Paulo Marques, lkml At Sun, 7 Sep 2008 23:56:27 -0700, Andrew Morton wrote: > > On Thu, 07 Aug 2008 19:36:18 -0400 Yoshinori Sato <ysato@users.sourceforge.jp> wrote: > > > At Thu, 07 Aug 2008 13:00:05 +0100, > > Paulo Marques wrote: > > > > > > Yoshinori Sato wrote: > > > > h8300's nm output include '.Lfoo' local symbols. > > > > [...] > > > > /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ > > > > - else if (str[0] == '$') > > > > + else if (str[0] == '$' || str[0] == '.') > > > > > > The comment above needs some updating too. Something along these lines: > > > > > > /* exclude also MIPS ELF local symbols (eg. $L123) and h8300 (eg .LM10) */ > > > > > > Other than that, the patch seems fine. > > > > > > -- > > > Paulo Marques - www.grupopie.com > > > > > > "...so she told me it was either her or the ham radio, over." > > > > Thanks reply. > > > > Update comment. > > And same problem in modpost. > > > > Warning message dirty. > > WARNING: vmlinux.o(.text+0x304b): Section mismatch in reference from the variable .LM10 to the variable .init.text:_free_area_init > > The function .LM10() references > > the variable __init _free_area_init. > > This is often because .LM10 lacks a __init > > annotation or the annotation of _free_area_init is wrong. > > > > fix it. > > WARNING: vmlinux.o(.text+0x304b): Section mismatch in reference from the variable _paging_init to the variable .init.text:___alloc_bootmem > > The function _paging_init() references > > the variable __init ___alloc_bootmem. > > This is often because _paging_init lacks a __init > > annotation or the annotation of ___alloc_bootmem is wrong. > > > > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> > > > > --- > > scripts/kallsyms.c | 5 +++-- > > scripts/mod/modpost.c | 4 +++- > > 2 files changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > > index ad2434b..64ad9cf 100644 > > --- a/scripts/kallsyms.c > > +++ b/scripts/kallsyms.c > > @@ -105,8 +105,9 @@ 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 MIPS ELF (e.g. $L123) and h8300 elf (e.g. .LM123) > > + local symbols */ > > + else if (str[0] == '$' || str[0] == '.') > > return -1; > > /* exclude debugging symbols */ > > else if (stype == 'N') > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > index 418cd7d..e07f4ba 100644 > > --- a/scripts/mod/modpost.c > > +++ b/scripts/mod/modpost.c > > @@ -1042,7 +1042,9 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) > > { > > const char *name = elf->strtab + sym->st_name; > > > > - if (!name || !strlen(name)) > > + if (!name || !strlen(name) || > > + /* exclude h8300 elf local symbols (e.g. .LM123) */ > > + name[0] == '.') > > return 0; > > return !is_arm_mapping_symbol(name); > > } > > 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'". -- Yoshinori Sato <ysato@users.sourceforge.jp> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-09-08 20:58 ` Yoshinori Sato @ 2008-09-08 23:39 ` Hugh Dickins 2008-09-09 3:07 ` Yoshinori Sato 0 siblings, 1 reply; 9+ messages in thread From: Hugh Dickins @ 2008-09-08 23:39 UTC (permalink / raw) To: Yoshinori Sato; +Cc: Andrew Morton, Paulo Marques, lkml 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-09-08 23:39 ` Hugh Dickins @ 2008-09-09 3:07 ` Yoshinori Sato 2008-09-12 19:28 ` Yoshinori Sato 0 siblings, 1 reply; 9+ messages in thread From: Yoshinori Sato @ 2008-09-09 3:07 UTC (permalink / raw) To: Hugh Dickins; +Cc: Andrew Morton, Paulo Marques, lkml 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> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) 2008-09-09 3:07 ` Yoshinori Sato @ 2008-09-12 19:28 ` Yoshinori Sato 0 siblings, 0 replies; 9+ messages in thread From: Yoshinori Sato @ 2008-09-12 19:28 UTC (permalink / raw) To: Andrew Morton, ralf; +Cc: Hugh Dickins, Paulo Marques, lkml, linux-mips 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> ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-09-12 19:29 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-07 4:55 [PATCH] kallsyms exclude local symbols Yoshinori Sato 2008-08-07 12:00 ` Paulo Marques 2008-08-07 23:36 ` [PATCH] exclude h8300 local symbols (Re: kallsyms exclude local symbols) Yoshinori Sato 2008-09-08 6:56 ` Andrew Morton 2008-09-08 19:20 ` Paulo Marques 2008-09-08 20:58 ` Yoshinori Sato 2008-09-08 23:39 ` Hugh Dickins 2008-09-09 3:07 ` Yoshinori Sato 2008-09-12 19:28 ` Yoshinori Sato
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).