diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-08-22 09:51:09 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-08-23 19:10:00 -0400 |
commit | e85d1d65cd8a9083040e280d172eba762875f8f1 (patch) | |
tree | 8038ed2a967ad92502f45a7173bdda15cfed57b7 /Makefile | |
parent | f6f57a46435d7253a52a1a07a58183678ad266a0 (diff) |
kbuild: test dead code/data elimination support in Kconfig
This config option should be enabled only when both the compiler and
the linker support necessary flags. Add proper dependencies to Kconfig.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -790,8 +790,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) | |||
790 | endif | 790 | endif |
791 | 791 | ||
792 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION | 792 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION |
793 | KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) | 793 | KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections |
794 | KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) | 794 | LDFLAGS_vmlinux += --gc-sections |
795 | endif | 795 | endif |
796 | 796 | ||
797 | # arch Makefile may override CC so keep this after arch Makefile is included | 797 | # arch Makefile may override CC so keep this after arch Makefile is included |
@@ -857,10 +857,6 @@ LDFLAGS_BUILD_ID := $(call ld-option, --build-id) | |||
857 | KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) | 857 | KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) |
858 | LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) | 858 | LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) |
859 | 859 | ||
860 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION | ||
861 | LDFLAGS_vmlinux += $(call ld-option, --gc-sections,) | ||
862 | endif | ||
863 | |||
864 | ifeq ($(CONFIG_STRIP_ASM_SYMS),y) | 860 | ifeq ($(CONFIG_STRIP_ASM_SYMS),y) |
865 | LDFLAGS_vmlinux += $(call ld-option, -X,) | 861 | LDFLAGS_vmlinux += $(call ld-option, -X,) |
866 | endif | 862 | endif |