projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d6da04b
)
tools compiler.h: Add OPTIMIZER_HIDE_VAR()
author
Mark Brown
<broonie@kernel.org>
Thu, 27 Jul 2023 23:26:13 +0000
(
00:26
+0100)
committer
Will Deacon
<will@kernel.org>
Fri, 4 Aug 2023 16:36:52 +0000
(17:36 +0100)
Port over the definition of OPTIMIZER_HIDE_VAR() so we can use it in
kselftests.
Signed-off-by: Mark Brown <broonie@kernel.org>
Link:
https://lore.kernel.org/r/20230728-arm64-signal-memcpy-fix-v4-2-0c1290db5d46@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
tools/include/linux/compiler.h
patch
|
blob
|
history
diff --git
a/tools/include/linux/compiler.h
b/tools/include/linux/compiler.h
index 9d36c8ce1fe7fb7fa4e662fd604abbb7d937d72f..f75cced41d59329df26e833b8c3443c1532b16b7 100644
(file)
--- a/
tools/include/linux/compiler.h
+++ b/
tools/include/linux/compiler.h
@@
-190,4
+190,10
@@
static __always_inline void __write_once_size(volatile void *p, void *res, int s
#define ___PASTE(a, b) a##b
#define __PASTE(a, b) ___PASTE(a, b)
+#ifndef OPTIMIZER_HIDE_VAR
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
+#define OPTIMIZER_HIDE_VAR(var) \
+ __asm__ ("" : "=r" (var) : "0" (var))
+#endif
+
#endif /* _TOOLS_LINUX_COMPILER_H */