linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] kbuild: disable -ffunction-sections on gcc-4.7 with ftrace
@ 2017-03-14 21:33 Arnd Bergmann
  2017-03-14 21:35 ` [PATCH] [v333kbuild: " Arnd Bergmann
  2017-03-14 21:37 ` [PATCH] [SUBMITTED 20170314] " Arnd Bergmann
  0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2017-03-14 21:33 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek
  Cc: Arnd Bergmann, Namhyung Kim, linux-kbuild, linux-kernel

When ftrace is enabled and we build with gcc-4.7 or older, we
get a warning for each file on architectures that select
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving
it enabled for all other configurations.

Fixes: b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Namhyung Kim <namhyung.with.foss@gmail.com>
---
Fixed version number in check as pointed out by Namhyung Kim
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index 6e7e644a0b84..608727d3e47f 100644
--- a/Makefile
+++ b/Makefile
@@ -662,7 +662,11 @@ KBUILD_CFLAGS	+= -Wextra
 KBUILD_CFLAGS	+= $(call cc-disable-warning,frame-address,)
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS	+= $(call cc-ifversion, -ge,0409,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS	+= $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS	+= $(call cc-option,-fdata-sections,)
 endif
 
-- 
2.9.0


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

end of thread, other threads:[~2017-03-31 20:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14 21:33 [PATCH] [v2] kbuild: disable -ffunction-sections on gcc-4.7 with ftrace Arnd Bergmann
2017-03-14 21:35 ` [PATCH] [v333kbuild: " Arnd Bergmann
2017-03-14 21:37 ` [PATCH] [SUBMITTED 20170314] " Arnd Bergmann
2017-03-29  2:07   ` Masahiro Yamada
2017-03-29  9:30     ` Arnd Bergmann
2017-03-30 15:42       ` Masahiro Yamada
2017-03-31  8:48         ` Arnd Bergmann
     [not found]           ` <CAFzeTN3-=a6n-PEKP5ssCUszYYPu5R5_6uf9DEdptPKEuWOsrQ@mail.gmail.com>
2017-03-31 20:39             ` Arnd Bergmann

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