diff options
author | Andrey Konovalov <andrey.konovalov@linaro.org> | 2014-11-19 18:39:04 +0300 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2014-11-19 18:39:04 +0300 |
commit | fcfb41ff5e1e8d54b27e2e8412b776b194e1fdbc (patch) | |
tree | b2efe39d4cae3e9fd1b5075697e65bd923fbd6e1 | |
parent | e51bcffa0acd3f1d05a18f088c156ebd739bcf1f (diff) | |
parent | 0645719cb17f6aafba10fb7b8bd30b665d84bf27 (diff) |
Automatically merging tracking-llvm into merge-linux-linaro
Conflicting files:
Makefile
51 files changed, 215 insertions, 149 deletions
diff --git a/.gitignore b/.gitignore index e213b27f3921..823b9d630a76 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ *.lzo *.patch *.gcno +*.ll modules.builtin Module.symvers *.dwo @@ -52,10 +52,10 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s # Default sed regexp - multiline due to syntax constraints define sed-y - "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" + "/^@->/{s:->#\(.*\):/* \1 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:@->::; p;}" endef quiet_cmd_offsets = GEN $@ @@ -302,7 +302,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. @@ -378,6 +378,17 @@ 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 +CLANG_FLAGS := $(CLANG_TARGET) $(CLANG_GCC_TC) +endif + # Use USERINCLUDE when you must reference the UAPI directories only. USERINCLUDE := \ @@ -401,12 +412,14 @@ KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ - -Wno-format-security \ + $(call cc-option,-no-integrated-as,) \ + -Wno-format-security $(CLANG_FLAGS) \ -std=gnu89 KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := -KBUILD_AFLAGS := -D__ASSEMBLY__ +KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-no-integrated-as,) \ + $(CLANG_FLAGS) KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds @@ -609,8 +622,6 @@ all: vmlinux include $(srctree)/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,) else @@ -675,19 +686,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) @@ -1260,6 +1276,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' @@ -1536,6 +1554,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 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 5d268fca88b9..2ad68d523dd1 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -26,6 +26,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 + # Do not use arch/arm/defconfig - it's always outdated. # Select a platform tht is kept up-to-date KBUILD_DEFCONFIG := versatile_defconfig @@ -37,15 +41,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 @@ -94,7 +98,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 @@ -118,7 +122,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__ diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 3ea230aa94b7..b7a39fbebad7 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -123,7 +123,7 @@ ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) endif -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. diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c index 3fb1b5a1dce9..f319c3fa0fe5 100644 --- a/arch/arm/firmware/trusted_foundations.c +++ b/arch/arm/firmware/trusted_foundations.c @@ -31,14 +31,11 @@ static unsigned long cpu_boot_addr; -static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) +static inline void tf_generic_smc(u32 type, u32 arg1, u32 arg2) { asm volatile( ".arch_extension sec\n\t" "stmfd sp!, {r4 - r11, lr}\n\t" - __asmeq("%0", "r0") - __asmeq("%1", "r1") - __asmeq("%2", "r2") "mov r3, #0\n\t" "mov r4, #0\n\t" "smc #0\n\t" diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h index 209e6504922e..a89b4076cde4 100644 --- a/arch/arm/include/asm/percpu.h +++ b/arch/arm/include/asm/percpu.h @@ -30,14 +30,14 @@ static inline void set_my_cpu_offset(unsigned long off) static inline unsigned long __my_cpu_offset(void) { unsigned long off; - register unsigned long *sp asm ("sp"); /* * Read TPIDRPRW. * We want to allow caching the value, so avoid using volatile and * instead use a fake stack read to hazard against barrier(). */ - asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : "Q" (*sp)); + asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) + : "Q" (*(const unsigned long *)current_stack_pointer)); return off; } diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h index 601264d983fa..51622ba7c4a6 100644 --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h @@ -154,9 +154,8 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs) return regs->ARM_sp; } -#define current_pt_regs(void) ({ \ - register unsigned long sp asm ("sp"); \ - (struct pt_regs *)((sp | (THREAD_SIZE - 1)) - 7) - 1; \ +#define current_pt_regs(void) ({ (struct pt_regs *) \ + ((current_stack_pointer | (THREAD_SIZE - 1)) - 7) - 1; \ }) #endif /* __ASSEMBLY__ */ diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index fc44d3761f9e..b9dc3dce59a6 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -101,14 +101,19 @@ struct thread_info { #define init_stack (init_thread_union.stack) /* + * how to get the current stack pointer in C + */ +register unsigned long current_stack_pointer asm ("sp"); + +/* * how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) __attribute_const__; static inline struct thread_info *current_thread_info(void) { - register unsigned long sp asm ("sp"); - return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); + return (struct thread_info *) + (current_stack_pointer & ~(THREAD_SIZE - 1)); } #define thread_saved_pc(tsk) \ diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c index f73891b6b730..824809eb8775 100644 --- a/arch/arm/kernel/psci.c +++ b/arch/arm/kernel/psci.c @@ -78,31 +78,33 @@ static u32 psci_power_state_pack(struct psci_power_state state) static noinline int __invoke_psci_fn_hvc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) { + register u32 function_id_r0 asm ("r0") = function_id; + register u32 arg0_r1 asm ("r1") = arg0; + register u32 arg1_r2 asm ("r2") = arg1; + register u32 arg2_r3 asm ("r3") = arg2; + asm volatile( - __asmeq("%0", "r0") - __asmeq("%1", "r1") - __asmeq("%2", "r2") - __asmeq("%3", "r3") __HVC(0) - : "+r" (function_id) - : "r" (arg0), "r" (arg1), "r" (arg2)); + : "+r" (function_id_r0) + : "r" (arg0_r1), "r" (arg1_r2), "r" (arg2_r3)); - return function_id; + return function_id_r0; } static noinline int __invoke_psci_fn_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) { + register u32 function_id_r0 asm ("r0") = function_id; + register u32 arg0_r1 asm ("r1") = arg0; + register u32 arg1_r2 asm ("r2") = arg1; + register u32 arg2_r3 asm ("r3") = arg2; + asm volatile( - __asmeq("%0", "r0") - __asmeq("%1", "r1") - __asmeq("%2", "r2") - __asmeq("%3", "r3") __SMC(0) - : "+r" (function_id) - : "r" (arg0), "r" (arg1), "r" (arg2)); + : "+r" (function_id_r0) + : "r" (arg0_r1), "r" (arg1_r2), "r" (arg2_r3)); - return function_id; + return function_id_r0; } static int psci_get_version(void) diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c index 98ea4b7eb406..24b4a04846eb 100644 --- a/arch/arm/kernel/return_address.c +++ b/arch/arm/kernel/return_address.c @@ -39,13 +39,12 @@ void *return_address(unsigned int level) { struct return_address_data data; struct stackframe frame; - register unsigned long current_sp asm ("sp"); data.level = level + 2; data.addr = NULL; frame.fp = (unsigned long)__builtin_frame_address(0); - frame.sp = current_sp; + frame.sp = current_stack_pointer; frame.lr = (unsigned long)__builtin_return_address(0); frame.pc = (unsigned long)return_address; diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index f065eb05d254..92b72375c4c7 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -134,12 +134,10 @@ static noinline void __save_stack_trace(struct task_struct *tsk, frame.pc = thread_saved_pc(tsk); #endif } else { - register unsigned long current_sp asm ("sp"); - /* We don't want this function nor the caller */ data.skip += 2; frame.fp = (unsigned long)__builtin_frame_address(0); - frame.sp = current_sp; + frame.sp = current_stack_pointer; frame.lr = (unsigned long)__builtin_return_address(0); frame.pc = (unsigned long)__save_stack_trace; } diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index cbb85c5fabf9..0bee233fef9a 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c @@ -471,7 +471,6 @@ int unwind_frame(struct stackframe *frame) void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk) { struct stackframe frame; - register unsigned long current_sp asm ("sp"); pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); @@ -485,7 +484,7 @@ void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk) frame.pc = regs->ARM_lr; } else if (tsk == current) { frame.fp = (unsigned long)__builtin_frame_address(0); - frame.sp = current_sp; + frame.sp = current_stack_pointer; frame.lr = (unsigned long)__builtin_return_address(0); frame.pc = (unsigned long)unwind_backtrace; } else { diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 0573faab96ad..b585fcf2234a 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -15,6 +15,10 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ io-readsb.o io-writesb.o io-readsl.o io-writesl.o \ call_with_stack.o bswapsdi2.o +ifeq ($(COMPILER),clang) +lib-y += eabi.o +endif + mmu-y := clear_user.o copy_page.o getuser.o putuser.o # the code in uaccess.S is not preemption safe and diff --git a/arch/arm/lib/eabi.c b/arch/arm/lib/eabi.c new file mode 100644 index 000000000000..636a403c9579 --- /dev/null +++ b/arch/arm/lib/eabi.c @@ -0,0 +1,28 @@ +/* + * EABI routines + * + * Copyright (C) 2012 Mark Charlebois + */ + +#include <linux/types.h> +#include <linux/string.h> +#include <linux/ctype.h> +#include <linux/export.h> + +void __aeabi_memcpy(void *dest, const void *src, size_t n) +{ + (void)memcpy(dest, src, n); +} +EXPORT_SYMBOL(__aeabi_memcpy); + +void __aeabi_memmove(void *dest, const void *src, size_t n) +{ + (void)memmove(dest, src, n); +} +EXPORT_SYMBOL(__aeabi_memmove); + +void __aeabi_memset(void *s, size_t n, int c) +{ + (void)memset(s, c, n); +} +EXPORT_SYMBOL(__aeabi_memset); diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index a55a7ecf146a..3937bd5d452f 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -106,9 +106,14 @@ int __init bcm_kona_smc_init(void) * request result appropriately. This result value is found in r0 * when the "smc" request completes. */ +#ifdef __clang__ +#define R12 "r12" +#else /* !__clang__ */ +#define R12 "ip" /* gcc calls r12 "ip" */ +#endif /* !__clang__ */ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) { - register u32 ip asm("ip"); /* Also called r12 */ + register u32 ip asm(R12); /* Also called r12 */ register u32 r0 asm("r0"); register u32 r4 asm("r4"); register u32 r5 asm("r5"); @@ -120,7 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) asm volatile ( /* Make sure we got the registers we want */ - __asmeq("%0", "ip") + __asmeq("%0", R12) __asmeq("%1", "r0") __asmeq("%2", "r4") __asmeq("%3", "r5") diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 7eb94e6fc376..330baf47eec5 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -697,7 +697,7 @@ config SWP_EMULATE config CPU_BIG_ENDIAN bool "Build big-endian kernel" - depends on ARCH_SUPPORTS_BIG_ENDIAN + depends on ARCH_SUPPORTS_BIG_ENDIAN && BROKEN help Say Y if you plan on running a kernel in big-endian mode. Note that your board must be properly built and your board diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile index a3f935fde975..28ccd472c1d1 100644 --- a/arch/arm64/crypto/Makefile +++ b/arch/arm64/crypto/Makefile @@ -18,7 +18,7 @@ obj-$(CONFIG_CRYPTO_GHASH_ARM64_CE) += ghash-ce.o ghash-ce-y := ghash-ce-glue.o ghash-ce-core.o obj-$(CONFIG_CRYPTO_AES_ARM64_CE) += aes-ce-cipher.o -CFLAGS_aes-ce-cipher.o += -march=armv8-a+crypto +CFLAGS_aes-ce-cipher.o += -march=armv8-a+crypto -Wa,-march=armv8-a+crypto obj-$(CONFIG_CRYPTO_AES_ARM64_CE_CCM) += aes-ce-ccm.o aes-ce-ccm-y := aes-ce-ccm-glue.o aes-ce-ccm-core.o diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h index 5f750dc96e0f..9e5ed17447ca 100644 --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h @@ -108,7 +108,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, int ret = 0; u32 val, tmp; - if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) + /* compiler may optimize uaddr to xzr if all uses are 0 which fails */ + if (uaddr == 0 || !access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) return -EFAULT; asm volatile("// futex_atomic_cmpxchg_inatomic\n" diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 286b1bec547c..1e894f7d5e22 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -147,13 +147,13 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev, #define ARCH_HAS_PREFETCH static inline void prefetch(const void *ptr) { - asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr)); + asm volatile("prfm pldl1keep, [%x0]\n" : : "r" (ptr)); } #define ARCH_HAS_PREFETCHW static inline void prefetchw(const void *ptr) { - asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr)); + asm volatile("prfm pstl1keep, [%x0]\n" : : "r" (ptr)); } #define ARCH_HAS_SPINLOCK_PREFETCH diff --git a/arch/x86/um/ksyms.c b/arch/x86/um/ksyms.c index 2e8f43ec6214..04aedcecd887 100644 --- a/arch/x86/um/ksyms.c +++ b/arch/x86/um/ksyms.c @@ -4,7 +4,7 @@ #ifndef CONFIG_X86_32 /*XXX: we need them because they would be exported by x86_64 */ -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 || defined(__clang__) EXPORT_SYMBOL(memcpy); #else EXPORT_SYMBOL(__memcpy); diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c index 7af78df241f2..5ece97f2b287 100644 --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c @@ -888,7 +888,7 @@ asmlinkage void __naked cci_enable_port_for_self(void) [sizeof_struct_ace_port] "i" (sizeof(struct cci_ace_port)), [offsetof_port_phys] "i" (offsetof(struct cci_ace_port, phys)) ); - unreachable(); + // unreachable(); // not allowed in naked function } /** diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index b3ff57d61dde..53d8baa741fb 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -731,6 +731,11 @@ static struct attribute *bch_cache_set_internal_files[] = { }; KTYPE(bch_cache_set_internal); +static int __bch_cache_cmp(const void *l, const void *r) +{ + return *((uint16_t *) r) - *((uint16_t *) l); +} + SHOW(__bch_cache) { struct cache *ca = container_of(kobj, struct cache, kobj); @@ -755,9 +760,6 @@ SHOW(__bch_cache) CACHE_REPLACEMENT(&ca->sb)); if (attr == &sysfs_priority_stats) { - int cmp(const void *l, const void *r) - { return *((uint16_t *) r) - *((uint16_t *) l); } - struct bucket *b; size_t n = ca->sb.nbuckets, i; size_t unused = 0, available = 0, dirty = 0, meta = 0; @@ -786,7 +788,7 @@ SHOW(__bch_cache) p[i] = ca->buckets[i].prio; mutex_unlock(&ca->set->bucket_lock); - sort(p, n, sizeof(uint16_t), cmp, NULL); + sort(p, n, sizeof(uint16_t), __bch_cache_cmp, NULL); while (n && !cached[n - 1]) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 32e282f4c83c..13188b7763eb 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -712,11 +712,7 @@ static int raid10_mergeable_bvec(struct request_queue *q, max = biovec->bv_len; if (mddev->merge_check_needed) { - struct { - struct r10bio r10_bio; - struct r10dev devs[conf->copies]; - } on_stack; - struct r10bio *r10_bio = &on_stack.r10_bio; + struct r10bio *r10_bio; int s; if (conf->reshape_progress != MaxSector) { /* Cannot give any guidance during reshape */ @@ -724,6 +720,10 @@ static int raid10_mergeable_bvec(struct request_queue *q, return biovec->bv_len; return 0; } + r10_bio = kmalloc(sizeof *r10_bio + + conf->copies * sizeof(struct r10dev), GFP_NOIO); + if (!r10_bio) + return 0; r10_bio->sector = sector; raid10_find_phys(conf, r10_bio); rcu_read_lock(); @@ -756,6 +756,7 @@ static int raid10_mergeable_bvec(struct request_queue *q, } } rcu_read_unlock(); + kfree(r10_bio); } return max; } @@ -4576,15 +4577,16 @@ static int handle_reshape_read_error(struct mddev *mddev, /* Use sync reads to get the blocks from somewhere else */ int sectors = r10_bio->sectors; struct r10conf *conf = mddev->private; - struct { - struct r10bio r10_bio; - struct r10dev devs[conf->copies]; - } on_stack; - struct r10bio *r10b = &on_stack.r10_bio; + struct r10bio *r10b; + int slot = 0; int idx = 0; struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec; + r10b = kmalloc(sizeof *r10b + conf->copies * sizeof(struct r10dev), + GFP_NOIO); + if (!r10b) + return -ENOMEM; r10b->sector = r10_bio->sector; __raid10_find_phys(&conf->prev, r10b); @@ -4624,11 +4626,13 @@ static int handle_reshape_read_error(struct mddev *mddev, /* couldn't read this block, must give up */ set_bit(MD_RECOVERY_INTR, &mddev->recovery); + kfree(r10b); return -EIO; } sectors -= s; idx++; } + kfree(r10b); return 0; } diff --git a/drivers/media/platform/ti-vpe/csc.c b/drivers/media/platform/ti-vpe/csc.c index 940df4000c42..44fbf41fba7f 100644 --- a/drivers/media/platform/ti-vpe/csc.c +++ b/drivers/media/platform/ti-vpe/csc.c @@ -93,12 +93,8 @@ void csc_dump_regs(struct csc_data *csc) { struct device *dev = &csc->pdev->dev; - u32 read_reg(struct csc_data *csc, int offset) - { - return ioread32(csc->base + offset); - } - -#define DUMPREG(r) dev_dbg(dev, "%-35s %08x\n", #r, read_reg(csc, CSC_##r)) +#define DUMPREG(r) dev_dbg(dev, "%-35s %08x\n", #r, \ + ioread32(csc->base + CSC_##r)) DUMPREG(CSC00); DUMPREG(CSC01); diff --git a/drivers/media/platform/ti-vpe/sc.c b/drivers/media/platform/ti-vpe/sc.c index 6314171ffe9b..1088381bd349 100644 --- a/drivers/media/platform/ti-vpe/sc.c +++ b/drivers/media/platform/ti-vpe/sc.c @@ -24,12 +24,8 @@ void sc_dump_regs(struct sc_data *sc) { struct device *dev = &sc->pdev->dev; - u32 read_reg(struct sc_data *sc, int offset) - { - return ioread32(sc->base + offset); - } - -#define DUMPREG(r) dev_dbg(dev, "%-35s %08x\n", #r, read_reg(sc, CFG_##r)) +#define DUMPREG(r) dev_dbg(dev, "%-35s %08x\n", #r, \ + ioread32(sc->base + CFG_##r)) DUMPREG(SC0); DUMPREG(SC1); diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9a18e7930b31..32458347fe03 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -26,7 +26,6 @@ #include <net/vxlan.h> MODULE_VERSION(DRV_VER); -MODULE_DEVICE_TABLE(pci, be_dev_ids); MODULE_DESCRIPTION(DRV_DESC " " DRV_VER); MODULE_AUTHOR("Emulex Corporation"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index c9c711dcd0e6..a89b5685e68b 100644 --- a/drivers/net/wimax/i2400m/fw.c +++ b/drivers/net/wimax/i2400m/fw.c @@ -652,7 +652,7 @@ static int i2400m_download_chunk(struct i2400m *i2400m, const void *chunk, struct device *dev = i2400m_dev(i2400m); struct { struct i2400m_bootrom_header cmd; - u8 cmd_payload[chunk_len]; + u8 cmd_payload[]; } __packed *buf; struct i2400m_bootrom_header ack; diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 30d74a06b993..bb3a51f86391 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 10; static unsigned int be_max_phys_size = 64; static unsigned int enable_msix = 1; -MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); MODULE_VERSION(BUILD_STR); MODULE_AUTHOR("Emulex Corporation"); diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5640ad1c8214..b27b35eb201e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -262,7 +262,7 @@ __megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) * @instance: Adapter soft state * @cmd: Command packet to be returned to free command pool */ -inline void +void megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) { unsigned long flags; @@ -1424,7 +1424,7 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, * Called by megasas_queue_command to find out if the command to be queued * is a logical drive command */ -inline int megasas_is_ldio(struct scsi_cmnd *cmd) +int megasas_is_ldio(struct scsi_cmnd *cmd) { if (!MEGASAS_IS_LOGICAL(cmd)) return 0; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index b1865a72ce59..7686bfe9a4a9 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -752,8 +752,6 @@ extern void qla8044_set_idc_dontreset(struct scsi_qla_host *ha); extern int qla8044_rd_direct(struct scsi_qla_host *vha, const uint32_t crb_reg); extern void qla8044_wr_direct(struct scsi_qla_host *vha, const uint32_t crb_reg, const uint32_t value); -extern inline void qla8044_set_qsnt_ready(struct scsi_qla_host *vha); -extern inline void qla8044_need_reset_handler(struct scsi_qla_host *vha); extern int qla8044_device_state_handler(struct scsi_qla_host *vha); extern void qla8044_clear_qsnt_ready(struct scsi_qla_host *vha); extern void qla8044_clear_drv_active(struct qla_hw_data *); diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c index 24a852828b5d..ed4d6b6b53e3 100644 --- a/drivers/scsi/qla2xxx/qla_nx2.c +++ b/drivers/scsi/qla2xxx/qla_nx2.c @@ -238,7 +238,7 @@ qla8044_rmw_crb_reg(struct scsi_qla_host *vha, return; } -inline void +static inline void qla8044_set_qsnt_ready(struct scsi_qla_host *vha) { uint32_t qsnt_state; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 2d82f8993ea1..cef2dc27103f 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2762,8 +2762,6 @@ extern void rtllib_stop_scan(struct rtllib_device *ieee); extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan); extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee); extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); -extern inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee); -extern u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee); extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr); extern void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl); @@ -2944,12 +2942,12 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); extern const long rtllib_wlan_frequencies[]; -extern inline void rtllib_increment_scans(struct rtllib_device *ieee) +static inline void rtllib_increment_scans(struct rtllib_device *ieee) { ieee->scans++; } -extern inline int rtllib_get_scans(struct rtllib_device *ieee) +static inline int rtllib_get_scans(struct rtllib_device *ieee) { return ieee->scans; } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index abb6729ae279..067a45ab97dd 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -343,7 +343,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, } } -inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) +static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) { unsigned int len, rate_len; u8 *tag; diff --git a/drivers/staging/rts5208/rtsx_transport.h b/drivers/staging/rts5208/rtsx_transport.h index b4b112372776..899bc2079dbe 100644 --- a/drivers/staging/rts5208/rtsx_transport.h +++ b/drivers/staging/rts5208/rtsx_transport.h @@ -46,7 +46,7 @@ void rtsx_add_cmd(struct rtsx_chip *chip, void rtsx_send_cmd_no_wait(struct rtsx_chip *chip); int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout); -extern inline u8 *rtsx_get_cmd_data(struct rtsx_chip *chip) +static inline u8 *rtsx_get_cmd_data(struct rtsx_chip *chip) { #ifdef CMD_USING_SG return (u8 *)(chip->host_sg_tbl_ptr); diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index afec6450450f..f6ce1aaacb8c 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -810,7 +810,7 @@ static int compat_ioctl_preallocate(struct file *file, */ #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) -#define COMPATIBLE_IOCTL(cmd) XFORM(cmd), +#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd), /* ioctl should not be warned about even if it's not implemented. Valid reasons to use this: - It is implemented with ->compat_ioctl on some device, but programs diff --git a/fs/exofs/Kconfig b/fs/exofs/Kconfig index 86194b2f799d..492746f9e61b 100644 --- a/fs/exofs/Kconfig +++ b/fs/exofs/Kconfig @@ -1,6 +1,6 @@ config EXOFS_FS tristate "exofs: OSD based file system support" - depends on SCSI_OSD_ULD + depends on SCSI_OSD_ULD && BROKEN help EXOFS is a file system that uses an OSD storage device, as its backing storage. diff --git a/fs/exofs/common.h b/fs/exofs/common.h index 7d88ef566213..9fdf02333c20 100644 --- a/fs/exofs/common.h +++ b/fs/exofs/common.h @@ -183,7 +183,7 @@ struct exofs_fcb { #define EXOFS_INO_ATTR_SIZE sizeof(struct exofs_fcb) /* This is the Attribute the fcb is stored in */ -static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF( +static const struct osd_attr g_attr_inode_data __maybe_unused = ATTR_DEF( EXOFS_APAGE_FS_DATA, EXOFS_ATTR_INODE_DATA, EXOFS_INO_ATTR_SIZE); diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 95965503afcb..18772e9c423a 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c @@ -546,27 +546,24 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev, static int __alloc_dev_table(struct exofs_sb_info *sbi, unsigned numdevs, struct exofs_dev **peds) { - struct __alloc_ore_devs_and_exofs_devs { - /* Twice bigger table: See exofs_init_comps() and comment at - * exofs_read_lookup_dev_table() - */ - struct ore_dev *oreds[numdevs * 2 - 1]; - struct exofs_dev eds[numdevs]; - } *aoded; struct exofs_dev *eds; unsigned i; - aoded = kzalloc(sizeof(*aoded), GFP_KERNEL); - if (unlikely(!aoded)) { + /* Twice bigger table: See exofs_init_comps() and comment at + * exofs_read_lookup_dev_table() + * XXX: why -1? + */ + sbi->oc.ods = kzalloc(sizeof(struct ore_dev) * (numdevs * 2 - 1) + + sizeof(struct exofs_dev) * numdevs, GFP_KERNEL); + if (unlikely(!sbi->oc.ods)) { EXOFS_ERR("ERROR: failed allocating Device array[%d]\n", numdevs); return -ENOMEM; } - sbi->oc.ods = aoded->oreds; - *peds = eds = aoded->eds; + *peds = eds = (void *)sbi->oc.ods[numdevs * 2 - 1]; for (i = 0; i < numdevs; ++i) - aoded->oreds[i] = &eds[i].ored; + sbi->oc.ods[i] = &eds[i].ored; return 0; } diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig index 3dece03f2fc8..b29dc81a8b17 100644 --- a/fs/nfs/Kconfig +++ b/fs/nfs/Kconfig @@ -125,7 +125,7 @@ config PNFS_BLOCK config PNFS_OBJLAYOUT tristate - depends on NFS_V4_1 && SCSI_OSD_ULD + depends on NFS_V4_1 && SCSI_OSD_ULD && BROKEN default NFS_V4 config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index 9e5bc42180e4..b564ae1f0440 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c @@ -301,10 +301,11 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type, bool is_reading, int ret; struct __alloc_objio_state { struct objio_state objios; - struct pnfs_osd_ioerr ioerrs[objio_seg->oc.numdevs]; + struct pnfs_osd_ioerr ioerrs[]; } *aos; - aos = kzalloc(sizeof(*aos), gfp_flags); + aos = kzalloc(sizeof(*aos) + objio_seg->oc.numdevs * + sizeof(struct pnfs_osd_ioerr), gfp_flags); if (unlikely(!aos)) return -ENOMEM; diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 02ae99e8e6d3..c7b98fbcf931 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -53,14 +53,14 @@ */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) -# define inline inline __attribute__((always_inline)) notrace -# define __inline__ __inline__ __attribute__((always_inline)) notrace -# define __inline __inline __attribute__((always_inline)) notrace +# define inline inline __attribute__((always_inline)) notrace __maybe_unused +# define __inline__ __inline__ __attribute__((always_inline)) notrace __maybe_unused +# define __inline __inline __attribute__((always_inline)) notrace __maybe_unused #else /* A lot of inline functions can cause havoc with function tracing */ -# define inline inline notrace -# define __inline__ __inline__ notrace -# define __inline __inline notrace +# define inline inline notrace __maybe_unused +# define __inline__ __inline__ notrace __maybe_unused +# define __inline __inline notrace __maybe_unused #endif #define __deprecated __attribute__((deprecated)) diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h index 22a72198c14b..75fa2c3e0e1d 100644 --- a/include/linux/kbuild.h +++ b/include/linux/kbuild.h @@ -2,14 +2,14 @@ #define __LINUX_KBUILD_H #define DEFINE(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + asm volatile("\n@->" #sym " %0 " #val : : "i" (val)) -#define BLANK() asm volatile("\n->" : : ) +#define BLANK() asm volatile("\n@->" : : ) #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)) #define COMMENT(x) \ - asm volatile("\n->#" x) + asm volatile("\n@->#" x) #endif diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h index 48e8a165e136..c7ae7211d15d 100644 --- a/include/scsi/osd_types.h +++ b/include/scsi/osd_types.h @@ -28,7 +28,7 @@ struct osd_obj_id { osd_id id; }; -static const struct __weak osd_obj_id osd_root_object = {0, 0}; +static const struct osd_obj_id osd_root_object __maybe_unused = {0, 0}; struct osd_attr { u32 attr_page; diff --git a/lib/Makefile b/lib/Makefile index 7512dc978f18..53414ed31b47 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -48,7 +48,9 @@ obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o GCOV_PROFILE_hweight.o := n +ifneq ($(COMPILER),clang) CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS)) +endif obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o obj-$(CONFIG_BTREE) += btree.o diff --git a/lib/mpi/Makefile b/lib/mpi/Makefile index 019a68c90144..f0920b8ea546 100644 --- a/lib/mpi/Makefile +++ b/lib/mpi/Makefile @@ -4,6 +4,8 @@ obj-$(CONFIG_MPILIB) = mpi.o +#CFLAGS_KERNEL += $(call cc-option,-fheinous-gnu-extensions) + mpi-y = \ generic_mpih-lshift.o \ generic_mpih-mul1.o \ diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h index aac511417ad1..76fc0da7fa07 100644 --- a/lib/mpi/longlong.h +++ b/lib/mpi/longlong.h @@ -193,8 +193,7 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype); "rI" ((USItype)(bl))) #if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__ #define umul_ppmm(xh, xl, a, b) \ - __asm__ ("%@ Inlined umul_ppmm\n" \ - "mov %|r0, %2, lsr #16 @ AAAA\n" \ + __asm__ ("mov %|r0, %2, lsr #16 @ AAAA\n" \ "mov %|r2, %3, lsr #16 @ BBBB\n" \ "bic %|r1, %2, %|r0, lsl #16 @ aaaa\n" \ "bic %0, %3, %|r2, lsl #16 @ bbbb\n" \ @@ -213,10 +212,8 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype); : "r0", "r1", "r2") #else #define umul_ppmm(xh, xl, a, b) \ - __asm__ ("%@ Inlined umul_ppmm\n" \ - "umull %r1, %r0, %r2, %r3" \ - : "=&r" ((USItype)(xh)), \ - "=r" ((USItype)(xl)) \ + __asm__ ("umull %1, %0, %2, %3" \ + : "=&r" ((xh)), "=r" ((xl)) \ : "r" ((USItype)(a)), \ "r" ((USItype)(b)) \ : "r0", "r1") diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 65e7b08bb2cc..c1a3f3fd2475 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -111,12 +111,12 @@ as-instr = $(call try-run,\ # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) # cc-option-align # Prefix align with either -falign or -malign @@ -126,7 +126,7 @@ cc-option-align = $(subst -functions=0,,\ # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) # cc-version # Usage gcc-ver := $(call cc-version) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 649ce6844033..34639552a625 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -174,6 +174,20 @@ cmd_cc_symtypes_c = \ $(obj)/%.symtypes : $(src)/%.c FORCE $(call cmd,cc_symtypes_c) +# LLVM bitcode +# Generate .ll files from .s and .c +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ + cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $< + +$(obj)/%.ll: $(src)/%.c FORCE + $(call if_changed_dep,cc_ll_c) + +quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@ + cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $< + +$(obj)/%.ll: $(src)/%.S FORCE + $(call if_changed_dep,as_ll_S) + # C (.c) files # The C file is compiled and updated dependency information is generated. # (See cmd_cc_o_c + relevant part of rule_cc_o_c) diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index c11212ff3510..86f6b852cd93 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -6,10 +6,10 @@ modpost-objs := modpost.o file2alias.o sumversion.o devicetable-offsets-file := devicetable-offsets.h define sed-y - "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" + "/^@->/{s:@->#\(.*\):/* \1 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:@->::; p;}" endef quiet_cmd_offsets = GEN $@ diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c index 532471d0b3a0..c948247e90c2 100644 --- a/security/apparmor/crypto.c +++ b/security/apparmor/crypto.c @@ -32,10 +32,7 @@ unsigned int aa_hash_size(void) int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, size_t len) { - struct { - struct shash_desc shash; - char ctx[crypto_shash_descsize(apparmor_tfm)]; - } desc; + SHASH_DESC_ON_STACK(shash, apparmor_tfm); int error = -ENOMEM; u32 le32_version = cpu_to_le32(version); @@ -46,19 +43,19 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, if (!profile->hash) goto fail; - desc.shash.tfm = apparmor_tfm; - desc.shash.flags = 0; + shash->tfm = apparmor_tfm; + shash->flags = 0; - error = crypto_shash_init(&desc.shash); + error = crypto_shash_init(shash); if (error) goto fail; - error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4); + error = crypto_shash_update(shash, (u8 *) &le32_version, 4); if (error) goto fail; - error = crypto_shash_update(&desc.shash, (u8 *) start, len); + error = crypto_shash_update(shash, (u8 *) start, len); if (error) goto fail; - error = crypto_shash_final(&desc.shash, profile->hash); + error = crypto_shash_final(shash, profile->hash); if (error) goto fail; |