- 11 Mar, 2014 40 commits
-
-
Mark Charlebois authored
See http://kernel.opensuse.org/cgit/kernel/commit/?id=509eb76ebf97 The use of sp as a register variable is not supported in clang and the behavior they are working around in GCC may not even be present in clang. From the link above: Unfortunately, GCC doesn't treat a "memory" clobber on a non-volatile asm block as a side-effect, and will happily re-order it before other memory clobbers (including those in prempt_disable()) and cache the value. This has been observed to break the cmpxchg logic in the slub allocator, leading to livelock in kmem_cache_alloc in mainline kernels. Because the GCC workaround causes numerous warnings, revert the change until it can be verified that it is in fact an issue for clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Mark Charlebois authored
Patch to prevent warning of a buggy compiler when using clang and the ARM_UNWIND option. Clang defines (at least on the current trunk) GNUC, GNUC_MINOR, and GNUC_PATCHLEVEL to 4, 2, and 1 respectively. This version of GCC gets flagged as buggy, but it isn't actually an issue with clang so the patch will do what it did before unless clang is defined and then it will not report the GCC version as an issue. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Behan Webster authored
The existing code uses named registers to get the value of the stack pointer. The new current_stack_pointer macro is more readable and allows for a central portable implementation of how to get the stack pointer with ASM. This change supports being able to compile the kernel with both gcc and Clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Jan-Simon M??ller <dl9pf@gmx.de>
-
Behan Webster authored
Use the frame pointer to calculate the start of the stack for current_thread_info() The existing code uses the stack pointer to do this calculation. Using the frame pointer yeilds the same value in a portable way. This change supports being able to compile the kernel with gcc and Clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Jan-Simon M??ller <dl9pf@gmx.de>
-
Behan Webster authored
The existing code uses named registers to get the value of the stack pointer. The new current_stack_pointer macro is more readable and allows for a central portable implementation of how to get the stack pointer with ASM. This change supports being able to compile the kernel with both gcc and Clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Jan-Simon M??ller <dl9pf@gmx.de>
-
Behan Webster authored
The existing code uses named registers to get the value of the stack pointer. The new current_stack_pointer macro is more readable and allows for a central portable implementation of how to get the stack pointer with ASM. This change supports being able to compile the kernel with both gcc and Clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Jan-Simon M??ller <dl9pf@gmx.de>
-
Behan Webster authored
Use the frame pointer to calculate the end of the stack for current_pt_regs() The existing code uses the stack pointer to do this calculation. Using the frame pointer yeilds the same value in a more portable way. This change supports being able to compile the kernel with gcc and clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Jan-Simon M??ller <dl9pf@gmx.de>
-
Behan Webster authored
The current kernel code uses a named register to get the stack pointer which is only supported in gcc. For clang an alternative is to use a macro to get the current stack pointer using ASM (which is less efficient than a named resgiter). Long term the LLVMLinux project is hoping to introduce a new __builtin_stack_pointer() which will be added to both LLVM and gcc. Author: Behan Webster <behanw@converseincode.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Jan-Simon Möller <dl9pf@gmx.de> Reviewed-by:
Mark Charlebois <charlebm@gmail.com>
-
Behan Webster authored
Protect more options for arm with cc-option so that we don't get errors when using clang instead of gcc. Add more or different options when using clang as well. Author: Behan Webster <behanw@converseincode.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Behan Webster authored
With compilers which follow the C99 standard (like modern versions of gcc and clang), "extern inline" does the wrong thing (emits code for an externally linkable version of the inline function). In this case using static inline and removing the NULL version of return_address in return_address.c does the right thing. Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Mark Charlebois <charlebm@gmail.com> Acked-by:
Steven Rostedt <rostedt@goodmis.org>
-
Behan Webster authored
With compilers which follow the C99 standard (like modern versions of gcc and clang), "extern inline" does the wrong thing (emits code for an externally linkable version of the inline function). "static inline" is the correct choice instead. Author: Behan Webster <behanw@converseincode.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Reviewed-by:
Mark Charlebois <charlebm@gmail.com>
-
Behan Webster authored
These symbols are required when compiling the Linux kernel for arch ARM with clang. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Behan Webster authored
Similar to the fix in 40413dcb MODULE_DEVICE_TABLE(x86cpu, ...) expects the struct to be called struct x86cpu_device_id, and not struct x86_cpu_id which is what is used in the rest of the kernel code. Although gcc seems to ignore this error, clang fails without this define to fix the name. Code from drivers/thermal/x86_pkg_temp_thermal.c static const struct x86_cpu_id __initconst pkg_temp_thermal_ids[] = { ... }; MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids); Error from clang: drivers/thermal/x86_pkg_temp_thermal.c:577:1: error: variable has incomplete type 'const struct x86cpu_device_id' MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids); ^ include/linux/module.h:145:3: note: expanded from macro 'MODULE_DEVICE_TABLE' MODULE_GENERIC_TABLE(type##_device, name) ^ include/linux/module.h:87:32: note: expanded from macro 'MODULE_GENERIC_TABLE' extern const struct gtype##_id __mod_##gtype##_table \ ^ <scratch space>:143:1: note: expanded from here __mod_x86cpu_device_table ^ drivers/thermal/x86_pkg_temp_thermal.c:577:1: note: forward declaration of 'struct x86cpu_device_id' include/linux/module.h:145:3: note: expanded from macro 'MODULE_DEVICE_TABLE' MODULE_GENERIC_TABLE(type##_device, name) ^ include/linux/module.h:87:21: note: expanded from macro 'MODULE_GENERIC_TABLE' extern const struct gtype##_id __mod_##gtype##_table \ ^ <scratch space>:141:1: note: expanded from here x86cpu_device_id ^ 1 error generated. Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de>
-
Jan-Simon Möller authored
which do not yet support -m16 which landed in 3.5svn Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de>
-
Jan-Simon Möller authored
Protect more options for x86 with cc-option so that we don't get errors when using clang instead of gcc. Add more or different options when using clang as well. Also need to enforce that SSE is off for clang and the stack is 8-byte aligned. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Jan-Simon Möller authored
The clang integrated assembler (IA) doesn't support .code16, as a result we turn it off and use gas instead. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Cc: PaX Team <pageexec@freemail.hu>
-
Jan-Simon Möller authored
Add -no-integrated-as with cc-option. This is transparent for gcc. We need it the boot-code as we don't inherit the global no-integrated-as. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Cc: PaX Team <pageexec@freemail.hu>
-
Behan Webster authored
The only real change is passing in event_mask to the formerly nested functions. Otherwise it's just moving around function and macro code. This is the only place in the Linux kernel where nested functions are still in use. Nested functions aren't part of the C standards, and complicate the generated code. Although the Linux Kernel has never set out to be entirely C standard compliant, it is increasingly compliant to the standard which is supported by other compilers such as Clang. The LLVMLinux project is working on being able to compile the Linux kernel with Clang. The use of nested functions blocks this effort. Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Acked-by:
Henrique de Moraes Holschuh <hmh@hmh.eng.br>
-
Behan Webster authored
Use asm to make the globally named register work again for gcc and clang. Much more efficient than copying the stack pointer to a variable and back again. Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Jan-Simon Möller authored
Along with gcc >= 4.3, clang also needs memcpy exported. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Cc: PaX Team <pageexec@freemail.hu>
-
Behan Webster authored
Ignore the flags set in Kconfig for hweight if the compiler is clang. This is also reported as LLVM PR9457 Author: Behan Webster <behanw@converseincode.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
David Woodhouse authored
Clang's intrinsics ignore -mregparm=3 when they fall back to calling the out-of-line implementations. Putting the args on the stack when memcpy() expects them in registers is not a recipe for a happy kernel. This bites with -m32 too, so clang is presumably catastrophically broken for the i386 kernel until this is fixed, unless I'm missing something. For information/testing only; do not apply. With this, I can use 'clang -m16' to build all the kernel's 16-bit code and get a successful boot. Not-signed-off-by:
David Woodhouse <David.Woodhouse@intel.com>
-
Mark Charlebois authored
This code makes a compile time type check that is optimized away. Clang complains that it generates an unused function: linux/kernel/panic.c:471:1: warning: unused function '__check_panic' [-Wunused-function] core_param(panic, panic_timeout, int, 0644); ^ linux/moduleparam.h:283:2: note: expanded from macro 'core_param' param_check_##type(name, &(var)); \ ^ <scratch space>:87:1: note: expanded from here param_check_int ^ linux/moduleparam.h:369:34: note: expanded from macro 'param_check_int' #define param_check_int(name, p) __param_check(name, p, int) ^ linux/moduleparam.h:349:22: note: expanded from macro '__param_check' static inline type *__check_##name(void) { return(p); } ^ <scratch space>:88:1: note: expanded from here __check_panic GCC won't complain for a static inline function but would if it was just a static function. Adding the unused attribute to the function declaration removes the warning. Per request from Rusty Russell it is marked as __always_unused as the code is meant to be optimized away. This code works for both GCC and clang. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Behan Webster authored
Both gcc (well, actually gnu as) and clang support the "-Wa,-gdwarf-2" option (though clang does not support "-Wa,--gdwarf-2"). Since these flags are equivalent in meaning, this patch uses the one which is better supported across compilers. Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Jan-Simon Möller authored
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code precludes the use of compilers which don't implement VLAIS (for instance the Clang compiler). This patch instead allocates the appropriate amount of memory using an char array. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Cc: pageexec@freemail.hu
-
Mark Charlebois authored
Replaced non-standard C use of Variable Length Arrays In Structs (VLAIS) in xt_repldata.h with a C99 compliant flexible array member and then calculated offsets to the other struct members. These other members aren't referenced by name in this code, however this patch maintains the same memory layout and padding as was previously accomplished using VLAIS. Had the original structure been ordered differently, with the entries VLA at the end, then it could have been a flexible member, and this patch would have been a lot simpler. However since the data stored in this structure is ultimately exported to userspace, the order of this structure can't be changed. This patch makes no attempt to change the existing behavior, merely the way in which the current layout is accomplished using standard C99 constructs. As such the code can now be compiled with either gcc or clang. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Vinícius Tinti <viniciustinti@gmail.com>
-
Jan-Simon Möller authored
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99 compliant equivalent. This is the original VLAIS struct. struct { struct aead_request req; u8 priv[crypto_aead_reqsize(tfm)]; } aead_req; This patch instead allocates the appropriate amount of memory using an char array. The new code can be compiled with both gcc and clang. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Vinícius Tinti <viniciustinti@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Jan-Simon Möller authored
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code precludes the use of compilers which don't implement VLAIS (for instance the Clang compiler). This patch instead allocates the appropriate amount of memory using an char array. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Cc: pageexec@freemail.hu
-
Jan-Simon Möller authored
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code precludes the use of compilers which don't implement VLAIS (for instance the Clang compiler). This patch instead allocates the appropriate amount of memory using an char array. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Cc: pageexec@freemail.hu
-
Jan-Simon Möller authored
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code precludes the use of compilers which don't implement VLAIS (for instance the Clang compiler). This patch instead allocates the appropriate amount of memory using an char array. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Cc: pageexec@freemail.hu
-
Jan-Simon Möller authored
Clang warns about shash not being the last variable-sized element. ctx[] is never used and can be deleted. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Cc: PaX Team <pageexec@freemail.hu>
-
Mark Charlebois authored
Add a compiler-clang.h file to add specific macros needed for compiling the kernel with clang. Initially the only override required is the macro for silencing the compiler for a purposefully uninintialized variable. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Behan Webster authored
Fix uninitialized return code in default case in cmpxchg-local.h This patch fixes the code to prevent an uninitialized return value that is detected when compiling with clang. The bug produces numerous warnings when compiling the Linux kernel with clang. Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Mark Charlebois authored
__attribute((aligned)) can only be used in type definitions, but gcc allows it to be applied to a defined type. This patch fixes errors when compiling the Linux kernel with Clang. Breaking this code into 2 lines also makes it more understandable. This is also reported as LLVM PR11071 Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Jan-Simon Möller authored
When building the LINUX_COMPILER definition, instead of merely taking the last line from "$(CC) -v", grep for ' version ' in the output. This supports both gcc and clang. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Cc: PaX Team <pageexec@freemail.hu>
-
Jan-Simon Möller authored
Clang has a few other kinds of derived files which shouldn't be added to a patch. Add them to the Documentation/dontdiff file to prevent this. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Cc: PaX Team <pageexec@freemail.hu>
-
Jan-Simon Möller authored
When compiling kernel with clang, disable warnings which are too noisy, and add the clang flag catch-undefined-behavior. Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Mark Charlebois <mcharleb@gmail.com> Cc: PaX Team <pageexec@freemail.hu>
-
Jan-Simon Möller authored
Globally disable the use of the Clang Integrated Assembler (IA). Use gas instead. IA doesn't support the gas assembly extensions used in the kernel code. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Behan Webster authored
Add support to toplevel Makefile for compiling with clang, both for HOSTCC and CC. Use cc-option to prevent gcc option from breaking clang, and from clang options from breaking gcc. Clang 3.4 semantics are the same as gcc semantics for unsupported flags. For unsupported warnings clang 3.4 returns true but shows a warning and gcc shows a warning and returns false. Signed-off-by:
Behan Webster <behanw@converseincode.com> Signed-off-by:
Jan-Simon Möller <dl9pf@gmx.de> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Cc: PaX Team <pageexec@freemail.hu>
-
Linus Torvalds authored
Merge misc fixes from Andrew Morton: "Nine fixes" * emailed patches from Andrew Morton akpm@linux-foundation.org>: cris: convert ffs from an object-like macro to a function-like macro hfsplus: add HFSX subfolder count support tools/testing/selftests/ipc/msgque.c: handle msgget failure return correctly MAINTAINERS: blackfin: add git repository revert "kallsyms: fix absolute addresses for kASLR" mm/Kconfig: fix URL for zsmalloc benchmark fs/proc/base.c: fix GPF in /proc/$PID/map_files mm/compaction: break out of loop on !PageBuddy in isolate_freepages_block mm: fix GFP_THISNODE callers and clarify
-