diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 74c25c8d888463..15c22574656de3 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff @@ -1,5 +1,6 @@ *.a *.aux +*.bc *.bin *.bz2 *.cis @@ -21,6 +22,7 @@ *.i *.jpeg *.ko +*.ll *.log *.lst *.lzma @@ -35,6 +37,7 @@ *.out *.patch *.pdf +*.plist *.png *.pot *.ps diff --git a/Makefile b/Makefile index 6edac73ee1baee..7c26c21bbe39e4 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTCFLAGS = -Wall -W -Wno-unused-value -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-parameter -Wno-missing-field-initializers -O2 -fomit-frame-pointer -fno-delete-null-pointer-checks HOSTCXXFLAGS = -O2 # Decide whether to build built-in, modular, or both. @@ -370,7 +370,7 @@ LINUXINCLUDE := \ KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -fno-common \ + -fno-strict-aliasing -fno-common -Qunused-arguments \ -Werror-implicit-function-declaration \ -Wno-format-security \ -fno-delete-null-pointer-checks @@ -598,7 +598,8 @@ endif # 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) +#KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 46c3bff3ced20e..52dbe5e949e195 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -52,7 +52,7 @@ config X86 select HAVE_ARCH_KGDB select HAVE_ARCH_TRACEHOOK select HAVE_GENERIC_DMA_COHERENT if X86_32 - select HAVE_EFFICIENT_UNALIGNED_ACCESS + select HAVE_EFFICIENT_UNALIGNED_ACCESS if BROKEN select USER_STACKTRACE_SUPPORT select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_DMA_API_DEBUG @@ -243,10 +243,10 @@ config X86_32_LAZY_GS def_bool y depends on X86_32 && !CC_STACKPROTECTOR -config ARCH_HWEIGHT_CFLAGS - string - default "-fcall-saved-ecx -fcall-saved-edx" if X86_32 - default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 +#config ARCH_HWEIGHT_CFLAGS +# string +# default "-fcall-saved-ecx -fcall-saved-edx" if X86_32 +# default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 config ARCH_CPU_PROBE_RELEASE def_bool y diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index ccce0ed67dde70..0fd5b21aa8ab3f 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -20,6 +20,8 @@ targets := vmlinux.bin setup.bin setup.elf bzImage targets += fdimage fdimage144 fdimage288 image.iso mtools.conf subdir- := compressed +CFLAGS_cpucheck.o = -march=i586 + setup-y += a20.o bioscall.o cmdline.o copy.o cpu.o cpucheck.o setup-y += early_serial_console.o edd.o header.o main.o mca.o memory.o setup-y += pm.o pmjump.o printf.o regs.o string.o tty.o video.o @@ -55,8 +57,9 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE # that way we can complain to the user if the CPU is insufficient. KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ -DDISABLE_BRANCH_PROFILING \ - -Wall -Wstrict-prototypes \ - -march=i386 -mregparm=3 \ + -Wall -W -Wstrict-prototypes \ + -Wno-unused-value -Wno-unused-parameter -mno-sse \ + -march=i386 -mregparm=3 -no-integrated-as \ -include $(srctree)/$(src)/code16gcc.h \ -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ $(call cc-option, -ffreestanding) \ diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index 18997e5a105312..d1fe7a36a3c3f6 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h @@ -30,6 +30,12 @@ #include #include "ctype.h" +#ifdef CONFIG_X86_32 +#define asmlinkage __attribute__((regparm(0))) +#else +#define asmlinkage +#endif + /* Useful macros */ #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) @@ -229,11 +235,26 @@ void copy_to_fs(addr_t dst, void *src, size_t len); void *copy_from_fs(void *dst, addr_t src, size_t len); void copy_to_gs(addr_t dst, void *src, size_t len); void *copy_from_gs(void *dst, addr_t src, size_t len); -void *memcpy(void *dst, void *src, size_t len); -void *memset(void *dst, int c, size_t len); -#define memcpy(d,s,l) __builtin_memcpy(d,s,l) -#define memset(d,c,l) __builtin_memset(d,c,l) +static inline void *memcpy(void *d, const void *s, size_t l) +{ + int d0, d1, d2; + asm volatile("rep ; addr32 movsb\n\t" + : "=&c" (d0), "=&D" (d1), "=&S" (d2) + : "0" (l), "1" ((long)d), "2" ((long)s) + : "memory"); + return d; +} + +static inline void *memset(void *d, char c, size_t l) +{ + int d0, d1; + asm volatile("rep ; addr32 stosb\n\t" + : "=&c" (d0), "=&D" (d1) + : "0" (l), "1" (d), "a" (c) + : "memory"); + return d; +} /* a20.c */ int enable_a20(void); @@ -340,9 +361,9 @@ int printf(const char *fmt, ...); void initregs(struct biosregs *regs); /* string.c */ -int strcmp(const char *str1, const char *str2); -int strncmp(const char *cs, const char *ct, size_t count); -size_t strnlen(const char *s, size_t maxlen); +asmlinkage int strcmp(const char *str1, const char *str2); +asmlinkage int strncmp(const char *cs, const char *ct, size_t count); +asmlinkage size_t strnlen(const char *s, size_t maxlen); unsigned int atou(const char *s); unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base); diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 8a84501acb1b96..2b52a9b6aa59bd 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -7,7 +7,7 @@ targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 -KBUILD_CFLAGS += -fno-strict-aliasing -fPIC +KBUILD_CFLAGS += -fno-strict-aliasing -fPIC -mno-sse -Wno-unused-value -no-integrated-as KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small @@ -24,6 +24,7 @@ LDFLAGS_vmlinux := -T hostprogs-y := mkpiggy HOST_EXTRACFLAGS += -I$(srctree)/tools/include +CFLAGS_REMOVE_misc.o := -fcatch-undefined-behavior VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \ $(obj)/piggy.o diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 88f7ff6da40442..19484fc1d0974d 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -109,8 +109,8 @@ static void error(char *m); */ struct boot_params *real_mode; /* Pointer to real-mode data */ -void *memset(void *s, int c, size_t n); -void *memcpy(void *dest, const void *src, size_t n); +asmlinkage void *memset(void *s, int c, size_t n); +asmlinkage void *memcpy(void *dest, const void *src, size_t n); #ifdef CONFIG_X86_64 #define memptr long @@ -218,7 +218,7 @@ void __putstr(const char *s) outb(0xff & (pos >> 1), vidport+1); } -void *memset(void *s, int c, size_t n) +asmlinkage void *memset(void *s, int c, size_t n) { int i; char *ss = s; @@ -228,7 +228,7 @@ void *memset(void *s, int c, size_t n) return s; } #ifdef CONFIG_X86_32 -void *memcpy(void *dest, const void *src, size_t n) +asmlinkage void *memcpy(void *dest, const void *src, size_t n) { int d0, d1, d2; asm volatile( diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index db75d07c3645c0..65607e5bf5f248 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c @@ -64,7 +64,7 @@ static int detect_memory_e820(void) break; } - *desc++ = buf; + memcpy(desc++, &buf, sizeof buf); count++; } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_map)); diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index 574dedfe28900c..476ddea05e1a98 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c @@ -14,7 +14,7 @@ #include "boot.h" -int strcmp(const char *str1, const char *str2) +asmlinkage int strcmp(const char *str1, const char *str2) { const unsigned char *s1 = (const unsigned char *)str1; const unsigned char *s2 = (const unsigned char *)str2; @@ -30,7 +30,7 @@ int strcmp(const char *str1, const char *str2) return 0; } -int strncmp(const char *cs, const char *ct, size_t count) +asmlinkage int strncmp(const char *cs, const char *ct, size_t count) { unsigned char c1, c2; @@ -46,7 +46,7 @@ int strncmp(const char *cs, const char *ct, size_t count) return 0; } -size_t strnlen(const char *s, size_t maxlen) +asmlinkage size_t strnlen(const char *s, size_t maxlen) { const char *es = s; while (*es && maxlen) { diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c index 49e0c18833e0d2..efd3bb3d1004c1 100644 --- a/arch/x86/boot/video-bios.c +++ b/arch/x86/boot/video-bios.c @@ -117,7 +117,7 @@ static int bios_probe(void) return nmodes; } -static __videocard video_bios = +static __videocard __used video_bios = { .card_name = "BIOS", .probe = bios_probe, diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index 11e8c6eb80a101..075812c7feb1f5 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c @@ -270,7 +270,7 @@ void vesa_store_edid(void) #endif /* not _WAKEUP */ -static __videocard video_vesa = +static __videocard __used video_vesa = { .card_name = "VESA", .probe = vesa_probe, diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c index 45bc9402aa497f..82882acfe0bb96 100644 --- a/arch/x86/boot/video-vga.c +++ b/arch/x86/boot/video-vga.c @@ -281,7 +281,7 @@ static int vga_probe(void) return mode_count[adapter]; } -static __videocard video_vga = { +static __videocard __used video_vga = { .card_name = "VGA", .probe = vga_probe, .set_mode = vga_set_mode, diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 076745fc8045a8..ac8ee5a0bf39a9 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S @@ -460,7 +460,7 @@ GLOBAL(\label) jmp ia32_ptregs_common .endm - CFI_STARTPROC32 + CFI_STARTPROC32 simple PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h index 9686c3d9ff73a1..5b8562779c3208 100644 --- a/arch/x86/include/asm/arch_hweight.h +++ b/arch/x86/include/asm/arch_hweight.h @@ -23,13 +23,7 @@ */ static inline unsigned int __arch_hweight32(unsigned int w) { - unsigned int res = 0; - - asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) - : "="REG_OUT (res) - : REG_IN (w)); - - return res; + return __sw_hweight32(w); } static inline unsigned int __arch_hweight16(unsigned int w) @@ -44,18 +38,12 @@ static inline unsigned int __arch_hweight8(unsigned int w) static inline unsigned long __arch_hweight64(__u64 w) { - unsigned long res = 0; - #ifdef CONFIG_X86_32 return __arch_hweight32((u32)w) + __arch_hweight32((u32)(w >> 32)); #else - asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) - : "="REG_OUT (res) - : REG_IN (w)); + return __sw_hweight64(w); #endif /* CONFIG_X86_32 */ - - return res; } #endif diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 6dfd0195bb5529..7f6483efb3f771 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -67,7 +67,7 @@ set_bit(unsigned int nr, volatile unsigned long *addr) : "iq" ((u8)CONST_MASK(nr)) : "memory"); } else { - asm volatile(LOCK_PREFIX "bts %1,%0" + asm volatile(LOCK_PREFIX "btsl %1,%0" : BITOP_ADDR(addr) : "Ir" (nr) : "memory"); } } @@ -83,7 +83,7 @@ set_bit(unsigned int nr, volatile unsigned long *addr) */ static inline void __set_bit(int nr, volatile unsigned long *addr) { - asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory"); + asm volatile("btsl %1,%0" : ADDR : "Ir" (nr) : "memory"); } /** @@ -104,7 +104,7 @@ clear_bit(int nr, volatile unsigned long *addr) : CONST_MASK_ADDR(nr, addr) : "iq" ((u8)~CONST_MASK(nr))); } else { - asm volatile(LOCK_PREFIX "btr %1,%0" + asm volatile(LOCK_PREFIX "btrl %1,%0" : BITOP_ADDR(addr) : "Ir" (nr)); } @@ -126,7 +126,7 @@ static inline void clear_bit_unlock(unsigned nr, volatile unsigned long *addr) static inline void __clear_bit(int nr, volatile unsigned long *addr) { - asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); + asm volatile("btrl %1,%0" : ADDR : "Ir" (nr)); } /* @@ -161,7 +161,7 @@ static inline void __clear_bit_unlock(unsigned nr, volatile unsigned long *addr) */ static inline void __change_bit(int nr, volatile unsigned long *addr) { - asm volatile("btc %1,%0" : ADDR : "Ir" (nr)); + asm volatile("btcl %1,%0" : ADDR : "Ir" (nr)); } /** @@ -180,7 +180,7 @@ static inline void change_bit(int nr, volatile unsigned long *addr) : CONST_MASK_ADDR(nr, addr) : "iq" ((u8)CONST_MASK(nr))); } else { - asm volatile(LOCK_PREFIX "btc %1,%0" + asm volatile(LOCK_PREFIX "btcl %1,%0" : BITOP_ADDR(addr) : "Ir" (nr)); } @@ -198,7 +198,7 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr) { int oldbit; - asm volatile(LOCK_PREFIX "bts %2,%1\n\t" + asm volatile(LOCK_PREFIX "btsl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); return oldbit; @@ -230,7 +230,7 @@ static inline int __test_and_set_bit(int nr, volatile unsigned long *addr) { int oldbit; - asm("bts %2,%1\n\t" + asm("btsl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr)); @@ -249,7 +249,7 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) { int oldbit; - asm volatile(LOCK_PREFIX "btr %2,%1\n\t" + asm volatile(LOCK_PREFIX "btrl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); @@ -276,7 +276,7 @@ static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) { int oldbit; - asm volatile("btr %2,%1\n\t" + asm volatile("btrl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr)); @@ -288,7 +288,7 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr) { int oldbit; - asm volatile("btc %2,%1\n\t" + asm volatile("btcl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); @@ -308,7 +308,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) { int oldbit; - asm volatile(LOCK_PREFIX "btc %2,%1\n\t" + asm volatile(LOCK_PREFIX "btcl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); @@ -325,7 +325,7 @@ static inline int variable_test_bit(int nr, volatile const unsigned long *addr) { int oldbit; - asm volatile("bt %2,%1\n\t" + asm volatile("btl %2,%1\n\t" "sbb %0,%0" : "=r" (oldbit) : "m" (*(unsigned long *)addr), "Ir" (nr)); diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index f7b4c7903e7e51..919668ab5d9ff1 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h @@ -106,7 +106,7 @@ static inline unsigned long dma_alloc_coherent_mask(struct device *dev, dma_mask = dev->coherent_dma_mask; if (!dma_mask) - dma_mask = (gfp & GFP_DMA) ? DMA_BIT_MASK(24) : DMA_BIT_MASK(32); + dma_mask = (gfp & GFP_DMA) ? (unsigned long)DMA_BIT_MASK(24) : (unsigned long)DMA_BIT_MASK(32); return dma_mask; } diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h index f6f15986df6ca0..8c4ae7378f31ff 100644 --- a/arch/x86/include/asm/dwarf2.h +++ b/arch/x86/include/asm/dwarf2.h @@ -53,7 +53,7 @@ * Due to the structure of pre-exisiting code, don't use assembler line * comment character # to ignore the arguments. Instead, use a dummy macro. */ -.macro cfi_ignore a=0, b=0, c=0, d=0 +.macro cfi_ignore a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0 .endm #define CFI_STARTPROC cfi_ignore diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index 9a25b522d37799..6c7ee90e91584c 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h @@ -32,6 +32,17 @@ addq $(SS+8-\skip), %rsp .endm +#else + +#define HAVE_ARCH_CALLER_ADDR + +#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) +#define CALLER_ADDR1 0UL +#define CALLER_ADDR2 0UL +#define CALLER_ADDR3 0UL +#define CALLER_ADDR4 0UL +#define CALLER_ADDR5 0UL +#define CALLER_ADDR6 0UL #endif #ifdef CONFIG_FUNCTION_TRACER diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h index adcc0ae73d0914..ddf687167652d6 100644 --- a/arch/x86/include/asm/init.h +++ b/arch/x86/include/asm/init.h @@ -7,7 +7,7 @@ extern void __init early_ioremap_page_table_range_init(void); extern void __init zone_sizes_init(void); -extern unsigned long __init +extern unsigned long __meminit kernel_physical_mapping_init(unsigned long start, unsigned long end, unsigned long page_size_mask); diff --git a/arch/x86/include/asm/mmconfig.h b/arch/x86/include/asm/mmconfig.h index 9b119da1d105f1..7052c3e299cb39 100644 --- a/arch/x86/include/asm/mmconfig.h +++ b/arch/x86/include/asm/mmconfig.h @@ -3,7 +3,7 @@ #ifdef CONFIG_PCI_MMCONFIG extern void __cpuinit fam10h_check_enable_mmcfg(void); -extern void __cpuinit check_enable_amd_mmconf_dmi(void); +extern void __ref check_enable_amd_mmconf_dmi(void); #else static inline void fam10h_check_enable_mmcfg(void) { } static inline void check_enable_amd_mmconf_dmi(void) { } diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 1104afaba52b68..360b69e5ad7d6d 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -493,7 +493,7 @@ do { \ #define x86_test_and_clear_bit_percpu(bit, var) \ ({ \ int old__; \ - asm volatile("btr %2,"__percpu_arg(1)"\n\tsbbl %0,%0" \ + asm volatile("btrl %2,"__percpu_arg(1)"\n\tsbbl %0,%0" \ : "=r" (old__), "+m" (var) \ : "dIr" (bit)); \ old__; \ diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index ad1fc85116743d..208a74403bb0d7 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -108,7 +108,7 @@ struct cpuinfo_x86 { __u32 extended_cpuid_level; /* Maximum supported CPUID level, -1=no CPUID: */ int cpuid_level; - __u32 x86_capability[NCAPINTS]; + __u32 x86_capability[NCAPINTS] __aligned(8); char x86_vendor_id[16]; char x86_model_id[64]; /* in KB - valid for CPUS which support this call: */ diff --git a/arch/x86/include/asm/string_32.h b/arch/x86/include/asm/string_32.h index 3d3e8353ee5c09..961683a2c5f99e 100644 --- a/arch/x86/include/asm/string_32.h +++ b/arch/x86/include/asm/string_32.h @@ -6,28 +6,28 @@ /* Let gcc decide whether to inline or use the out of line functions */ #define __HAVE_ARCH_STRCPY -extern char *strcpy(char *dest, const char *src); +extern __attribute__((regparm(0))) char *strcpy(char *dest, const char *src); #define __HAVE_ARCH_STRNCPY -extern char *strncpy(char *dest, const char *src, size_t count); +extern __attribute__((regparm(0))) char *strncpy(char *dest, const char *src, size_t count); #define __HAVE_ARCH_STRCAT -extern char *strcat(char *dest, const char *src); +extern __attribute__((regparm(0))) char *strcat(char *dest, const char *src); #define __HAVE_ARCH_STRNCAT -extern char *strncat(char *dest, const char *src, size_t count); +extern __attribute__((regparm(0))) char *strncat(char *dest, const char *src, size_t count); #define __HAVE_ARCH_STRCMP -extern int strcmp(const char *cs, const char *ct); +extern __attribute__((regparm(0))) int strcmp(const char *cs, const char *ct); #define __HAVE_ARCH_STRNCMP -extern int strncmp(const char *cs, const char *ct, size_t count); +extern __attribute__((regparm(0))) int strncmp(const char *cs, const char *ct, size_t count); #define __HAVE_ARCH_STRCHR -extern char *strchr(const char *s, int c); +extern __attribute__((regparm(0))) char *strchr(const char *s, int c); #define __HAVE_ARCH_STRLEN -extern size_t strlen(const char *s); +extern __attribute__((regparm(0))) size_t strlen(const char *s); static __always_inline void *__memcpy(void *to, const void *from, size_t n) { @@ -142,6 +142,7 @@ static __always_inline void *__constant_memcpy(void *to, const void *from, } #define __HAVE_ARCH_MEMCPY +extern __attribute__((regparm(0))) void *memcpy(void *to, const void *from, size_t len); #ifdef CONFIG_X86_USE_3DNOW @@ -197,12 +198,12 @@ static inline void *__memcpy3d(void *to, const void *from, size_t len) #endif #define __HAVE_ARCH_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); +extern __attribute__((regparm(0))) void *memmove(void *dest, const void *src, size_t n); -#define memcmp __builtin_memcmp +extern int memcmp(const void *cs, const void *ct, size_t count); #define __HAVE_ARCH_MEMCHR -extern void *memchr(const void *cs, int c, size_t count); +extern __attribute__((regparm(0))) void *memchr(const void *cs, int c, size_t count); static inline void *__memset_generic(void *s, char c, size_t count) { @@ -243,11 +244,11 @@ void *__constant_c_memset(void *s, unsigned long c, size_t count) /* Added by Gertjan van Wingerde to make minix and sysv module work */ #define __HAVE_ARCH_STRNLEN -extern size_t strnlen(const char *s, size_t count); +extern __attribute__((regparm(0))) size_t strnlen(const char *s, size_t count); /* end of additional stuff */ #define __HAVE_ARCH_STRSTR -extern char *strstr(const char *cs, const char *ct); +extern __attribute__((regparm(0))) char *strstr(const char *cs, const char *ct); /* * This looks horribly ugly, but the compiler can optimize it totally, @@ -321,6 +322,8 @@ void *__constant_c_and_count_memset(void *s, unsigned long pattern, : __memset_generic((s), (c), (count))) #define __HAVE_ARCH_MEMSET +extern __attribute__((regparm(0))) void *memset(void *s, int c, size_t count); + #if (__GNUC__ >= 4) #define memset(s, c, count) __builtin_memset(s, c, count) #else diff --git a/arch/x86/include/asm/string_64.h b/arch/x86/include/asm/string_64.h index 19e2c468fc2c80..7bd02623cfc0b3 100644 --- a/arch/x86/include/asm/string_64.h +++ b/arch/x86/include/asm/string_64.h @@ -28,7 +28,7 @@ static __always_inline void *__inline_memcpy(void *to, const void *from, size_t #define __HAVE_ARCH_MEMCPY 1 #ifndef CONFIG_KMEMCHECK -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 || defined(__clang__) extern void *memcpy(void *to, const void *from, size_t len); #else extern void *__memcpy(void *to, const void *from, size_t len); diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 2d946e63ee82bc..9ecf67f24ba4de 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -171,7 +171,7 @@ struct thread_info { /* how to get the current stack pointer from C */ -register unsigned long current_stack_pointer asm("esp") __used; +#define current_stack_pointer ({ unsigned long esp; asm("mov %%esp, %0" : "=r"(esp)); esp; }) /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S index 13ab720573e3e3..4a206951cbfb2d 100644 --- a/arch/x86/kernel/acpi/wakeup_32.S +++ b/arch/x86/kernel/acpi/wakeup_32.S @@ -9,7 +9,6 @@ ALIGN ENTRY(wakeup_pmode_return) -wakeup_pmode_return: movw $__KERNEL_DS, %ax movw %ax, %ss movw %ax, %ds diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index d65464e4350343..2104a2dda1c024 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c @@ -373,7 +373,7 @@ struct apm_user { static struct { unsigned long offset; unsigned short segment; -} apm_bios_entry; +} apm_bios_entry __used; static int clock_slowed; static int idle_threshold __read_mostly = DEFAULT_IDLE_THRESHOLD; static int idle_period __read_mostly = DEFAULT_IDLE_PERIOD; diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index d22d0c4edcfd0a..952669f70a7f89 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c @@ -35,7 +35,7 @@ #define VMWARE_PORT_CMD_GETHZ 45 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx) \ - __asm__("inl (%%dx)" : \ + __asm__("inl %%dx" : \ "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : \ "0"(VMWARE_HYPERVISOR_MAGIC), \ "1"(VMWARE_PORT_CMD_##cmd), \ diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index b51b2c7ee51fcb..50cefbbdaf4622 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -542,7 +542,7 @@ END(save_paranoid) ENTRY(ret_from_fork) DEFAULT_FRAME - LOCK ; btr $TIF_FORK,TI_flags(%r8) + LOCK ; btrl $TIF_FORK,TI_flags(%r8) pushq_cfi $0x0002 popfq_cfi # reset kernel eflags diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/head.c index 48d9d4ea1020fa..552313b9106b77 100644 --- a/arch/x86/kernel/head.c +++ b/arch/x86/kernel/head.c @@ -20,6 +20,7 @@ void __init reserve_ebda_region(void) { unsigned int lowmem, ebda_addr; + unsigned char *p; /* To determine the position of the EBDA and the */ /* end of conventional memory, we need to look at */ @@ -31,7 +32,8 @@ void __init reserve_ebda_region(void) return; /* end of low (conventional) memory */ - lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES); + p = __va(BIOS_LOWMEM_KILOBYTES); + lowmem = p[0] + 256 * p[1]; lowmem <<= 10; /* start of EBDA area */ diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index 94bf9cc2c7ee5f..852c4815feca06 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -457,5 +457,6 @@ ENTRY(nmi_idt_table) __PAGE_ALIGNED_BSS .align PAGE_SIZE -ENTRY(empty_zero_page) +.globl empty_zero_page +empty_zero_page: .skip PAGE_SIZE diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 22a1530146a874..ccb912560a24d7 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -304,6 +304,7 @@ SECTIONS __bss_start = .; *(.bss..page_aligned) *(.bss) + *(.gnu.linkonce.b.*) . = ALIGN(PAGE_SIZE); __bss_stop = .; } diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 39171cb307ea05..bba39bfa1c4b03 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -426,8 +426,7 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt) _ASM_EXTABLE(1b, 3b) \ : "=m" ((ctxt)->eflags), "=&r" (_tmp), \ "+a" (*rax), "+d" (*rdx), "+qm"(_ex) \ - : "i" (EFLAGS_MASK), "m" ((ctxt)->src.val), \ - "a" (*rax), "d" (*rdx)); \ + : "i" (EFLAGS_MASK), "m" ((ctxt)->src.val)); \ } while (0) /* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */ diff --git a/arch/x86/lib/cmpxchg16b_emu.S b/arch/x86/lib/cmpxchg16b_emu.S index 1e572c507d06c2..72928c1fda727c 100644 --- a/arch/x86/lib/cmpxchg16b_emu.S +++ b/arch/x86/lib/cmpxchg16b_emu.S @@ -39,7 +39,6 @@ CFI_STARTPROC # *atomic* on a single cpu (as provided by the this_cpu_xx class of # macros). # -this_cpu_cmpxchg16b_emu: pushf cli diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S index a30ca15be21c8a..a1f794e0db483e 100644 --- a/arch/x86/lib/copy_user_64.S +++ b/arch/x86/lib/copy_user_64.S @@ -103,7 +103,6 @@ ENDPROC(_copy_from_user) .section .fixup,"ax" /* must zero dest */ ENTRY(bad_from_user) -bad_from_user: CFI_STARTPROC movl %edx,%ecx xorl %eax,%eax diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c index b908a59eccf52f..c0e6a8760f8cce 100644 --- a/arch/x86/lib/memcpy_32.c +++ b/arch/x86/lib/memcpy_32.c @@ -4,7 +4,7 @@ #undef memcpy #undef memset -void *memcpy(void *to, const void *from, size_t n) +asmlinkage void *memcpy(void *to, const void *from, size_t n) { #ifdef CONFIG_X86_USE_3DNOW return __memcpy3d(to, from, n); @@ -14,13 +14,13 @@ void *memcpy(void *to, const void *from, size_t n) } EXPORT_SYMBOL(memcpy); -void *memset(void *s, int c, size_t count) +asmlinkage void *memset(void *s, int c, size_t count) { return __memset(s, c, count); } EXPORT_SYMBOL(memset); -void *memmove(void *dest, const void *src, size_t n) +asmlinkage void *memmove(void *dest, const void *src, size_t n) { int d0,d1,d2,d3,d4,d5; char *ret = dest; @@ -196,7 +196,7 @@ void *memmove(void *dest, const void *src, size_t n) ".p2align 4\n\t" "11:" : "=&c" (d0), "=&S" (d1), "=&D" (d2), - "=r" (d3),"=r" (d4), "=r"(d5) + "=a" (d3),"=b" (d4), "=d"(d5) :"0" (n), "1" (src), "2" (dest) diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c index bd59090825dbab..b6bce886e2287f 100644 --- a/arch/x86/lib/string_32.c +++ b/arch/x86/lib/string_32.c @@ -14,7 +14,7 @@ #include #ifdef __HAVE_ARCH_STRCPY -char *strcpy(char *dest, const char *src) +asmlinkage char *strcpy(char *dest, const char *src) { int d0, d1, d2; asm volatile("1:\tlodsb\n\t" @@ -29,7 +29,7 @@ EXPORT_SYMBOL(strcpy); #endif #ifdef __HAVE_ARCH_STRNCPY -char *strncpy(char *dest, const char *src, size_t count) +asmlinkage char *strncpy(char *dest, const char *src, size_t count) { int d0, d1, d2, d3; asm volatile("1:\tdecl %2\n\t" @@ -49,7 +49,7 @@ EXPORT_SYMBOL(strncpy); #endif #ifdef __HAVE_ARCH_STRCAT -char *strcat(char *dest, const char *src) +asmlinkage char *strcat(char *dest, const char *src) { int d0, d1, d2, d3; asm volatile("repne\n\t" @@ -67,7 +67,7 @@ EXPORT_SYMBOL(strcat); #endif #ifdef __HAVE_ARCH_STRNCAT -char *strncat(char *dest, const char *src, size_t count) +asmlinkage char *strncat(char *dest, const char *src, size_t count) { int d0, d1, d2, d3; asm volatile("repne\n\t" @@ -91,7 +91,7 @@ EXPORT_SYMBOL(strncat); #endif #ifdef __HAVE_ARCH_STRCMP -int strcmp(const char *cs, const char *ct) +asmlinkage int strcmp(const char *cs, const char *ct) { int d0, d1; int res; @@ -114,7 +114,7 @@ EXPORT_SYMBOL(strcmp); #endif #ifdef __HAVE_ARCH_STRNCMP -int strncmp(const char *cs, const char *ct, size_t count) +asmlinkage int strncmp(const char *cs, const char *ct, size_t count) { int res; int d0, d1, d2; @@ -139,7 +139,7 @@ EXPORT_SYMBOL(strncmp); #endif #ifdef __HAVE_ARCH_STRCHR -char *strchr(const char *s, int c) +asmlinkage char *strchr(const char *s, int c) { int d0; char *res; @@ -161,7 +161,7 @@ EXPORT_SYMBOL(strchr); #endif #ifdef __HAVE_ARCH_STRLEN -size_t strlen(const char *s) +asmlinkage size_t strlen(const char *s) { int d0; size_t res; @@ -176,7 +176,7 @@ EXPORT_SYMBOL(strlen); #endif #ifdef __HAVE_ARCH_MEMCHR -void *memchr(const void *cs, int c, size_t count) +asmlinkage void *memchr(const void *cs, int c, size_t count) { int d0; void *res; @@ -213,7 +213,7 @@ EXPORT_SYMBOL(memscan); #endif #ifdef __HAVE_ARCH_STRNLEN -size_t strnlen(const char *s, size_t count) +asmlinkage size_t strnlen(const char *s, size_t count) { int d0; int res; diff --git a/arch/x86/lib/strstr_32.c b/arch/x86/lib/strstr_32.c index 8e2d55f754bff8..13bd7167cf3830 100644 --- a/arch/x86/lib/strstr_32.c +++ b/arch/x86/lib/strstr_32.c @@ -1,6 +1,6 @@ #include -char *strstr(const char *cs, const char *ct) +__attribute__((regparm(0))) char *strstr(const char *cs, const char *ct) { int d0, d1; register char *__res; diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index cbca565af5bd51..686f2676ec36eb 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -14,8 +14,7 @@ void __init setup_real_mode(void) u16 real_mode_seg; u32 *rel; u32 count; - u32 *ptr; - u16 *seg; + u32 ptr; int i; unsigned char *base; struct trampoline_header *trampoline_header; @@ -44,17 +43,15 @@ void __init setup_real_mode(void) /* 16-bit segment relocations. */ count = rel[0]; rel = &rel[1]; - for (i = 0; i < count; i++) { - seg = (u16 *) (base + rel[i]); - *seg = real_mode_seg; - } + for (i = 0; i < count; i++) + memcpy(base + rel[i], &real_mode_seg, sizeof real_mode_seg); /* 32-bit linear relocations. */ count = rel[i]; rel = &rel[i + 1]; for (i = 0; i < count; i++) { - ptr = (u32 *) (base + rel[i]); - *ptr += __pa(base); + ptr = (u32)__pa(base); + memcpy(base + rel[i], &ptr, sizeof ptr); } /* Must be perfomed *after* relocation. */ diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile index 88692871823f99..8e297815a5cd19 100644 --- a/arch/x86/realmode/rm/Makefile +++ b/arch/x86/realmode/rm/Makefile @@ -19,6 +19,13 @@ wakeup-objs += video-vga.o wakeup-objs += video-vesa.o wakeup-objs += video-bios.o +AFLAGS_wakeup_asm.o = -no-integrated-as +AFLAGS_bioscall.o = -no-integrated-as +AFLAGS_copy.o = -no-integrated-as +AFLAGS_trampoline_32.o = -no-integrated-as +AFLAGS_trampoline_64.o = -no-integrated-as +AFLAGS_reboot_32.o = -no-integrated-as + realmode-y += header.o realmode-y += trampoline_$(BITS).o realmode-y += stack.o @@ -70,13 +77,14 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ -D_WAKEUP \ -I$(srctree)/arch/x86/boot \ -DDISABLE_BRANCH_PROFILING \ -Wall -Wstrict-prototypes \ - -march=i386 -mregparm=3 \ + -march=i586 -mregparm=3 \ -include $(srctree)/$(src)/../../boot/code16gcc.h \ -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ $(call cc-option, -ffreestanding) \ $(call cc-option, -fno-toplevel-reorder,\ $(call cc-option, -fno-unit-at-a-time)) \ $(call cc-option, -fno-stack-protector) \ - $(call cc-option, -mpreferred-stack-boundary=2) + $(call cc-option, -mpreferred-stack-boundary=2) \ + -no-integrated-as KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ GCOV_PROFILE := n diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk index ddcf39b1a18d3f..e6773dc8ac41c7 100644 --- a/arch/x86/tools/gen-insn-attr-x86.awk +++ b/arch/x86/tools/gen-insn-attr-x86.awk @@ -356,7 +356,7 @@ END { exit 1 # print escape opcode map's array print "/* Escape opcode map array */" - print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \ + print "const insn_attr_t * const inat_escape_tables[INAT_ESC_MAX + 1]" \ "[INAT_LSTPFX_MAX + 1] = {" for (i = 0; i < geid; i++) for (j = 0; j < max_lprefix; j++) @@ -365,7 +365,7 @@ END { print "};\n" # print group opcode map's array print "/* Group opcode map array */" - print "const insn_attr_t const *inat_group_tables[INAT_GRP_MAX + 1]"\ + print "const insn_attr_t * const inat_group_tables[INAT_GRP_MAX + 1]"\ "[INAT_LSTPFX_MAX + 1] = {" for (i = 0; i < ggid; i++) for (j = 0; j < max_lprefix; j++) @@ -374,7 +374,7 @@ END { print "};\n" # print AVX opcode map's array print "/* AVX opcode map array */" - print "const insn_attr_t const *inat_avx_tables[X86_VEX_M_MAX + 1]"\ + print "const insn_attr_t * const inat_avx_tables[X86_VEX_M_MAX + 1]"\ "[INAT_LSTPFX_MAX + 1] = {" for (i = 0; i < gaid; i++) for (j = 0; j < max_lprefix; j++) diff --git a/arch/x86/um/ksyms.c b/arch/x86/um/ksyms.c index 2e8f43ec621471..04aedcecd8878b 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/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index fd14be1d147220..3da8e90abef784 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile @@ -37,6 +37,12 @@ VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ -Wl,--no-undefined \ -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 +AFLAGS_vdso.o = -no-integrated-as +AFLAGS_vdso32.o = -no-integrated-as +AFLAGS_int80.o = -no-integrated-as +AFLAGS_syscall.o = -no-integrated-as +AFLAGS_sysenter.o = -no-integrated-as + $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so $(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE diff --git a/arch/x86/vdso/vdsox32.S b/arch/x86/vdso/vdsox32.S index d6b9a7f42a8a43..57962eab1d70cf 100644 --- a/arch/x86/vdso/vdsox32.S +++ b/arch/x86/vdso/vdsox32.S @@ -18,5 +18,6 @@ vdsox32_end: .align 8 .type vdsox32_pages, @object vdsox32_pages: - .zero (vdsox32_end - vdsox32_start + PAGE_SIZE - 1) / PAGE_SIZE * 8 +# .zero (vdsox32_end - vdsox32_start + PAGE_SIZE - 1) / PAGE_SIZE * 8 + .zero (2996 + PAGE_SIZE - 1) / PAGE_SIZE * 8 .size vdsox32_pages, .-vdsox32_pages diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c index 3b2cf569c684fa..8ad29b7b1fbfd5 100644 --- a/crypto/fcrypt.c +++ b/crypto/fcrypt.c @@ -110,7 +110,7 @@ static const __be32 sbox0[256] = { }; #undef Z -#define Z(x) cpu_to_be32((x << 27) | (x >> 5)) +#define Z(x) cpu_to_be32(((x & ~(1U << 27)) << 27) | (x >> 5)) static const __be32 sbox1[256] = { Z(0x77), Z(0x14), Z(0xa6), Z(0xfe), Z(0xb2), Z(0x5e), Z(0x8c), Z(0x3e), Z(0x67), Z(0x6c), Z(0xa1), Z(0x0d), Z(0xc2), Z(0xa2), Z(0xc1), Z(0x85), diff --git a/crypto/shash.c b/crypto/shash.c index f426330f101755..f72bcd1ac4e311 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -67,7 +67,7 @@ EXPORT_SYMBOL_GPL(crypto_shash_setkey); static inline unsigned int shash_align_buffer_size(unsigned len, unsigned long mask) { - return len + (mask & ~(__alignof__(u8 __attribute__ ((aligned))) - 1)); + return len + mask; } static int shash_update_unaligned(struct shash_desc *desc, const u8 *data, diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 7f1d40797e80a2..0dfe6031e5af0d 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile @@ -128,6 +128,11 @@ acpi-y += \ acpi-$(ACPI_FUTURE_USAGE) += rsdump.o +CFLAGS_REMOVE_tbfadt.o := -fcatch-undefined-behavior +CFLAGS_REMOVE_tbinstal.o := -fcatch-undefined-behavior +CFLAGS_REMOVE_tbutils.o := -fcatch-undefined-behavior +CFLAGS_REMOVE_tbxface.o := -fcatch-undefined-behavior + acpi-y += \ tbfadt.o \ tbfind.o \ diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 54046e51160aef..aea2f9fe98d85f 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1205,7 +1205,7 @@ loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info) return 0; } -static int +static noinline_for_stack int loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg) { struct loop_info info; @@ -1217,7 +1217,7 @@ loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg) return loop_set_status(lo, &info64); } -static int +static noinline_for_stack int loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg) { struct loop_info64 info64; @@ -1227,7 +1227,7 @@ loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg) return loop_set_status(lo, &info64); } -static int +static noinline_for_stack int loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) { struct loop_info info; struct loop_info64 info64; @@ -1245,7 +1245,7 @@ loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) { return err; } -static int +static noinline_for_stack int loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) { struct loop_info64 info64; int err = 0; diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 5a7e2739972978..e636996afb68d5 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -1,6 +1,9 @@ # # Makefile for the linux kernel. # + +CFLAGS_REMOVE_dmi_scan.o := -fcatch-undefined-behavior + obj-$(CONFIG_DMI) += dmi_scan.o obj-$(CONFIG_DMI_SYSFS) += dmi-sysfs.o obj-$(CONFIG_EDD) += edd.o diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index f511fa2f416877..697d2420df8725 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1549,7 +1549,7 @@ void i915_teardown_sysfs(struct drm_device *dev_priv); /* intel_i2c.c */ extern int intel_setup_gmbus(struct drm_device *dev); extern void intel_teardown_gmbus(struct drm_device *dev); -extern inline bool intel_gmbus_is_port_valid(unsigned port) +static inline bool intel_gmbus_is_port_valid(unsigned port) { return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD); } diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index cb56e270da111b..2421835d5daf65 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -133,7 +133,7 @@ MODULE_LICENSE("GPL"); #define VMWARE_BALLOON_CMD(cmd, data, result) \ ({ \ unsigned long __stat, __dummy1, __dummy2; \ - __asm__ __volatile__ ("inl (%%dx)" : \ + __asm__ __volatile__ ("inl %%dx" : \ "=a"(__stat), \ "=c"(__dummy1), \ "=d"(__dummy2), \ diff --git a/drivers/scsi/in2000.h b/drivers/scsi/in2000.h index 5821e1fbce084c..cd8d852ec570d8 100644 --- a/drivers/scsi/in2000.h +++ b/drivers/scsi/in2000.h @@ -72,7 +72,7 @@ int __dummy_1,__dummy_2; \ orl %%ecx, %%ecx \n \ jz 1f \n \ rep \n \ - insw (%%dx),%%es:(%%edi) \n \ + insw %%dx,%%es:(%%edi) \n \ 1: " \ : "=D" (sp) ,"=c" (__dummy_1) ,"=d" (__dummy_2) /* output */ \ : "2" (f), "0" (sp), "1" (i) /* input */ \ @@ -87,7 +87,7 @@ int __dummy_1,__dummy_2; \ orl %%ecx, %%ecx \n \ jz 1f \n \ rep \n \ - outsw %%ds:(%%esi),(%%dx) \n \ + outsw %%ds:(%%esi),%%dx \n \ 1: " \ : "=S" (sp) ,"=c" (__dummy_1) ,"=d" (__dummy_2)/* output */ \ : "2" (f), "0" (sp), "1" (i) /* input */ \ diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 8b8f7d11e10210..f3df07c4d8bd10 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -1078,7 +1078,7 @@ static int vfio_ext_cap_len(struct vfio_pci_device *vdev, u16 ecap, u16 epos) if ((dword & PCI_TPH_CAP_LOC_MASK) == PCI_TPH_LOC_CAP) { int sts; - sts = byte & PCI_TPH_CAP_ST_MASK; + sts = dword & PCI_TPH_CAP_ST_MASK; sts >>= PCI_TPH_CAP_ST_SHIFT; return PCI_TPH_BASE_SIZEOF + round_up(sts * 2, 4); } diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 99ac2cb08b43bc..56a9fd2eb1fefc 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -425,7 +425,7 @@ int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq) int j = 0; for (i = vq->done_idx; i != vq->upend_idx; i = (i + 1) % UIO_MAXIOV) { - if ((vq->heads[i].len == VHOST_DMA_DONE_LEN)) { + if (vq->heads[i].len == VHOST_DMA_DONE_LEN) { vq->heads[i].len = VHOST_DMA_CLEAR_LEN; vhost_add_used_and_signal(vq->dev, vq, vq->heads[i].id, 0); diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 0fb15bbbe43cd9..b91193037b16e1 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -903,7 +903,7 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, umode_t group_mask = S_IRWXG; umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO; - if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *)) + if (num_aces > UINT_MAX / sizeof(struct cifs_ace *)) return; ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), GFP_KERNEL); diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f5af2527fc69e2..fe2ae8423587a8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -123,7 +123,6 @@ struct session_key { /* crypto security descriptor definition */ struct sdesc { struct shash_desc shash; - char ctx[]; }; /* crypto hashing related structure/fields, not specific to a sec mech */ diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 4c6285fff598e1..88da262cb81088 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -809,7 +809,7 @@ static int compat_ioctl_preallocate(struct file *file, * simple reversible transform to make our table more evenly * distributed after sorting. */ -#define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) +#define XFORM(i) (((i) ^ (((i) & 0x1f) << 27) ^ (((i) & 0x7fff) << 17)) & 0xffffffff) #define COMPATIBLE_IOCTL(cmd) XFORM(cmd), /* ioctl should not be warned about even if it's not implemented. diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 1222ba93d80a17..5da61ca2ae3364 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -78,7 +78,7 @@ struct acpi_signal_fatal_info { /* * OSL Initialization and shutdown primitives */ -acpi_status __initdata acpi_os_initialize(void); +acpi_status __init acpi_os_initialize(void); acpi_status acpi_os_terminate(void); diff --git a/include/linux/bitops.h b/include/linux/bitops.h index a3b6b82108b9ad..872e160b22b62c 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -93,6 +93,9 @@ static inline __u64 ror64(__u64 word, unsigned int shift) */ static inline __u32 rol32(__u32 word, unsigned int shift) { + shift &= 0x1fu; + if (!shift) + return word; return (word << shift) | (word >> (32 - shift)); } @@ -103,6 +106,9 @@ static inline __u32 rol32(__u32 word, unsigned int shift) */ static inline __u32 ror32(__u32 word, unsigned int shift) { + shift &= 0x1fu; + if (!shift) + return word; return (word >> shift) | (word << (32 - shift)); } @@ -113,6 +119,9 @@ static inline __u32 ror32(__u32 word, unsigned int shift) */ static inline __u16 rol16(__u16 word, unsigned int shift) { + shift &= 0xfu; + if (!shift) + return word; return (word << shift) | (word >> (16 - shift)); } @@ -123,6 +132,9 @@ static inline __u16 rol16(__u16 word, unsigned int shift) */ static inline __u16 ror16(__u16 word, unsigned int shift) { + shift &= 0xfu; + if (!shift) + return word; return (word >> shift) | (word << (16 - shift)); } @@ -133,6 +145,9 @@ static inline __u16 ror16(__u16 word, unsigned int shift) */ static inline __u8 rol8(__u8 word, unsigned int shift) { + shift &= 0x7u; + if (!shift) + return word; return (word << shift) | (word >> (8 - shift)); } @@ -143,6 +158,9 @@ static inline __u8 rol8(__u8 word, unsigned int shift) */ static inline __u8 ror8(__u8 word, unsigned int shift) { + shift &= 0x7u; + if (!shift) + return word; return (word >> shift) | (word << (8 - shift)); } diff --git a/include/linux/err.h b/include/linux/err.h index f2edce25a76b64..a07ce273e21c2e 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -17,7 +17,7 @@ #ifndef __ASSEMBLY__ -#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) +#define IS_ERR_VALUE(x) unlikely((unsigned long)(x) >= (unsigned long)-MAX_ERRNO) static inline void * __must_check ERR_PTR(long error) { diff --git a/include/linux/init.h b/include/linux/init.h index e59041e21df32c..210886e556a980 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -308,13 +308,13 @@ void __init parse_early_options(char *cmdline); #define module_init(initfn) \ static inline initcall_t __inittest(void) \ { return initfn; } \ - int init_module(void) __attribute__((alias(#initfn))); + int init_module(void) __init __attribute__((alias(#initfn))); /* This is only required if you want to be unloadable. */ #define module_exit(exitfn) \ static inline exitcall_t __exittest(void) \ { return exitfn; } \ - void cleanup_module(void) __attribute__((alias(#exitfn))); + void cleanup_module(void) __exit __attribute__((alias(#exitfn))); #define __setup_param(str, unique_id, fn) /* nothing */ #define __setup(str, func) /* nothing */ diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 807f1e5332267e..7657122389b314 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -24,7 +24,7 @@ * alignment directives yourself */ #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw" -#define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw" +#define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw", @nobits /* * This is used by architectures to keep arguments on the stack diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 7a7db09cfabc18..fc58773bcc5c2c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -478,7 +478,7 @@ static inline int cpu_of(struct rq *rq) #endif } -DECLARE_PER_CPU(struct rq, runqueues); +DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); #define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) #define this_rq() (&__get_cpu_var(runqueues)) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e7f7d993357a57..a2090b33f15b74 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1008,7 +1008,7 @@ static int __init dynamic_debug_init(void) int n = 0, entries = 0, modct = 0; int verbose_bytes = 0; - if (__start___verbose == __stop___verbose) { + if (&__start___verbose == &__stop___verbose) { pr_warn("_ddebug table is empty in a " "CONFIG_DYNAMIC_DEBUG build"); return 1; diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 4d64cc2e3fa9bf..d64bba506781e3 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -320,7 +320,7 @@ int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) } EXPORT_SYMBOL(__ethtool_get_settings); -static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) +static noinline_for_stack int ethtool_get_settings(struct net_device *dev, void __user *useraddr) { int err; struct ethtool_cmd cmd; @@ -334,7 +334,7 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) return 0; } -static int ethtool_set_settings(struct net_device *dev, void __user *useraddr) +static noinline_for_stack int ethtool_set_settings(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd cmd; diff --git a/net/sctp/socket.c b/net/sctp/socket.c index a60d1f8b41c5e2..f8539440ac5050 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -2458,7 +2458,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, return 0; } -static int sctp_setsockopt_peer_addr_params(struct sock *sk, +static noinline_for_stack int sctp_setsockopt_peer_addr_params(struct sock *sk, char __user *optval, unsigned int optlen) { @@ -2723,7 +2723,7 @@ static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, unsigne * sinfo_timetolive. The user must provide the sinfo_assoc_id field in * to this call if the caller is using the UDP model. */ -static int sctp_setsockopt_default_send_param(struct sock *sk, +static noinline_for_stack int sctp_setsockopt_default_send_param(struct sock *sk, char __user *optval, unsigned int optlen) { @@ -2763,7 +2763,7 @@ static int sctp_setsockopt_default_send_param(struct sock *sk, * the association primary. The enclosed address must be one of the * association peer's addresses. */ -static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval, +static noinline_for_stack int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval, unsigned int optlen) { struct sctp_prim prim; @@ -3039,7 +3039,7 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned * locally bound addresses. The following structure is used to make a * set primary request: */ -static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optval, +static noinline_for_stack int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optval, unsigned int optlen) { struct net *net = sock_net(sk); @@ -4051,7 +4051,7 @@ SCTP_STATIC void sctp_shutdown(struct sock *sk, int how) * number of unacked data chunks, and number of data chunks pending * receipt. This information is read-only. */ -static int sctp_getsockopt_sctp_status(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_sctp_status(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -4131,7 +4131,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, * window, and retransmission timer values. This information is * read-only. */ -static int sctp_getsockopt_peer_addr_info(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_peer_addr_info(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -4433,7 +4433,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval * SPP_SACKDELAY_ENABLE, setting both will have undefined * results. */ -static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_peer_addr_params(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_paddrparams params; @@ -4626,7 +4626,7 @@ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval } -static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_peer_addrs(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_association *asoc; @@ -4722,7 +4722,7 @@ static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, } -static int sctp_getsockopt_local_addrs(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_local_addrs(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_bind_addr *bp; @@ -4827,7 +4827,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, * the association primary. The enclosed address must be one of the * association peer's addresses. */ -static int sctp_getsockopt_primary_addr(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_primary_addr(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_prim prim; @@ -4908,7 +4908,7 @@ static int sctp_getsockopt_adaptation_layer(struct sock *sk, int len, * * For getsockopt, it get the default sctp_sndrcvinfo structure. */ -static int sctp_getsockopt_default_send_param(struct sock *sk, +static noinline_for_stack int sctp_getsockopt_default_send_param(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -5042,7 +5042,7 @@ static int sctp_getsockopt_rtoinfo(struct sock *sk, int len, * See [SCTP] for more information. * */ -static int sctp_getsockopt_associnfo(struct sock *sk, int len, +static noinline_for_stack int sctp_getsockopt_associnfo(struct sock *sk, int len, char __user *optval, int __user *optlen) { diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0e801c3cdaf8f4..cf416f2abe61eb 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -64,12 +64,15 @@ warning- := $(empty) warning-1 := -Wextra -Wunused -Wno-unused-parameter warning-1 += -Wmissing-declarations +warning-1 += -Wno-initializer-overrides warning-1 += -Wmissing-format-attribute -warning-1 += -Wmissing-prototypes +#warning-1 += -Wmissing-prototypes warning-1 += -Wold-style-definition warning-1 += $(call cc-option, -Wmissing-include-dirs) -warning-1 += $(call cc-option, -Wunused-but-set-variable) +#warning-1 += $(call cc-option, -Wunused-but-set-variable) warning-1 += $(call cc-disable-warning, missing-field-initializers) +warning-1 += -Wno-unused-value -Wno-format -Wno-unknown-warning-option -Wno-self-assign +warning-1 += -fcatch-undefined-behavior -Wno-sign-compare -Wno-format-zero-length -Wno-uninitialized warning-2 := -Waggregate-return warning-2 += -Wcast-align diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index f221ddf6908040..cfb8440cc0b2cf 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -76,7 +76,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\" echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" + echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version '`\" ) > .tmpcompile # Only replace the real compile.h if the new one is different, diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 8b0f996883034c..f9a5fa0488b864 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -1170,7 +1170,13 @@ static inline int printable(unsigned int x) return x; } -static struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, +/* + * Rather then using noinline to prevent stack consumption, use + * noinline_for_stack instead. For documentaiton reasons. + * Neede for build with clang. + */ + +static noinline_for_stack struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, struct snd_ac97 * ac97) { struct snd_kcontrol_new template;