kbuild: Move CONFIG_STACK_CANARIES check

This patch moves the CONFIG_STACK_CANARIES check from architecture's
Makefile to the root Makefile since this option is kernel-related,
not architecture-related. This way we avoid replicating the same
CONFIG_STACK_CANARIES check in several Makefiles.

This patch also removes some blank lines from the Makefiles it touches.

Change-Id: I458f92fa6799526c608369d1e56579936bcb196e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
This commit is contained in:
Andre Guedes 2016-01-07 14:21:22 -02:00 committed by Anas Nashif
commit 1622e4f4b5
4 changed files with 6 additions and 26 deletions

View file

@ -628,6 +628,12 @@ else
KBUILD_CFLAGS += -Os KBUILD_CFLAGS += -Os
endif endif
ifeq ($(CONFIG_STACK_CANARIES),y)
KBUILD_CFLAGS += $(call cc-option,-fstack-protector-all,)
else
KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector,)
endif
KBUILD_CFLAGS += $(subst $(DQUOTE),,$(CONFIG_COMPILER_OPT)) KBUILD_CFLAGS += $(subst $(DQUOTE),,$(CONFIG_COMPILER_OPT))
export LDFLAG_LINKERCMD OUTPUT_FORMAT OUTPUT_ARCH export LDFLAG_LINKERCMD OUTPUT_FORMAT OUTPUT_ARCH

View file

@ -3,11 +3,5 @@ arch-$(CONFIG_LTO) = $(call cc-option,-flto,)
arch-$(CONFIG_CPU_ARCEM4) = $(call cc-option,-mARCv2EM) \ arch-$(CONFIG_CPU_ARCEM4) = $(call cc-option,-mARCv2EM) \
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
ifeq ($(CONFIG_STACK_CANARIES),y)
cflags-y += $(call cc-option,-fstack-protector-all,)
else
cflags-y += $(call cc-option,-fno-stack-protector,)
endif
KBUILD_CFLAGS += $(arch-y) $(cflags-y) KBUILD_CFLAGS += $(arch-y) $(cflags-y)
KBUILD_AFLAGS += $(arch-y) KBUILD_AFLAGS += $(arch-y)

View file

@ -1,5 +1,3 @@
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,) KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,)
arch-$(CONFIG_CPU_CORTEX_M3) += $(call cc-option,-mthumb -mcpu=cortex-m3) \ arch-$(CONFIG_CPU_CORTEX_M3) += $(call cc-option,-mthumb -mcpu=cortex-m3) \
@ -9,16 +7,9 @@ arch-$(CONFIG_CPU_CORTEX_M4) += $(call cc-option,-mthumb -mcpu=cortex-m4) \
cflags-$(CONFIG_LTO) = $(call cc-option,-flto,) cflags-$(CONFIG_LTO) = $(call cc-option,-flto,)
ifeq ($(CONFIG_STACK_CANARIES),y)
cflags-y += $(call cc-option,-fstack-protector-all,)
else
cflags-y += $(call cc-option,-fno-stack-protector,)
endif
KBUILD_CFLAGS += $(cflags-y) $(arch-y) KBUILD_CFLAGS += $(cflags-y) $(arch-y)
KBUILD_AFLAGS += $(arch-y) KBUILD_AFLAGS += $(arch-y)
QEMU_CPU_TYPE_arm = cortex-m3 QEMU_CPU_TYPE_arm = cortex-m3
QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \ QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \
-machine lm3s6965evb -nographic -machine lm3s6965evb -nographic

View file

@ -1,5 +1,3 @@
PERF_OPT=$(if $(filter -Os,$(KBUILD_CFLAGS)),,y) PERF_OPT=$(if $(filter -Os,$(KBUILD_CFLAGS)),,y)
cflags-y += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,) cflags-y += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,)
@ -18,7 +16,6 @@ cflags-$(PREFERRED_STACK_BOUNDARY) += $(call cc-option,-mpreferred-stack-boundar
endif endif
cflags-$(CONFIG_LTO) += $(call cc-option,-flto,) cflags-$(CONFIG_LTO) += $(call cc-option,-flto,)
ifneq ($(CONFIG_SSE_FP_MATH),y) ifneq ($(CONFIG_SSE_FP_MATH),y)
cflags-y += -mno-sse cflags-y += -mno-sse
endif endif
@ -27,17 +24,9 @@ arch-$(CONFIG_CPU_ATOM) += $(call cc-option,-march=atom) \
$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
arch-$(CONFIG_CPU_MINUTEIA) += $(call cc-option,-march=pentium) arch-$(CONFIG_CPU_MINUTEIA) += $(call cc-option,-march=pentium)
ifeq ($(CONFIG_STACK_CANARIES),y)
cflags-y += $(call cc-option,-fstack-protector-all,)
else
cflags-y += $(call cc-option,-fno-stack-protector,)
endif
KBUILD_CFLAGS += $(cflags-y) $(arch-y) KBUILD_CFLAGS += $(cflags-y) $(arch-y)
KBUILD_AFLAGS += $(arch-y) KBUILD_AFLAGS += $(arch-y)
QEMU_BIOS ?= /usr/share/qemu QEMU_BIOS ?= /usr/share/qemu
QEMU_CPU_TYPE_x86 = qemu32 QEMU_CPU_TYPE_x86 = qemu32
QEMU_X86_NO_REBOOT_y = QEMU_X86_NO_REBOOT_y =