diff mbox series

[v1,03/14] compiler: add unique __SECTION_NAME()

Message ID 3c10b123c7ec27fbd942dd9a07d877743616c935.1699025537.git.tanyuan@tinylab.org (mailing list archive)
State Changes Requested, archived
Headers show
Series DCE/DSE: Add Dead Syscalls Elimination support, part2 | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR fail merge-conflict

Commit Message

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

The new section helper is added for LD_DEAD_CODE_DATA_ELIMINATION to
generate unique section name (strigified).

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

Patch

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 405b19cf6cf3..5a9cc3209b12 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -227,11 +227,25 @@  static inline void *offset_to_ptr(const int *off)
 
 #endif /* __ASSEMBLY__ */
 
+/* Import __stringify. */
+#ifndef __stringify
+#include <linux/stringify.h>
+#endif
+
 /* Quite-unique ID. */
 #ifndef __QUITE_UNIQUE_ID
 # define __QUITE_UNIQUE_ID(prefix) __PASTE(__PASTE(prefix, __LINE__), __COUNTER__)
 #endif
 
+/* Quite-unique Section NAME. */
+#ifndef __SECTION_NAME
+#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+# define __SECTION_NAME(prefix) __stringify(__QUITE_UNIQUE_ID(prefix.))
+#else
+# define __SECTION_NAME(prefix) __stringify(prefix)
+#endif
+#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]))