All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arnd@arndb.de,
	linux@arm.linux.org.uk
Subject: Re: [RFC PATCH 1/2] Kbuild: kallsyms: ignore veneers emitted by the ARM linker
Date: Mon, 30 Mar 2015 14:11:00 +0200	[thread overview]
Message-ID: <55193D54.8070803@suse.cz> (raw)
In-Reply-To: <1427716167-25078-2-git-send-email-ard.biesheuvel@linaro.org>

On 2015-03-30 13:49, Ard Biesheuvel wrote:
> When linking large kernels on ARM, the linker will insert veneers
> (i.e., PLT like stubs) when function symbols are out of reach for
> the ordinary relative branch/branch-and-link instructions.
> 
> However, due to the fact that the kallsyms region sits in .rodata,
> which is between .text and .init.text, additional veneers may be
> emitted in the second pass due to the fact that the size of the
> kallsyms region itself has pushed the .init.text section further
> down, resulting in additional veneers to be emitted.
> 
> So ignore the veneers when generating the symbol table. Veneers
> have no corresponding source code, and they will not turn up in
> backtraces anyway.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  scripts/kallsyms.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index c6d33bd15b04..6668c87d599f 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -212,6 +212,12 @@ static int symbol_valid(struct sym_entry *s)
>  		"_SDA_BASE_",		/* ppc */
>  		"_SDA2_BASE_",		/* ppc */
>  		NULL };
> +
> +	static char *special_suffixes[] = {
> +		"_compiled.",		/* gcc < 3.0: "gcc[0-9]_compiled." */

Your newly added comment suggests that this can go away, since we have
been requiring at least gcc 3.2 since some time. But it can be removed
in a follow-up cleanup.


> +		"_veneer",		/* arm */
> +		NULL };
> +
>  	int i;
>  	int offset = 1;
>  
> @@ -244,13 +250,18 @@ static int symbol_valid(struct sym_entry *s)
>  	}
>  
>  	/* Exclude symbols which vary between passes. */
> -	if (strstr((char *)s->sym + offset, "_compiled."))
> -		return 0;
> -
>  	for (i = 0; special_symbols[i]; i++)
>  		if( strcmp((char *)s->sym + offset, special_symbols[i]) == 0 )
>  			return 0;
>  
> +	for (i = 0; special_suffixes[i]; i++) {
> +		char *sym_name = (char *)s->sym + offset;

You should declare and set this useful helper a few lines earlier and
use it in the other statements that test the symbol name.

Michal

WARNING: multiple messages have this Message-ID (diff)
From: mmarek@suse.cz (Michal Marek)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/2] Kbuild: kallsyms: ignore veneers emitted by the ARM linker
Date: Mon, 30 Mar 2015 14:11:00 +0200	[thread overview]
Message-ID: <55193D54.8070803@suse.cz> (raw)
In-Reply-To: <1427716167-25078-2-git-send-email-ard.biesheuvel@linaro.org>

On 2015-03-30 13:49, Ard Biesheuvel wrote:
> When linking large kernels on ARM, the linker will insert veneers
> (i.e., PLT like stubs) when function symbols are out of reach for
> the ordinary relative branch/branch-and-link instructions.
> 
> However, due to the fact that the kallsyms region sits in .rodata,
> which is between .text and .init.text, additional veneers may be
> emitted in the second pass due to the fact that the size of the
> kallsyms region itself has pushed the .init.text section further
> down, resulting in additional veneers to be emitted.
> 
> So ignore the veneers when generating the symbol table. Veneers
> have no corresponding source code, and they will not turn up in
> backtraces anyway.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  scripts/kallsyms.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index c6d33bd15b04..6668c87d599f 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -212,6 +212,12 @@ static int symbol_valid(struct sym_entry *s)
>  		"_SDA_BASE_",		/* ppc */
>  		"_SDA2_BASE_",		/* ppc */
>  		NULL };
> +
> +	static char *special_suffixes[] = {
> +		"_compiled.",		/* gcc < 3.0: "gcc[0-9]_compiled." */

Your newly added comment suggests that this can go away, since we have
been requiring@least gcc 3.2 since some time. But it can be removed
in a follow-up cleanup.


> +		"_veneer",		/* arm */
> +		NULL };
> +
>  	int i;
>  	int offset = 1;
>  
> @@ -244,13 +250,18 @@ static int symbol_valid(struct sym_entry *s)
>  	}
>  
>  	/* Exclude symbols which vary between passes. */
> -	if (strstr((char *)s->sym + offset, "_compiled."))
> -		return 0;
> -
>  	for (i = 0; special_symbols[i]; i++)
>  		if( strcmp((char *)s->sym + offset, special_symbols[i]) == 0 )
>  			return 0;
>  
> +	for (i = 0; special_suffixes[i]; i++) {
> +		char *sym_name = (char *)s->sym + offset;

You should declare and set this useful helper a few lines earlier and
use it in the other statements that test the symbol name.

Michal

  reply	other threads:[~2015-03-30 12:11 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 11:49 [RFC PATCH 0/2] ARM large kernels Ard Biesheuvel
2015-03-30 11:49 ` Ard Biesheuvel
2015-03-30 11:49 ` [RFC PATCH 1/2] Kbuild: kallsyms: ignore veneers emitted by the ARM linker Ard Biesheuvel
2015-03-30 11:49   ` Ard Biesheuvel
2015-03-30 12:11   ` Michal Marek [this message]
2015-03-30 12:11     ` Michal Marek
2015-03-30 11:49 ` [RFC PATCH 2/2] Kbuild: avoid partial linking of drivers/built-in.o Ard Biesheuvel
2015-03-30 11:49   ` Ard Biesheuvel
2015-03-30 12:38   ` Michal Marek
2015-03-30 12:38     ` Michal Marek
2015-03-30 12:54     ` Ard Biesheuvel
2015-03-30 12:54       ` Ard Biesheuvel
2015-03-30 13:26     ` Russell King - ARM Linux
2015-03-30 13:26       ` Russell King - ARM Linux
2015-03-30 13:31       ` Ard Biesheuvel
2015-03-30 13:31         ` Ard Biesheuvel
2015-03-30 14:13         ` Michal Marek
2015-03-30 14:13           ` Michal Marek
2015-03-30 17:04           ` Ard Biesheuvel
2015-03-30 17:04             ` Ard Biesheuvel
2015-03-31 15:22             ` Nicolas Pitre
2015-03-31 15:22               ` Nicolas Pitre
2015-03-31 16:27               ` Dave Martin
2015-03-31 16:27                 ` Dave Martin
2015-03-31 16:34                 ` Russell King - ARM Linux
2015-03-31 16:34                   ` Russell King - ARM Linux
2015-03-31 18:46                   ` Nicolas Pitre
2015-03-31 18:46                     ` Nicolas Pitre
2015-03-31 18:42                 ` Nicolas Pitre
2015-03-31 18:42                   ` Nicolas Pitre
2015-04-01  9:04                   ` Dave Martin
2015-04-01  9:04                     ` Dave Martin

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=55193D54.8070803@suse.cz \
    --to=mmarek@suse.cz \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.