Skip to content

Commit 90ad405

Browse files
committed
kbuild: avoid conflict between -ffunction-sections and -pg on gcc-4.7
Arnd Bergmann reported: "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] " Since commit c3f0d0b ("kbuild, LLVMLinux: Add -Werror to cc-option to support clang"), warnings are treated as errors in cc-option checks. CC_FLAGS_FTRACE is blindly added to KBUILD_CFLAGS, so $(call cc-option,-ffunction-sections,) should be moved below it in order to detect the conflict between the two options. Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent ebf003f commit 90ad405

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎Makefile‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,6 @@ include arch/$(SRCARCH)/Makefile
632632
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
633633
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
634634

635-
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
636-
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,)
637-
KBUILD_CFLAGS += $(call cc-option,-fdata-sections,)
638-
endif
639-
640635
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
641636
KBUILD_CFLAGS += $(call cc-option,-Oz,-Os)
642637
KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
@@ -768,6 +763,11 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
768763
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
769764
endif
770765

766+
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
767+
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,)
768+
KBUILD_CFLAGS += $(call cc-option,-fdata-sections,)
769+
endif
770+
771771
# arch Makefile may override CC so keep this after arch Makefile is included
772772
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
773773
CHECKFLAGS += $(NOSTDINC_FLAGS)

0 commit comments

Comments
 (0)