diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index dfaa7b3e9ae9..22ab246feed3 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -205,11 +205,31 @@ | |||
205 | 205 | ||
206 | #if GCC_VERSION >= 40600 | 206 | #if GCC_VERSION >= 40600 |
207 | /* | 207 | /* |
208 | * Tell the optimizer that something else uses this function or variable. | 208 | * When used with Link Time Optimization, gcc can optimize away C functions or |
209 | * variables which are referenced only from assembly code. __visible tells the | ||
210 | * optimizer that something else uses this function or variable, thus preventing | ||
211 | * this. | ||
209 | */ | 212 | */ |
210 | #define __visible __attribute__((externally_visible)) | 213 | #define __visible __attribute__((externally_visible)) |
211 | #endif | 214 | #endif |
212 | 215 | ||
216 | |||
217 | #if GCC_VERSION >= 40900 && !defined(__CHECKER__) | ||
218 | /* | ||
219 | * __assume_aligned(n, k): Tell the optimizer that the returned | ||
220 | * pointer can be assumed to be k modulo n. The second argument is | ||
221 | * optional (default 0), so we use a variadic macro to make the | ||
222 | * shorthand. | ||
223 | * | ||
224 | * Beware: Do not apply this to functions which may return | ||
225 | * ERR_PTRs. Also, it is probably unwise to apply it to functions | ||
226 | * returning extra information in the low bits (but in that case the | ||
227 | * compiler should see some alignment anyway, when the return value is | ||
228 | * massaged by 'flags = ptr & 3; ptr &= ~3;'). | ||
229 | */ | ||
230 | #define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) | ||
231 | #endif | ||
232 | |||
213 | /* | 233 | /* |
214 | * GCC 'asm goto' miscompiles certain code sequences: | 234 | * GCC 'asm goto' miscompiles certain code sequences: |
215 | * | 235 | * |
@@ -237,12 +257,25 @@ | |||
237 | #define KASAN_ABI_VERSION 3 | 257 | #define KASAN_ABI_VERSION 3 |
238 | #endif | 258 | #endif |
239 | 259 | ||
260 | #if GCC_VERSION >= 40902 | ||
261 | /* | ||
262 | * Tell the compiler that address safety instrumentation (KASAN) | ||
263 | * should not be applied to that function. | ||
264 | * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 | ||
265 | */ | ||
266 | #define __no_sanitize_address __attribute__((no_sanitize_address)) | ||
267 | #endif | ||
268 | |||
240 | #endif /* gcc version >= 40000 specific checks */ | 269 | #endif /* gcc version >= 40000 specific checks */ |
241 | 270 | ||
242 | #if !defined(__noclone) | 271 | #if !defined(__noclone) |
243 | #define __noclone /* not needed */ | 272 | #define __noclone /* not needed */ |
244 | #endif | 273 | #endif |
245 | 274 | ||
275 | #if !defined(__no_sanitize_address) | ||
276 | #define __no_sanitize_address | ||
277 | #endif | ||
278 | |||
246 | /* | 279 | /* |
247 | * A trick to suppress uninitialized variable warning without generating any | 280 | * A trick to suppress uninitialized variable warning without generating any |
248 | * code | 281 | * code |