kbuild: LD_DEAD_CODE_DATA_ELIMINATION no -ffunction-sections/-fdata-sections for...
authorNicholas Piggin <npiggin@gmail.com>
Wed, 9 May 2018 12:59:59 +0000 (22:59 +1000)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 17 May 2018 13:45:00 +0000 (22:45 +0900)
Modules do not tend to cope with -ffunction-sections, even though they
do not link with -gc-sections. It may be possible for unused symbols to
be trimmed from modules, but in general that would take much more work
in architecture module linker scripts.

For now, enable these only for kernel build.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Makefile

index a1ea84dfdde621acc4ee5ba25a83b39f9398c32e..52ea534f51731b79351026f2b1a340180bf792e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -799,8 +799,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
 endif
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
-KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
-KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
+KBUILD_CFLAGS_KERNEL   += $(call cc-option,-ffunction-sections,)
+KBUILD_CFLAGS_KERNEL   += $(call cc-option,-fdata-sections,)
 endif
 
 # arch Makefile may override CC so keep this after arch Makefile is included