[PATCH 06/46] Compiler Attributes, lto: introduce __noreorder

Jiri Slaby (SUSE)
2022-11-14T11:44:34Z

From: Andi Kleen <ak@linux.intel.com>

gcc 5 has a new no_reorder attribute that prevents top level reordering
only for that symbol. So add a new __noreorder wrapper for the
no_reorder attribute. This will be used in the next patches to support
gcc LTO.

[js] split this to introduction & use

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Martin Liska <mliska@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
include/linux/compiler_attributes.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
index 898b3458b24a..be6c71fd5ebb 100644
--- a/include/linux/compiler_attributes.h
+++ b/include/linux/compiler_attributes.h
@@ -379,4 +379,14 @@
*/
#define __fix_address noinline __noclone

+/*
+ * https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
+ */
+
+#if __has_attribute(__no_reorder__)
+#define __noreorder __attribute__((no_reorder))
+#else
+#define __noreorder
+#endif
+
#endif /* __LINUX_COMPILER_ATTRIBUTES_H */
--
2.38.1