Kbuild arm: LLVMLinux: Add Kbuild support for building arch arm with Clang
authorBehan Webster <behanw@converseincode.com>
Wed, 4 Sep 2013 02:27:26 +0000 (22:27 -0400)
committerStefan Agner <stefan@agner.ch>
Mon, 7 Aug 2017 06:21:10 +0000 (23:21 -0700)
Protect more options for arm with cc-option so that we don't get errors when
using clang instead of gcc.  Add more or different options when using clang as
well.

KernelVersion:
Author: Behan Webster <behanw@converseincode.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
arch/arm/Makefile
arch/arm/boot/compressed/Makefile

index 47d3a1ab08d2491aff178040b309180226d131e8..c8895850538703f95bfbaf5e6229143cef77c2f2 100644 (file)
@@ -29,6 +29,10 @@ GZFLAGS              :=-9
 # Never generate .eh_frame
 KBUILD_CFLAGS  += $(call cc-option,-fno-dwarf2-cfi-asm)
 
+ifeq ($(COMPILER),clang)
+KBUILD_CFLAGS += -Wa,-mno-warn-deprecated
+endif
+
 # This should work on most of the modern platforms
 KBUILD_DEFCONFIG := multi_v7_defconfig
 
@@ -39,15 +43,15 @@ KBUILD_CFLAGS       += $(call cc-option,-mno-unaligned-access)
 endif
 
 ifeq ($(CONFIG_FRAME_POINTER),y)
-KBUILD_CFLAGS  +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
+KBUILD_CFLAGS  +=-fno-omit-frame-pointer $(call cc-option,-mapcs,) $(call cc-option,-mno-sched-prolog,)
 endif
 
 ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
-KBUILD_CPPFLAGS        += -mbig-endian
+KBUILD_CPPFLAGS        += $(call cc-option,-mbig-endian)
 AS             += -EB
 LD             += -EB
 else
-KBUILD_CPPFLAGS        += -mlittle-endian
+KBUILD_CPPFLAGS        += $(call cc-option,-mlittle-endian)
 AS             += -EL
 LD             += -EL
 endif
@@ -104,7 +108,7 @@ tune-$(CONFIG_CPU_V6K)              =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
 tune-y := $(tune-y)
 
 ifeq ($(CONFIG_AEABI),y)
-CFLAGS_ABI     :=-mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
+CFLAGS_ABI     :=-mabi=aapcs-linux $(call cc-option,-mno-thumb-interwork,) -mfpu=vfp
 else
 CFLAGS_ABI     :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
 endif
@@ -128,7 +132,7 @@ AFLAGS_ISA  :=$(CFLAGS_ISA)
 endif
 
 # Need -Uarm for gcc < 3.x
-KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
+KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float $(call cc-option, -Uarm,)
 KBUILD_AFLAGS  +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
 
 CHECKFLAGS     += -D__arm__
index d50430c40045dd3e43fe37abf63f11a011e4c687..552c7d7f84ce1c38a2654c0f5e6d45a7f564ee74 100644 (file)
@@ -112,7 +112,7 @@ CFLAGS_fdt_ro.o := $(nossp_flags)
 CFLAGS_fdt_rw.o := $(nossp_flags)
 CFLAGS_fdt_wip.o := $(nossp_flags)
 
-ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
+ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin -I$(obj)
 asflags-y := -DZIMAGE
 
 # Supply kernel BSS size to the decompressor via a linker symbol.