[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3c10b123c7ec27fbd942dd9a07d877743616c935.1699025537.git.tanyuan@tinylab.org>
Date: Fri, 3 Nov 2023 23:58:59 +0800
From: Yuan Tan <tanyuan@...ylab.org>
To: falcon@...ylab.org, arnd@...db.de, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linux-riscv@...ts.infradead.org,
luc.vanoostenryck@...il.com, linux-sparse@...r.kernel.org
Cc: linux@...ssschuh.net, palmer@...osinc.com,
paul.walmsley@...ive.com, paulburton@...nel.org,
paulmck@...nel.org, tim.bird@...y.com, tsbogend@...ha.franken.de,
w@....eu, tanyuan@...ylab.org, i@...kray.me
Subject: [PATCH v1 03/14] compiler: add unique __SECTION_NAME()
From: Zhangjin Wu <falcon@...ylab.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@...ylab.org>
Signed-off-by: Yuan Tan <tanyuan@...ylab.org>
---
include/linux/compiler.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
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]))
--
2.34.1
Powered by blists - more mailing lists