diff mbox

[4/5] backports: add OPTIMIZER_HIDE_VAR

Message ID 20171011143147.3337-4-johannes@sipsolutions.net (mailing list archive)
State Accepted
Headers show

Commit Message

Johannes Berg Oct. 11, 2017, 2:31 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/compiler-gccN.h | 4 ++++
 backport/backport-include/linux/compiler.h      | 4 ++++
 2 files changed, 8 insertions(+)
diff mbox

Patch

diff --git a/backport/backport-include/linux/compiler-gccN.h b/backport/backport-include/linux/compiler-gccN.h
index 23ad803dce0b..97e7541d1ab1 100644
--- a/backport/backport-include/linux/compiler-gccN.h
+++ b/backport/backport-include/linux/compiler-gccN.h
@@ -120,3 +120,7 @@ 
 #endif
 
 #endif	/* gcc version >= 40000 specific checks */
+
+#ifndef OPTIMIZER_HIDE_VAR
+#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var))
+#endif
diff --git a/backport/backport-include/linux/compiler.h b/backport/backport-include/linux/compiler.h
index e5af565b13dc..53c069df10a8 100644
--- a/backport/backport-include/linux/compiler.h
+++ b/backport/backport-include/linux/compiler.h
@@ -88,4 +88,8 @@  static __always_inline void __write_once_size(volatile void *p, void *res, int s
 })
 #endif
 
+#ifndef OPTIMIZER_HIDE_VAR
+#define OPTIMIZER_HIDE_VAR(var) barrier()
+#endif
+
 #endif /* __BACKPORT_LINUX_COMPILER_H */