diff options
Diffstat (limited to 'include/linux/compiler.h')
| -rw-r--r-- | include/linux/compiler.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 05205c74bc4c..cd8cca0fef8f 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -13,4 +13,11 @@ #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) +/* This macro obfuscates arithmetic on a variable address so that gcc + shouldn't recognize the original var, and make assumptions about it */ + strcpy(s, "xxx"+X) => memcpy(s, "xxx"+X, 4-X) */ +#define RELOC_HIDE(var, off) \ + ({ __typeof__(&(var)) __ptr; \ + __asm__ ("" : "=g"(__ptr) : "0"((void *)&(var) + (off))); \ + *__ptr; }) #endif /* __LINUX_COMPILER_H */ |
