Commit d5e54c4e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 build updates from Ingo Molnar:
 "More Clang support related fixes"

* 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/build: Use cc-option to validate stack alignment parameter
  x86/build: Fix stack alignment for CLang
  x86/build: Drop unused mflags-y
parents 45153920 9e8730b1
...@@ -14,9 +14,11 @@ endif ...@@ -14,9 +14,11 @@ endif
# For gcc stack alignment is specified with -mpreferred-stack-boundary, # For gcc stack alignment is specified with -mpreferred-stack-boundary,
# clang has the option -mstack-alignment for that purpose. # clang has the option -mstack-alignment for that purpose.
ifneq ($(call cc-option, -mpreferred-stack-boundary=4),) ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
cc_stack_align_opt := -mpreferred-stack-boundary cc_stack_align4 := -mpreferred-stack-boundary=2
else ifneq ($(call cc-option, -mstack-alignment=4),) cc_stack_align8 := -mpreferred-stack-boundary=3
cc_stack_align_opt := -mstack-alignment else ifneq ($(call cc-option, -mstack-alignment=16),)
cc_stack_align4 := -mstack-alignment=4
cc_stack_align8 := -mstack-alignment=8
endif endif
# How to compile the 16-bit code. Note we always compile for -march=i386; # How to compile the 16-bit code. Note we always compile for -march=i386;
...@@ -36,7 +38,7 @@ REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -D__KERNEL__ \ ...@@ -36,7 +38,7 @@ REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -D__KERNEL__ \
REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding) REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding)
REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector) REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector)
REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align_opt)=2) REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4))
export REALMODE_CFLAGS export REALMODE_CFLAGS
# BITS is used as extension for files which are available in a 32 bit # BITS is used as extension for files which are available in a 32 bit
...@@ -76,7 +78,7 @@ ifeq ($(CONFIG_X86_32),y) ...@@ -76,7 +78,7 @@ ifeq ($(CONFIG_X86_32),y)
# Align the stack to the register width instead of using the default # Align the stack to the register width instead of using the default
# alignment of 16 bytes. This reduces stack usage and the number of # alignment of 16 bytes. This reduces stack usage and the number of
# alignment instructions. # alignment instructions.
KBUILD_CFLAGS += $(call cc-option,$(cc_stack_align_opt)=2) KBUILD_CFLAGS += $(call cc-option,$(cc_stack_align4))
# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
# a lot more stack due to the lack of sharing of stacklots: # a lot more stack due to the lack of sharing of stacklots:
...@@ -115,7 +117,7 @@ else ...@@ -115,7 +117,7 @@ else
# default alignment which keep the stack *mis*aligned. # default alignment which keep the stack *mis*aligned.
# Furthermore an alignment to the register width reduces stack usage # Furthermore an alignment to the register width reduces stack usage
# and the number of alignment instructions. # and the number of alignment instructions.
KBUILD_CFLAGS += $(call cc-option,$(cc_stack_align_opt)=3) KBUILD_CFLAGS += $(call cc-option,$(cc_stack_align8))
# Use -mskip-rax-setup if supported. # Use -mskip-rax-setup if supported.
KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
...@@ -232,9 +234,6 @@ KBUILD_CFLAGS += -Wno-sign-compare ...@@ -232,9 +234,6 @@ KBUILD_CFLAGS += -Wno-sign-compare
# #
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += $(mflags-y)
KBUILD_AFLAGS += $(mflags-y)
archscripts: scripts_basic archscripts: scripts_basic
$(Q)$(MAKE) $(build)=arch/x86/tools relocs $(Q)$(MAKE) $(build)=arch/x86/tools relocs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment