mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Earnshaw <Richard.Earnshaw@arm.com>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [RFC] ARM binutils feature churn causing kernel problems
Date: Tue, 05 Oct 2004 13:57:15 +0100	[thread overview]
Message-ID: <1096981035.14574.20.camel@pc960.cambridge.arm.com> (raw)
In-Reply-To: <20041005125324.A6910@flint.arm.linux.org.uk>

On Tue, 2004-10-05 at 12:53, Russell King wrote:
> On Tue, Oct 05, 2004 at 11:10:46AM +0000, Richard Earnshaw wrote:
> > Rusty Russell <rusty <at> rustcorp.com.au> writes:
> > > Russell, I thought about not including any symbol which is not of form
> > > "[A-Za-z0-9_]+" in kallsyms, for all archs: you are not the only one
> > > with weird-ass symbols.  Is it that you want these mapping symbols in
> > > /proc/kallsyms but ignored in backtraces, or you don't need them in
> > > kallsyms altogether?
> > > 
> > > Thanks,
> > > Rusty.
> > 
> > 
> > Mapping symbols will always be encoded with STB_LOCAL and STT_NOTYPE.
> > I would have thought it unlikely that the kernel would ever want to
> > report against any symbol with those attributes and they could all
> > be dropped on that basis.
> 
> (Richard - your mailer appears to have dropped people from the CC: list...)
> 

Not by me, I don't subscribe to the list in question and was pointed to
gmane.linux.kernel newsgroup by Phillipe.  I simply followed up to that
message.

> How about this patch?  Is there a better way to parse the 'nm' output
> to achieve the same as your suggestion above?
> 
> diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej orig/kernel/module.c linux/kernel/module.c
> --- orig/kernel/module.c	Wed Sep 22 16:07:38 2004
> +++ linux/kernel/module.c	Tue Oct  5 12:46:01 2004
> @@ -1923,6 +1923,10 @@ static const char *get_ksymbol(struct mo
>  		if (mod->symtab[i].st_shndx == SHN_UNDEF)
>  			continue;
>  
> +		if (ELF_ST_BIND(mod->symtab[i].st_info) == STB_LOCAL
> +		    && ELF_ST_TYPE(mod->symtab[i].st_info) == STT_NOTYPE)
> +			continue;
> +
>  		/* We ignore unnamed symbols: they're uninformative
>  		 * and inserted at a whim. */
>  		if (mod->symtab[i].st_value <= addr
> diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej orig/scripts/kallsyms.c linux/scripts/kallsyms.c
> --- orig/scripts/kallsyms.c	Sun Jul 11 22:56:39 2004
> +++ linux/scripts/kallsyms.c	Tue Oct  5 12:51:26 2004
> @@ -32,6 +32,17 @@ usage(void)
>  	exit(1);
>  }
>  
> +/*
> + * This ignores the intensely annoying "mapping symbols" found
> + * in ARM ELF files: $a, $t and $d.
> + */
> +static inline int
> +is_arm_mapping_symbol(const char *str)
> +{
> +	return str[0] == '$' && strchr("atd", str[1]) &&
> +	       (str[2] == '\0' || str[2] == '.');
> +}
> +
>  static int
>  read_symbol(FILE *in, struct sym_entry *s)
>  {
> @@ -56,7 +67,8 @@ read_symbol(FILE *in, struct sym_entry *
>  		_sinittext = s->addr;
>  	else if (strcmp(str, "_einittext") == 0)
>  		_einittext = s->addr;
> -	else if (toupper(s->type) == 'A' || toupper(s->type) == 'U')
> +	else if (toupper(s->type) == 'A' || toupper(s->type) == 'U' ||
> +		 is_arm_mapping_symbol(str))
>  		return -1;
>  
>  	s->sym = strdup(str);

Why don't you pass s to is_arm_mapping_symbol and have it do the same
thing as you've done in get_ksymbol?

R.
-- 
Richard Earnshaw             Email: Richard.Earnshaw@arm.com
ARM Ltd                      Phone: +44 1223 400569 (Direct + VoiceMail)
110 Fulbourn Road            Switchboard: +44 1223 400400
Cherry Hinton                Fax: +44 1223 400410
Cambridge CB1 9NJ            Web: http://www.arm.com/
UK
----------------------------------------------------------------
This e-mail message is intended for the addressee(s) only and may
contain information that is the property of, and/or subject to a
confidentiality agreement between the intended recipient(s), their
organisation and/or the ARM Group of Companies. If you are not an
intended recipient of this e-mail message, you should not read, copy,
forward or otherwise distribute or further disclose the information in
it; misuse of the contents of this e-mail message may violate various
laws in your state, country or jurisdiction. If you have received this
e-mail message in error, please contact the originator of this e-mail
message via e-mail and delete all copies of this message from your
computer or network, thank you.
----------------------------------------------------------------


  reply	other threads:[~2004-10-05 12:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-27 20:03 Russell King
2004-09-27 20:17 ` Christoph Hellwig
2004-09-27 20:35   ` Russell King
2004-09-27 20:37   ` Nicolas Pitre
2004-10-01 20:11 ` Russell King
2004-10-04 12:01   ` Catalin Marinas
2004-10-04 23:18     ` Rusty Russell
2004-10-05 11:10       ` Richard Earnshaw
2004-10-05 11:53         ` Russell King
2004-10-05 12:57           ` Richard Earnshaw [this message]
2004-10-05 13:14             ` Russell King
2004-10-05 13:40               ` Richard Earnshaw
2004-10-05 13:51                 ` Russell King
2004-10-06 10:08                   ` Adrian Cox
2004-10-07 15:02                     ` Russell King
2004-10-12 13:15                     ` Richard Earnshaw
2004-10-07 14:54                   ` Russell King
2004-10-05 23:00               ` Rusty Russell
2004-10-07 12:35                 ` Paulo Marques
2004-10-07 15:01                   ` Russell King
2004-10-07 16:39                     ` Paulo Marques
2004-10-05 13:02           ` Richard Earnshaw
2004-10-08 15:04 ` Russell King
2004-10-08 16:36   ` Paulo Marques
2004-10-08 18:14     ` Albert Cahalan
2004-10-08 19:43       ` Paulo Marques
2004-10-20 11:38 ` [PATCH] Fix ARM kernel build with permitted binutils versions Russell King
2004-10-26 22:37   ` Sam Ravnborg

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=1096981035.14574.20.camel@pc960.cambridge.arm.com \
    --to=richard.earnshaw@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.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

Powered by JetHome