Commit e63a83e0 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild/all archs: Utilise the cc-* functions

Searched through all architectures and utilised the cc-* functions when appropriate.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent a23a4605
...@@ -22,15 +22,11 @@ $(error The assembler '$(AS)' does not support the BWX instruction) ...@@ -22,15 +22,11 @@ $(error The assembler '$(AS)' does not support the BWX instruction)
endif endif
# Determine if GCC understands the -mcpu= option. # Determine if GCC understands the -mcpu= option.
have_mcpu := $(shell if $(CC) -mcpu=ev5 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi) have_mcpu := $(call cc-option-yn, -mcpu=ev5)
have_mcpu_pca56 := $(call cc-option-yn, -mcpu=pca56)
have_mcpu_pca56 := $(shell if $(CC) -mcpu=pca56 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi) have_mcpu_ev6 := $(call cc-option-yn, -mcpu=ev6)
have_mcpu_ev67 := $(call cc-option-yn, -mcpu=ev67)
have_mcpu_ev6 := $(shell if $(CC) -mcpu=ev6 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi) have_msmall_data := $(call cc-option-yn, -msmall-data)
have_mcpu_ev67 := $(shell if $(CC) -mcpu=ev67 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
have_msmall_data := $(shell if $(CC) -msmall-data -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
cflags-$(have_msmall_data) += -msmall-data cflags-$(have_msmall_data) += -msmall-data
......
...@@ -36,8 +36,8 @@ comma = , ...@@ -36,8 +36,8 @@ comma = ,
# Note that GCC does not numerically define an architecture version # Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes # macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible. # testing for a specific architecture or later rather impossible.
arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call check_gcc,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call check_gcc,-march=armv5te,-march=armv4) arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4)
arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4 arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3 arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
...@@ -51,11 +51,11 @@ tune-$(CONFIG_CPU_ARM925T) :=-mtune=arm9tdmi ...@@ -51,11 +51,11 @@ tune-$(CONFIG_CPU_ARM925T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110 tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
tune-$(CONFIG_CPU_XSCALE) :=$(call check_gcc,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
tune-$(CONFIG_CPU_V6) :=-mtune=strongarm tune-$(CONFIG_CPU_V6) :=-mtune=strongarm
# Need -Uarm for gcc < 3.x # Need -Uarm for gcc < 3.x
CFLAGS +=-mapcs-32 $(arch-y) $(tune-y) $(call check_gcc,-malignment-traps,-mshort-load-bytes) -msoft-float -Wa,-mno-fpu -Uarm CFLAGS +=-mapcs-32 $(arch-y) $(tune-y) $(call cc-option,-malignment-traps,-mshort-load-bytes) -msoft-float -Wa,-mno-fpu -Uarm
AFLAGS +=-mapcs-32 $(arch-y) $(tune-y) -msoft-float -Wa,-mno-fpu AFLAGS +=-mapcs-32 $(arch-y) $(tune-y) -msoft-float -Wa,-mno-fpu
CHECKFLAGS += -D__arm__=1 CHECKFLAGS += -D__arm__=1
......
...@@ -23,9 +23,7 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ ...@@ -23,9 +23,7 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \
-falign-functions=32 -frename-registers -falign-functions=32 -frename-registers
CFLAGS_KERNEL := -mconstant-gp CFLAGS_KERNEL := -mconstant-gp
GCC_VERSION=$(shell $(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f1 -d'.') GCC_VERSION := $(call cc-version)
GCC_MINOR_VERSION=$(shell $(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f2 -d'.')
GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP)) GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP))
CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF)) CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF))
...@@ -37,16 +35,14 @@ $(error Sorry, you need a newer version of the assember, one that is built from ...@@ -37,16 +35,14 @@ $(error Sorry, you need a newer version of the assember, one that is built from
ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz)
endif endif
ifeq ($(GCC_VERSION),2) ifneq ($(shell if [ $(GCC_VERSION) -lt 0300 ] ; then echo "bad"; fi ;),)
$(error Sorry, your compiler is too old. GCC v2.96 is known to generate bad code.) $(error Sorry, your compiler is too old. GCC v2.96 is known to generate bad code.)
endif endif
ifeq ($(GCC_VERSION),3) ifeq ($(GCC_VERSION),0304)
ifeq ($(GCC_MINOR_VERSION),4)
# Workaround Itanium 1 bugs in gcc 3.4. # Workaround Itanium 1 bugs in gcc 3.4.
# cflags-$(CONFIG_ITANIUM) += -mtune=merced # cflags-$(CONFIG_ITANIUM) += -mtune=merced
cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley
endif
endif endif
cflags-$(CONFIG_ITANIUM_BSTEP_SPECIFIC) += -mb-step cflags-$(CONFIG_ITANIUM_BSTEP_SPECIFIC) += -mb-step
......
...@@ -56,14 +56,12 @@ endif ...@@ -56,14 +56,12 @@ endif
# #
cflags-y := -I $(TOPDIR)/include/asm/gcc cflags-y := -I $(TOPDIR)/include/asm/gcc
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
cflags-y += $(call check_gcc, -finline-limit=100000,) cflags-y += $(call cc-option, -finline-limit=100000)
LDFLAGS_vmlinux += -G 0 -static -n LDFLAGS_vmlinux += -G 0 -static -n
MODFLAGS += -mlong-calls MODFLAGS += -mlong-calls
cflags-$(CONFIG_SB1XXX_CORELIS) += -mno-sched-prolog -fno-omit-frame-pointer cflags-$(CONFIG_SB1XXX_CORELIS) += -mno-sched-prolog -fno-omit-frame-pointer
check_warning = $(shell if $(CC) $(1) -c -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
# #
# Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>) # Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>)
# #
...@@ -162,7 +160,7 @@ cflags-$(CONFIG_CPU_R5432) += \ ...@@ -162,7 +160,7 @@ cflags-$(CONFIG_CPU_R5432) += \
cflags-$(CONFIG_CPU_NEVADA) += \ cflags-$(CONFIG_CPU_NEVADA) += \
$(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \ $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \
-Wa,--trap -Wa,--trap
# $(call check_gcc,-mmad,) # $(call cc-option,-mmad)
cflags-$(CONFIG_CPU_RM7000) += \ cflags-$(CONFIG_CPU_RM7000) += \
$(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \ $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# This must match PAGE_OFFSET in include/asm-ppc/page.h. # This must match PAGE_OFFSET in include/asm-ppc/page.h.
KERNELLOAD := $(CONFIG_KERNEL_START) KERNELLOAD := $(CONFIG_KERNEL_START)
HAS_BIARCH := $(shell if $(CC) -m32 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;) HAS_BIARCH := $(call cc-option-yn, -m32)
ifeq ($(HAS_BIARCH),y) ifeq ($(HAS_BIARCH),y)
AS := $(AS) -a32 AS := $(AS) -a32
LD := $(LD) -m elf32ppc LD := $(LD) -m elf32ppc
...@@ -112,7 +112,7 @@ else ...@@ -112,7 +112,7 @@ else
NEW_AS := 0 NEW_AS := 0
endif endif
# gcc-3.4 and binutils-2.14 are a fatal combination. # gcc-3.4 and binutils-2.14 are a fatal combination.
GCC_VERSION := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) GCC_VERSION := $(call cc-version)
BAD_GCC_AS := $(shell echo mftb 5 | $(AS) -mppc -many -o /dev/null >/dev/null 2>&1 && echo 0 || echo 1) BAD_GCC_AS := $(shell echo mftb 5 | $(AS) -mppc -many -o /dev/null >/dev/null 2>&1 && echo 0 || echo 1)
checkbin: checkbin:
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
KERNELLOAD := 0xc000000000000000 KERNELLOAD := 0xc000000000000000
HAS_BIARCH := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;) HAS_BIARCH := $(call cc-option-yn, -m64)
ifeq ($(HAS_BIARCH),y) ifeq ($(HAS_BIARCH),y)
AS := $(AS) -a64 AS := $(AS) -a64
LD := $(LD) -m elf64ppc LD := $(LD) -m elf64ppc
...@@ -30,14 +30,14 @@ CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \ ...@@ -30,14 +30,14 @@ CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \
-mtraceback=none -mtraceback=none
ifeq ($(CONFIG_POWER4_ONLY),y) ifeq ($(CONFIG_POWER4_ONLY),y)
CFLAGS += $(call check_gcc,-mcpu=power4,) CFLAGS += $(call cc-option,-mcpu=power4)
else else
CFLAGS += $(call check_gcc,-mtune=power4,) CFLAGS += $(call cc-option,-mtune=power4)
endif endif
# Enable unit-at-a-time mode when possible. It shrinks the # Enable unit-at-a-time mode when possible. It shrinks the
# kernel considerably. # kernel considerably.
CFLAGS += $(call check_gcc,-funit-at-a-time,) CFLAGS += $(call cc-option,-funit-at-a-time)
head-y := arch/ppc64/kernel/head.o head-y := arch/ppc64/kernel/head.o
......
...@@ -28,12 +28,12 @@ AFLAGS += -m64 ...@@ -28,12 +28,12 @@ AFLAGS += -m64
UTS_MACHINE := s390x UTS_MACHINE := s390x
endif endif
cflags-$(CONFIG_MARCH_G5) += $(call check_gcc,-march=g5,) cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5)
cflags-$(CONFIG_MARCH_Z900) += $(call check_gcc,-march=z900,) cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900)
cflags-$(CONFIG_MARCH_Z990) += $(call check_gcc,-march=z990,) cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
CFLAGS += $(cflags-y) CFLAGS += $(cflags-y)
CFLAGS += $(call check_gcc,-finline-limit=10000,) CFLAGS += $(call cc-option,-finline-limit=10000)
CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
CFLAGS += -mbackchain CFLAGS += -mbackchain
......
...@@ -31,7 +31,7 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) := -ml ...@@ -31,7 +31,7 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) := -ml
cflags-$(CONFIG_CPU_SH2) += -m2 cflags-$(CONFIG_CPU_SH2) += -m2
cflags-$(CONFIG_CPU_SH3) += -m3 cflags-$(CONFIG_CPU_SH3) += -m3
cflags-$(CONFIG_CPU_SH4) += -m4 \ cflags-$(CONFIG_CPU_SH4) += -m4 \
$(call check_gcc,-mno-implicit-fp,-m4-nofpu) $(call cc-option,-mno-implicit-fp,-m4-nofpu)
cflags-$(CONFIG_SH_DSP) += -Wa,-dsp cflags-$(CONFIG_SH_DSP) += -Wa,-dsp
cflags-$(CONFIG_SH_KGDB) += -g cflags-$(CONFIG_SH_KGDB) += -g
......
...@@ -14,10 +14,10 @@ CPPFLAGS_vmlinux.lds += -Usparc ...@@ -14,10 +14,10 @@ CPPFLAGS_vmlinux.lds += -Usparc
CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi ) CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi )
NEW_GCC := $(shell if $(CC) -m64 -mcmodel=medlow -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo y; else echo n; fi; ) NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow)
NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi) NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi)
UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; ) UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; )
INLINE_LIMIT := $(shell if $(CC) -m64 -finline-limit=100000 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo y; else echo n; fi; ) INLINE_LIMIT := $(call cc-option-yn, -m64 -finline-limit=100000)
export NEW_GCC export NEW_GCC
......
...@@ -39,8 +39,8 @@ LDFLAGS_vmlinux := -e stext ...@@ -39,8 +39,8 @@ LDFLAGS_vmlinux := -e stext
CHECKFLAGS += -D__x86_64__=1 CHECKFLAGS += -D__x86_64__=1
cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,) cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
cflags-$(CONFIG_MPSC) += $(call check_gcc,-march=nocona,) cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
CFLAGS += $(cflags-y) CFLAGS += $(cflags-y)
CFLAGS += -mno-red-zone CFLAGS += -mno-red-zone
...@@ -54,11 +54,11 @@ ifneq ($(CONFIG_DEBUG_INFO),y) ...@@ -54,11 +54,11 @@ ifneq ($(CONFIG_DEBUG_INFO),y)
CFLAGS += -fno-asynchronous-unwind-tables CFLAGS += -fno-asynchronous-unwind-tables
# -fweb shrinks the kernel a bit, but the difference is very small # -fweb shrinks the kernel a bit, but the difference is very small
# it also messes up debugging, so don't use it for now. # it also messes up debugging, so don't use it for now.
#CFLAGS += $(call check_gcc,-fweb,) #CFLAGS += $(call cc-option,-fweb)
endif endif
# -funit-at-a-time shrinks the kernel .text considerably # -funit-at-a-time shrinks the kernel .text considerably
# unfortunately it makes reading oopses harder. # unfortunately it makes reading oopses harder.
CFLAGS += $(call check_gcc,-funit-at-a-time,) CFLAGS += $(call cc-option,-funit-at-a-time)
head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
......
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