linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/kallsyms: skip ppc compiler stub *.long_branch.* / *.plt_branch.*
@ 2020-09-22 17:48 Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2020-09-22 17:48 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Guenter Roeck, Geert Uytterhoeven, Greg Kroah-Hartman,
	Masahiro Yamada, linux-kernel

PowerPC allmodconfig often fails to build as follows:

    LD      .tmp_vmlinux.kallsyms1
    KSYM    .tmp_vmlinux.kallsyms1.o
    LD      .tmp_vmlinux.kallsyms2
    KSYM    .tmp_vmlinux.kallsyms2.o
    LD      .tmp_vmlinux.kallsyms3
    KSYM    .tmp_vmlinux.kallsyms3.o
    LD      vmlinux
    SORTTAB vmlinux
    SYSMAP  System.map
  Inconsistent kallsyms data
  Try make KALLSYMS_EXTRA_PASS=1 as a workaround
  make[2]: *** [../Makefile:1162: vmlinux] Error 1

Setting KALLSYMS_EXTRA_PASS=1 does not help.

This is caused by the compiler inserting stubs such as *.long_branch.*
and *.plt_branch.*

  $ powerpc-linux-nm -n .tmp_vmlinux.kallsyms2
   [ snip ]
  c00000000210c000 T __init_begin
  c00000000210c000 T _sinittext
  c00000000210c010 t 00000075.plt_branch.da9:19
  c00000000210c020 t 00000075.plt_branch.1677:5
  c00000000210c030 t 00000075.long_branch.memmove
  c00000000210c034 t 00000075.plt_branch.9e0:5
  c00000000210c044 t 00000075.plt_branch.free_initrd_mem
    ...

Actually, the problem mentioned in scripts/link-vmlinux.sh comments;
"In theory it's possible this results in even more stubs, but unlikely"
is happening here, and ends up with another kallsyms step required.

scripts/kallsyms.c already ignores various compiler stubs. Let's do
similar to make kallsysms for PowerPC always succeed in 2 steps.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kallsyms.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 0096cd965332..306b9b38150f 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -120,17 +120,25 @@ static bool is_ignored_symbol(const char *name, char type)
 		NULL
 	};
 
+	static const char * const ignored_matches[] = {
+		".long_branch.",	/* ppc stub */
+		".plt_branch.",		/* ppc stub */
+		NULL
+	};
+
 	const char * const *p;
 
-	/* Exclude symbols which vary between passes. */
+	/* ignore symbol names that exactly match to a particular string. */
 	for (p = ignored_symbols; *p; p++)
 		if (!strcmp(name, *p))
 			return true;
 
+	/* ignore symbol names that start with a particular string. */
 	for (p = ignored_prefixes; *p; p++)
 		if (!strncmp(name, *p, strlen(*p)))
 			return true;
 
+	/* ignore symbol names that end with a particular string. */
 	for (p = ignored_suffixes; *p; p++) {
 		int l = strlen(name) - strlen(*p);
 
@@ -138,6 +146,12 @@ static bool is_ignored_symbol(const char *name, char type)
 			return true;
 	}
 
+	/* ignore symbol names that contain a particular string. */
+	for (p = ignored_matches; *p; p++) {
+		if (strstr(name, *p))
+			return true;
+	}
+
 	if (type == 'U' || type == 'u')
 		return true;
 	/* exclude debugging symbols */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts/kallsyms: skip ppc compiler stub *.long_branch.* / *.plt_branch.*
  2020-09-22 20:43 Guenter Roeck
@ 2020-09-24 15:33 ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2020-09-24 15:33 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Linux Kbuild mailing list, Geert Uytterhoeven,
	Greg Kroah-Hartman, Linux Kernel Mailing List

On Wed, Sep 23, 2020 at 5:43 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Wed, Sep 23, 2020 at 02:48:56AM +0900, Masahiro Yamada wrote:
> > PowerPC allmodconfig often fails to build as follows:
> >
> >     LD      .tmp_vmlinux.kallsyms1
> >     KSYM    .tmp_vmlinux.kallsyms1.o
> >     LD      .tmp_vmlinux.kallsyms2
> >     KSYM    .tmp_vmlinux.kallsyms2.o
> >     LD      .tmp_vmlinux.kallsyms3
> >     KSYM    .tmp_vmlinux.kallsyms3.o
> >     LD      vmlinux
> >     SORTTAB vmlinux
> >     SYSMAP  System.map
> >   Inconsistent kallsyms data
> >   Try make KALLSYMS_EXTRA_PASS=1 as a workaround
> >   make[2]: *** [../Makefile:1162: vmlinux] Error 1
> >
> > Setting KALLSYMS_EXTRA_PASS=1 does not help.
> >
> > This is caused by the compiler inserting stubs such as *.long_branch.*
> > and *.plt_branch.*
> >
> >   $ powerpc-linux-nm -n .tmp_vmlinux.kallsyms2
> >    [ snip ]
> >   c00000000210c000 T __init_begin
> >   c00000000210c000 T _sinittext
> >   c00000000210c010 t 00000075.plt_branch.da9:19
> >   c00000000210c020 t 00000075.plt_branch.1677:5
> >   c00000000210c030 t 00000075.long_branch.memmove
> >   c00000000210c034 t 00000075.plt_branch.9e0:5
> >   c00000000210c044 t 00000075.plt_branch.free_initrd_mem
> >     ...
> >
> > Actually, the problem mentioned in scripts/link-vmlinux.sh comments;
> > "In theory it's possible this results in even more stubs, but unlikely"
> > is happening here, and ends up with another kallsyms step required.
> >
> > scripts/kallsyms.c already ignores various compiler stubs. Let's do
> > similar to make kallsysms for PowerPC always succeed in 2 steps.
> >
> > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Tested-by: Guenter Roeck <linux@roeck-us.net>
>
> Thanks,
> Guenter
>
> > ---
> >
> >  scripts/kallsyms.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> > index 0096cd965332..306b9b38150f 100644
> > --- a/scripts/kallsyms.c
> > +++ b/scripts/kallsyms.c
> > @@ -120,17 +120,25 @@ static bool is_ignored_symbol(const char *name, char type)
> >               NULL
> >       };
> >
> > +     static const char * const ignored_matches[] = {
> > +             ".long_branch.",        /* ppc stub */
> > +             ".plt_branch.",         /* ppc stub */
> > +             NULL
> > +     };
> > +
> >       const char * const *p;
> >
> > -     /* Exclude symbols which vary between passes. */
> > +     /* ignore symbol names that exactly match to a particular string. */
> >       for (p = ignored_symbols; *p; p++)
> >               if (!strcmp(name, *p))
> >                       return true;
> >
> > +     /* ignore symbol names that start with a particular string. */
> >       for (p = ignored_prefixes; *p; p++)
> >               if (!strncmp(name, *p, strlen(*p)))
> >                       return true;
> >
> > +     /* ignore symbol names that end with a particular string. */
> >       for (p = ignored_suffixes; *p; p++) {
> >               int l = strlen(name) - strlen(*p);
> >
> > @@ -138,6 +146,12 @@ static bool is_ignored_symbol(const char *name, char type)
> >                       return true;
> >       }
> >
> > +     /* ignore symbol names that contain a particular string. */
> > +     for (p = ignored_matches; *p; p++) {
> > +             if (strstr(name, *p))
> > +                     return true;
> > +     }
> > +
> >       if (type == 'U' || type == 'u')
> >               return true;
> >       /* exclude debugging symbols */
> > --
> > 2.25.1
> >

Applied to linux-kbuild/fixes.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts/kallsyms: skip ppc compiler stub *.long_branch.* / *.plt_branch.*
@ 2020-09-22 20:43 Guenter Roeck
  2020-09-24 15:33 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2020-09-22 20:43 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Geert Uytterhoeven, Greg Kroah-Hartman, linux-kernel

On Wed, Sep 23, 2020 at 02:48:56AM +0900, Masahiro Yamada wrote:
> PowerPC allmodconfig often fails to build as follows:
> 
>     LD      .tmp_vmlinux.kallsyms1
>     KSYM    .tmp_vmlinux.kallsyms1.o
>     LD      .tmp_vmlinux.kallsyms2
>     KSYM    .tmp_vmlinux.kallsyms2.o
>     LD      .tmp_vmlinux.kallsyms3
>     KSYM    .tmp_vmlinux.kallsyms3.o
>     LD      vmlinux
>     SORTTAB vmlinux
>     SYSMAP  System.map
>   Inconsistent kallsyms data
>   Try make KALLSYMS_EXTRA_PASS=1 as a workaround
>   make[2]: *** [../Makefile:1162: vmlinux] Error 1
> 
> Setting KALLSYMS_EXTRA_PASS=1 does not help.
> 
> This is caused by the compiler inserting stubs such as *.long_branch.*
> and *.plt_branch.*
> 
>   $ powerpc-linux-nm -n .tmp_vmlinux.kallsyms2
>    [ snip ]
>   c00000000210c000 T __init_begin
>   c00000000210c000 T _sinittext
>   c00000000210c010 t 00000075.plt_branch.da9:19
>   c00000000210c020 t 00000075.plt_branch.1677:5
>   c00000000210c030 t 00000075.long_branch.memmove
>   c00000000210c034 t 00000075.plt_branch.9e0:5
>   c00000000210c044 t 00000075.plt_branch.free_initrd_mem
>     ...
> 
> Actually, the problem mentioned in scripts/link-vmlinux.sh comments;
> "In theory it's possible this results in even more stubs, but unlikely"
> is happening here, and ends up with another kallsyms step required.
> 
> scripts/kallsyms.c already ignores various compiler stubs. Let's do
> similar to make kallsysms for PowerPC always succeed in 2 steps.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Tested-by: Guenter Roeck <linux@roeck-us.net>

Thanks,
Guenter

> ---
> 
>  scripts/kallsyms.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 0096cd965332..306b9b38150f 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -120,17 +120,25 @@ static bool is_ignored_symbol(const char *name, char type)
>  		NULL
>  	};
>  
> +	static const char * const ignored_matches[] = {
> +		".long_branch.",	/* ppc stub */
> +		".plt_branch.",		/* ppc stub */
> +		NULL
> +	};
> +
>  	const char * const *p;
>  
> -	/* Exclude symbols which vary between passes. */
> +	/* ignore symbol names that exactly match to a particular string. */
>  	for (p = ignored_symbols; *p; p++)
>  		if (!strcmp(name, *p))
>  			return true;
>  
> +	/* ignore symbol names that start with a particular string. */
>  	for (p = ignored_prefixes; *p; p++)
>  		if (!strncmp(name, *p, strlen(*p)))
>  			return true;
>  
> +	/* ignore symbol names that end with a particular string. */
>  	for (p = ignored_suffixes; *p; p++) {
>  		int l = strlen(name) - strlen(*p);
>  
> @@ -138,6 +146,12 @@ static bool is_ignored_symbol(const char *name, char type)
>  			return true;
>  	}
>  
> +	/* ignore symbol names that contain a particular string. */
> +	for (p = ignored_matches; *p; p++) {
> +		if (strstr(name, *p))
> +			return true;
> +	}
> +
>  	if (type == 'U' || type == 'u')
>  		return true;
>  	/* exclude debugging symbols */
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-24 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 17:48 [PATCH] scripts/kallsyms: skip ppc compiler stub *.long_branch.* / *.plt_branch.* Masahiro Yamada
2020-09-22 20:43 Guenter Roeck
2020-09-24 15:33 ` Masahiro Yamada

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).