linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Russell King <linux@armlinux.org.uk>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH] ARM: linker script: GCOV kernel may refers data in __exit
Date: Sat,  1 Sep 2018 21:38:13 +0900	[thread overview]
Message-ID: <153580549235.10130.1495077983569784123.stgit@devbox> (raw)
In-Reply-To: <20180901185017.0a81bc3e61f5d021664f13f3@kernel.org>
In-Reply-To: <20180901185017.0a81bc3e61f5d021664f13f3@kernel.org>

GCOV kernel embeds counters in the kernel for each line
and a part of that embed in __exit text. So we need to
keep the __exit text if CONFIG_GCOV_KERNEL=y.

Without this patch, if we discards __exit text (e.g.
disables CONFIG_GENERIC_BUG, CONFIG_JUMP_LABEL and
CONFIG_SMP_ON_UP) but enables CONFIG_GCOV_PROFILE_FTRACE,
ld will error like below on ARM.

`.text.exit' referenced in section `.ARM.exidx.text.exit' of
kernel/trace/trace_clock.o: defined in discarded section `.text.exit'
of kernel/trace/trace_clock.o

To fix this issue, we keep __exit when CONFIG_GCOV_KERNEL=y.

The reason why not depending CONFIG_GCOV_PROFILE_X, is
that the Documentation/dev-tools/gcov.rst says that the
developer can enable gcov profile on a file or a directory
by customizing Makefile, and that will only depend on
CONFIG_GCOV_KERNEL.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reported-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/kernel/vmlinux.lds.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
index ae5fdff18406..baaacee9f5ce 100644
--- a/arch/arm/kernel/vmlinux.lds.h
+++ b/arch/arm/kernel/vmlinux.lds.h
@@ -9,7 +9,8 @@
 #endif
 
 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
-	defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
+	defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL) || \
+	defined(CONFIG_GCOV_KERNEL)
 #define ARM_EXIT_KEEP(x)	x
 #define ARM_EXIT_DISCARD(x)
 #else


  reply	other threads:[~2018-09-01 12:38 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
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           ` Masami Hiramatsu [this message]
2018-09-11 14:12             ` [PATCH] ARM: linker script: GCOV kernel may refers data in __exit 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=153580549235.10130.1495077983569784123.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nicolas.pitre@linaro.org \
    --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).