diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index cdf13ca7cac3..371e560d13cf 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -9,10 +9,24 @@ | |||
9 | + __GNUC_MINOR__ * 100 \ | 9 | + __GNUC_MINOR__ * 100 \ |
10 | + __GNUC_PATCHLEVEL__) | 10 | + __GNUC_PATCHLEVEL__) |
11 | 11 | ||
12 | |||
13 | /* Optimization barrier */ | 12 | /* Optimization barrier */ |
13 | |||
14 | /* The "volatile" is due to gcc bugs */ | 14 | /* The "volatile" is due to gcc bugs */ |
15 | #define barrier() __asm__ __volatile__("": : :"memory") | 15 | #define barrier() __asm__ __volatile__("": : :"memory") |
16 | /* | ||
17 | * This version is i.e. to prevent dead stores elimination on @ptr | ||
18 | * where gcc and llvm may behave differently when otherwise using | ||
19 | * normal barrier(): while gcc behavior gets along with a normal | ||
20 | * barrier(), llvm needs an explicit input variable to be assumed | ||
21 | * clobbered. The issue is as follows: while the inline asm might | ||
22 | * access any memory it wants, the compiler could have fit all of | ||
23 | * @ptr into memory registers instead, and since @ptr never escaped | ||
24 | * from that, it proofed that the inline asm wasn't touching any of | ||
25 | * it. This version works well with both compilers, i.e. we're telling | ||
26 | * the compiler that the inline asm absolutely may see the contents | ||
27 | * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 | ||
28 | */ | ||
29 | #define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") | ||
16 | 30 | ||
17 | /* | 31 | /* |
18 | * This macro obfuscates arithmetic on a variable address so that gcc | 32 | * This macro obfuscates arithmetic on a variable address so that gcc |