diff mbox series

[v1,04/14] compiler: add unique LABEL_NAME()

Message ID db3498efc33b3065a0acb534d034f7d33ad03e19.1699025537.git.tanyuan@tinylab.org (mailing list archive)
State Handled Elsewhere
Headers show
Series DCE/DSE: Add Dead Syscalls Elimination support, part2 | expand

Commit Message

Yuan Tan Nov. 3, 2023, 3:59 p.m. UTC
From: Zhangjin Wu <falcon@tinylab.org>

unique LABEL is required by SHF_LINK_ORDER support.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 include/linux/compiler.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 5a9cc3209b12..b178f5d51ad6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -246,6 +246,12 @@  static inline void *offset_to_ptr(const int *off)
 #endif
 #endif
 
+/* Unique Label NAME. */
+/* Label is file scope, __LINE__ is enough, and not change in the same macro call */
+#ifndef __LABEL_NAME
+# define __LABEL_NAME(prefix) __stringify(__PASTE(__PASTE(prefix, _), __LINE__))
+#endif
+
 /* &a[0] degrades to a pointer: a different type from an array */
 #define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))