Skip to contentSkip to conversation

kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

PATCH Superseded Arnd Bergmann 2 participants 2 messages Dec 16, 2016 – Dec 18, 2016 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

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")
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +4 -0
index 4fb4b889c862..7dfd0aa4f3f7 100644
@@ -638,7 +638,11 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 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
 
Signature · 1 line
2.9.0
#1 lore raw

Hi,

Quoted 20 lines · Arnd Bergmann

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")
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +0 -0
index 4fb4b889c862..7dfd0aa4f3f7 100644

Makefile KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) · line 642

Quoted 5 lines
Makefile +2 -0
@@ -638,7 +638,11 @@ KBUILD_CFLAGS      += $(call cc-option,-fno-delete-null-pointer-checks,)
 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,))

s/0409/0408/ ?

Thanks,
Namhyung

Quoted 9 lines
Makefile +2 -1
+else
 KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
 endif
 
--

2.9.0