- 31 Mar, 2014 40 commits
-
-
Mark Charlebois authored
Add missing abort for arch aarch64. Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Mark Charlebois authored
futex_init passes in uaddr = 0. The LLVM optimizer will see that *uaddr is 0, set the register to xzr and compilation will fail. Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Mark Charlebois authored
Make sure the return value in AARCH64 __xchg() and __cmpxchg() is initialized in the default case of the switch so that we never return an uninitialized value. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Mark Charlebois authored
Fix variable types for 64-bit inline assembly. Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
-
Behan Webster authored
Use current_stack_pointer() instead of a named register. This change supports being able to compile the kernel with both gcc and Clang. Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Behan Webster authored
Use the frame pointer to calculate the location of thread info. This change supports being able to compile the kernel with both gcc and Clang. Signed-off-by:
Behan Webster <behanw@converseincode.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:
Behan Webster <behanw@converseincode.com>
-
Behan Webster authored
A macro to get the current stack pointer which allows for a single place in which to do so with ASM. Before this named registers (a gcc extension) was used to get the stack pointer. Using ASM is a more portable way of getting the stack pointer which works with both gcc and clang. This macro is of the same name used in the X86 arch. Signed-off-by:
Behan Webster <behanw@converseincode.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
These symbols are required when compiling the Linux kernel for arch ARM64 with clang. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.com>
-
Mark Charlebois authored
The use of sp as a named register variable is not supported in clang and the behavior they are working around in GCC may not even be present in clang. See commit 509eb76e 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. Signed-off-by:
Mark Charlebois <charlebm@gmail.com> Signed-off-by:
Behan Webster <behanw@converseincode.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> Acked-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
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. This version of the patch removes the trailing alignment that the VLAIS structure would allocate in order to simplify the patch. 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
-