diff options
author | Andrey Konovalov <andrey.konovalov@linaro.org> | 2015-06-19 13:13:01 +0300 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2015-06-19 13:13:01 +0300 |
commit | 8cc81e1a91fb938114c3d81ad92126d0ce2c78e7 (patch) | |
tree | faa78230b7ebdab0354fd21171eb8dd5a7ddaec0 /Makefile | |
parent | 4e9c53a232d8806ff9ad866216cba3b986dd73d5 (diff) | |
parent | 230b22d72454f0b9ed2cf1410771bbba7830f89e (diff) |
Automatically merging tracking-llvm into merge-linux-linaro
Conflicting files:
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 40 |
1 files changed, 32 insertions, 8 deletions
@@ -303,7 +303,7 @@ HOSTCXXFLAGS = -O2 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \ - -Wno-missing-field-initializers -fno-delete-null-pointer-checks + -Wno-missing-field-initializers endif # Decide whether to build built-in, modular, or both. @@ -376,6 +376,20 @@ CFLAGS_KERNEL = AFLAGS_KERNEL = CFLAGS_GCOV = -fprofile-arcs -ftest-coverage +ifeq ($(COMPILER),clang) +ifneq ($(CROSS_COMPILE),) +CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%)) +GCC_TOOLCHAIN := $(dir $(CROSS_COMPILE)) +endif +ifneq ($(GCC_TOOLCHAIN),) +CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN) +endif +ifneq ($(IA),1) +CLANG_IA_FLAG = -no-integrated-as +endif +CLANG_FLAGS := $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_IA_FLAG) +endif + # Use USERINCLUDE when you must reference the UAPI directories only. USERINCLUDE := \ @@ -400,12 +414,12 @@ KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ - -Wno-format-security \ + -Wno-format-security $(CLANG_FLAGS) \ -std=gnu89 KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := -KBUILD_AFLAGS := -D__ASSEMBLY__ +KBUILD_AFLAGS := -D__ASSEMBLY__ $(CLANG_FLAGS) KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds @@ -609,10 +623,9 @@ all: vmlinux include arch/$(SRCARCH)/Makefile -KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) +KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) +KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) else KBUILD_CFLAGS += -O2 endif @@ -675,19 +688,24 @@ KBUILD_CFLAGS += $(stackp-flag) ifeq ($(COMPILER),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CFLAGS += -Wno-asm-operand-widths +KBUILD_CFLAGS += -Wno-initializer-overrides +KBUILD_CFLAGS += -fno-builtin + # Quiet clang warning: comparison of unsigned expression < 0 is always false KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) + # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) -KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) + else +KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) # This warning generated too much noise in a regular build. # Use make W=1 to enable this warning (see scripts/Makefile.build) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) @@ -1262,6 +1280,8 @@ help: @echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)' @echo ' dir/ - Build all files in dir and below' @echo ' dir/file.[oisS] - Build specified target only' + @echo ' dir/file.ll - Build the LLVM bitcode file' + @echo ' (requires compiler support for LLVM bitcode generation)' @echo ' dir/file.lst - Build specified mixed source/assembly target only' @echo ' (requires a recent binutils and recent build (System.map))' @echo ' dir/file.ko - Build module including final link' @@ -1538,6 +1558,10 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.ll: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.ll: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules /: prepare scripts FORCE |