linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
	Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	arnd@arndb.de
Subject: Re: linux-next: build warnings from the build of Linus' tree
Date: Fri, 7 Sep 2018 01:42:09 +0900	[thread overview]
Message-ID: <20180907014209.49e2940f74615a1e4f544ffd@kernel.org> (raw)
In-Reply-To: <f0ca0036-abe1-4252-6d30-b810dd22097d@linux.ibm.com>

On Thu, 6 Sep 2018 12:49:39 +0200
Peter Oberparleiter <oberpar@linux.ibm.com> wrote:

> On 28.08.2018 02:43, Masami Hiramatsu wrote:
> > I recently added a gcov profiling for ftrace, following Documentation/dev-tools/gcov.rst.
> > 6b7dca401cb1 ("tracing: Allow gcov profiling on only ftrace subsystem")
> > 
> > and it caused may orphan section warnings/errors on arm and powerpc64.
> > We also found same error happens when CONFIG_GCOV_PROFILE_ALL=y.
> > So I guess GCOV kernel subsystem broken in some environment.
> 
> I can confirm that these issues are unrelated to your commit which only
> made the existing problems visible by enabling gcov-kernel profiling for
> allyesconfig builds. Both problems already exist in v4.18 and likely
> earlier versions.
> 
> Problem 1: link failure on arm
> (https://lkml.org/lkml/2018/8/24/345)
> 
> The root cause appears to be that the arm linker script only partially
> discards unneeded sections generated by the compiler when gcov-kernel
> profiling is enabled.
> 
> Problem 2: linker warnings on powerpc
> (https://lkml.org/lkml/2018/8/24/72)
> 
> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y adds compiler flag
> -fdata-sections. This option causes GCC to create separate data sections
> for data objects, including those generated by GCC internally for gcov
> profiling. Since the name of these internal data objects starts with a .
> (.LPBX0, .LPBX1), the resulting section name starts with "data..". As
> section names starting with "data.." are used for specific purposes in
> the Linux kernel, the linker script does not automatically handle them,
> resulting in the "orphan section" linker warnings.

Good catch! I didn't know that option.

> 
> I've attached a quick fix that should address both problems. I'd
> appreciate if this patch could get some testing before I post proper fix
> patches.

Hmm, I'm still not able to reproduce it on powerpc cross build even with
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y ... So, sorry I couldn't test this patch.

> 
> -- >8 --
> diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
> index ae5fdff18406..2ca33277a28b 100644
> --- a/arch/arm/kernel/vmlinux.lds.h
> +++ b/arch/arm/kernel/vmlinux.lds.h
> @@ -48,6 +48,7 @@
> 
>  #define ARM_DISCARD							\
>  		*(.ARM.exidx.exit.text)					\
> +		*(.ARM.exidx.text.exit)					\

BTW, why would we need this?

Thanks,

>  		*(.ARM.extab.exit.text)					\
>  		ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))		\
>  		ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))		\
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 7b75ff6e2fce..5cf3b90c5592 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -68,7 +68,7 @@
>   */
>  #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
>  #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
> -#define DATA_MAIN .data .data.[0-9a-zA-Z_]*
> +#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..LPBX*
>  #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
>  #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]*
>  #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
> @@ -613,7 +613,7 @@
> 
>  #define EXIT_DATA							\
>  	*(.exit.data .exit.data.*)					\
> -	*(.fini_array)							\
> +	*(.fini_array .fini_array.*)					\
>  	*(.dtors)							\
>  	MEM_DISCARD(exit.data*)						\
>  	MEM_DISCARD(exit.rodata*)
> -- 
> Peter Oberparleiter
> Linux on Z Development - IBM Germany
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2018-09-06 16:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24  3:32 linux-next: build warnings from the build of Linus' tree Stephen Rothwell
2018-08-24  8:20 ` Masami Hiramatsu
2018-08-24 11:47   ` Masami Hiramatsu
2018-08-24 12:42     ` Stephen Rothwell
2018-08-25  1:51       ` Masami Hiramatsu
2018-08-26  8:10       ` Masami Hiramatsu
2018-08-27 21:23         ` Stephen Rothwell
2018-08-28  0:43           ` Masami Hiramatsu
2018-09-06 10:49             ` Peter Oberparleiter
2018-09-06 16:42               ` Masami Hiramatsu [this message]
2018-09-07 12:50                 ` Peter Oberparleiter
2018-09-08  3:57                   ` Masami Hiramatsu
2018-09-10 13:27                     ` Peter Oberparleiter
2018-09-11 11:49                       ` Masami Hiramatsu
2018-09-11 14:10                         ` Masami Hiramatsu
2018-09-06 22:14               ` Stephen Rothwell
2018-09-07  3:34                 ` Stephen Rothwell
2018-10-11  0:48               ` Stephen Rothwell
2018-10-11  7:44                 ` Peter Oberparleiter
2018-10-11  9:58                   ` Stephen Rothwell
2018-10-11 10:37                     ` Greg KH
2018-10-11 11:09                       ` Peter Oberparleiter
2018-10-11 13:54                       ` Arnd Bergmann
2018-10-11 22:12                         ` [GIT PULL] A couple of warning fixes Stephen Rothwell
2018-10-12 10:51                           ` Greg KH
2018-08-24 12:46   ` linux-next: build warnings from the build of Linus' tree Arnd Bergmann
2018-08-25 18:53     ` Masami Hiramatsu
2018-08-25 19:53       ` Arnd Bergmann
2018-09-01  9:50         ` Masami Hiramatsu
2018-09-01 12:38           ` [PATCH] ARM: linker script: GCOV kernel may refers data in __exit Masami Hiramatsu
2018-09-11 14:12             ` Masami Hiramatsu
2018-08-29  2:11     ` linux-next: build warnings from the build of Linus' tree Greentime Hu

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=20180907014209.49e2940f74615a1e4f544ffd@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=oberpar@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=sfr@canb.auug.org.au \
    /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;
as well as URLs for NNTP newsgroup(s).