Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e85d1d65 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent f6f57a46
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -790,8 +790,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
endif
endif


ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS_KERNEL	+= $(call cc-option,-ffunction-sections,)
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
KBUILD_CFLAGS_KERNEL	+= $(call cc-option,-fdata-sections,)
LDFLAGS_vmlinux += --gc-sections
endif
endif


# arch Makefile may override CC so keep this after arch Makefile is included
# 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)
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)


ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
LDFLAGS_vmlinux	+= $(call ld-option, --gc-sections,)
endif

ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
LDFLAGS_vmlinux	+= $(call ld-option, -X,)
LDFLAGS_vmlinux	+= $(call ld-option, -X,)
endif
endif
+2 −0
Original line number Original line Diff line number Diff line
@@ -1085,6 +1085,8 @@ config LD_DEAD_CODE_DATA_ELIMINATION
	bool "Dead code and data elimination (EXPERIMENTAL)"
	bool "Dead code and data elimination (EXPERIMENTAL)"
	depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
	depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
	depends on EXPERT
	depends on EXPERT
	depends on $(cc-option,-ffunction-sections -fdata-sections)
	depends on $(ld-option,--gc-sections)
	help
	help
	  Enable this if you want to do dead code and data elimination with
	  Enable this if you want to do dead code and data elimination with
	  the linker by compiling with -ffunction-sections -fdata-sections,
	  the linker by compiling with -ffunction-sections -fdata-sections,