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

From: Jiri Slaby (SUSE)
Date: Mon Nov 14 2022 - 06:44:34 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx>
Signed-off-by: Martin Liska <mliska@xxxxxxx>
Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
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