All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuan Tan <tanyuan@tinylab.org>
To: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org,
	luc.vanoostenryck@gmail.com, linux-sparse@vger.kernel.org
Cc: linux@weissschuh.net, palmer@rivosinc.com,
	paul.walmsley@sifive.com, paulburton@kernel.org,
	paulmck@kernel.org, tim.bird@sony.com, tsbogend@alpha.franken.de,
	w@1wt.eu, tanyuan@tinylab.org, i@maskray.me
Subject: [PATCH v1 02/14] compiler: add a global __QUITE_UNIQUE_ID()
Date: Fri,  3 Nov 2023 23:58:49 +0800	[thread overview]
Message-ID: <152d812cb6fa2c6018794ea7f05f487631542d6e.1699025537.git.tanyuan@tinylab.org> (raw)
In-Reply-To: <cover.1699025537.git.tanyuan@tinylab.org>

From: Zhangjin Wu <falcon@tinylab.org>

Differs from __UNIQUE_ID(), __QUITE_UNIQUE_ID() also appends the
__COUNTER__ info to make it more unique.

Besides, seems assembly code also require such a unique id, let's make
it global, the same to the required __PASTE macro.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
I am not sure whether it is proper to put the __QUITE_UNIQUE_ID and
other stuff later in compiler.h. Welcome discussion as this is just
a preliminary approach.

 include/linux/compiler.h       | 5 +++++
 include/linux/compiler_types.h | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d7779a18b24f..405b19cf6cf3 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -227,6 +227,11 @@ static inline void *offset_to_ptr(const int *off)
 
 #endif /* __ASSEMBLY__ */
 
+/* Quite-unique ID. */
+#ifndef __QUITE_UNIQUE_ID
+# define __QUITE_UNIQUE_ID(prefix) __PASTE(__PASTE(prefix, __LINE__), __COUNTER__)
+#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]))
 
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index c523c6683789..0b79e19d1017 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -70,10 +70,6 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
 # define __builtin_warning(x, y...) (1)
 #endif /* __CHECKER__ */
 
-/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
-#define ___PASTE(a,b) a##b
-#define __PASTE(a,b) ___PASTE(a,b)
-
 #ifdef __KERNEL__
 
 /* Attributes */
@@ -308,6 +304,10 @@ struct ftrace_likely_data {
 
 #endif /* __ASSEMBLY__ */
 
+/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
+#define ___PASTE(a, b) a##b
+#define __PASTE(a, b) ___PASTE(a, b)
+
 /*
  * The below symbols may be defined for one or more, but not ALL, of the above
  * compilers. We don't consider that to be an error, so set them to nothing.
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Yuan Tan <tanyuan@tinylab.org>
To: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org,
	luc.vanoostenryck@gmail.com, linux-sparse@vger.kernel.org
Cc: linux@weissschuh.net, palmer@rivosinc.com,
	paul.walmsley@sifive.com, paulburton@kernel.org,
	paulmck@kernel.org, tim.bird@sony.com, tsbogend@alpha.franken.de,
	w@1wt.eu, tanyuan@tinylab.org, i@maskray.me
Subject: [PATCH v1 02/14] compiler: add a global __QUITE_UNIQUE_ID()
Date: Fri,  3 Nov 2023 23:58:49 +0800	[thread overview]
Message-ID: <152d812cb6fa2c6018794ea7f05f487631542d6e.1699025537.git.tanyuan@tinylab.org> (raw)
In-Reply-To: <cover.1699025537.git.tanyuan@tinylab.org>

From: Zhangjin Wu <falcon@tinylab.org>

Differs from __UNIQUE_ID(), __QUITE_UNIQUE_ID() also appends the
__COUNTER__ info to make it more unique.

Besides, seems assembly code also require such a unique id, let's make
it global, the same to the required __PASTE macro.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
I am not sure whether it is proper to put the __QUITE_UNIQUE_ID and
other stuff later in compiler.h. Welcome discussion as this is just
a preliminary approach.

 include/linux/compiler.h       | 5 +++++
 include/linux/compiler_types.h | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d7779a18b24f..405b19cf6cf3 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -227,6 +227,11 @@ static inline void *offset_to_ptr(const int *off)
 
 #endif /* __ASSEMBLY__ */
 
+/* Quite-unique ID. */
+#ifndef __QUITE_UNIQUE_ID
+# define __QUITE_UNIQUE_ID(prefix) __PASTE(__PASTE(prefix, __LINE__), __COUNTER__)
+#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]))
 
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index c523c6683789..0b79e19d1017 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -70,10 +70,6 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
 # define __builtin_warning(x, y...) (1)
 #endif /* __CHECKER__ */
 
-/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
-#define ___PASTE(a,b) a##b
-#define __PASTE(a,b) ___PASTE(a,b)
-
 #ifdef __KERNEL__
 
 /* Attributes */
@@ -308,6 +304,10 @@ struct ftrace_likely_data {
 
 #endif /* __ASSEMBLY__ */
 
+/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
+#define ___PASTE(a, b) a##b
+#define __PASTE(a, b) ___PASTE(a, b)
+
 /*
  * The below symbols may be defined for one or more, but not ALL, of the above
  * compilers. We don't consider that to be an error, so set them to nothing.
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2023-11-03 15:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 15:56 [PATCH v1 00/14] DCE/DSE: Add Dead Syscalls Elimination support, part2 Yuan Tan
2023-11-03 15:56 ` Yuan Tan
2023-11-03 15:58 ` [PATCH v1 01/14] DCE/DSE: allow keep unique bounded sections Yuan Tan
2023-11-03 15:58   ` Yuan Tan
2023-11-03 15:58 ` Yuan Tan [this message]
2023-11-03 15:58   ` [PATCH v1 02/14] compiler: add a global __QUITE_UNIQUE_ID() Yuan Tan
2023-11-03 15:58 ` [PATCH v1 03/14] compiler: add unique __SECTION_NAME() Yuan Tan
2023-11-03 15:58   ` Yuan Tan
2023-11-03 15:59 ` [PATCH v1 04/14] compiler: add unique LABEL_NAME() Yuan Tan
2023-11-03 15:59   ` Yuan Tan
2023-11-03 15:59 ` [PATCH v1 05/14] DCE/DSE: add HAVE_SECTION_SHF_LINK_ORDER_SUPPORT option Yuan Tan
2023-11-03 15:59   ` Yuan Tan
2023-11-03 16:00 ` [PATCH v1 06/14] DCE/DSE: add HAVE_SECTION_SHF_GROUP_SUPPORT option Yuan Tan
2023-11-03 16:00   ` Yuan Tan
2023-11-03 16:00 ` [PATCH v1 07/14] DCE/DSE: add HAVE_SECTION_NO_KEEP_SUPPORT option Yuan Tan
2023-11-03 16:00   ` Yuan Tan
2023-11-03 16:00   ` Yuan Tan
2023-11-03 16:00   ` Yuan Tan
2023-11-03 16:01 ` [PATCH v1 08/14] DCE/DSE: add choice of methods to build reference for orphan sections Yuan Tan
2023-11-03 16:01   ` Yuan Tan
2023-11-05 21:35   ` Fangrui Song
2023-11-03 16:01 ` [PATCH v1 09/14] DCE/DSE: inhibit .size directive for SHF_GROUP Yuan Tan
2023-11-03 16:01   ` Yuan Tan
2023-11-05 20:50   ` Fangrui Song
2023-11-05 20:50   ` Fangrui Song
2023-11-13  7:19     ` Yuan Tan
2023-11-13  7:19       ` Yuan Tan
2023-11-03 16:02 ` [PATCH v1 10/14] DCE/DSE: riscv: make every ex_table's name unique Yuan Tan
2023-11-03 16:02   ` Yuan Tan
2023-11-03 16:02   ` Yuan Tan
2023-11-03 16:02   ` Yuan Tan
2023-11-05 21:13   ` Fangrui Song
2023-11-05 21:13   ` Fangrui Song
2023-11-03 16:02 ` [PATCH v1 11/14] DCE/DSE: riscv: build reference for .pushsection in C functions Yuan Tan
2023-11-03 16:02   ` Yuan Tan
2023-11-03 16:03 ` [PATCH v1 12/14] DCE/DSE: riscv: build reference for .pushsection in assembly Yuan Tan
2023-11-03 16:03   ` Yuan Tan
2023-11-03 16:04 ` [PATCH v1 13/14] DCE/DSE: add SECTION_NO_KEEP_SUPPORT option Yuan Tan
2023-11-03 16:04   ` Yuan Tan
2023-11-03 16:04 ` [PATCH v1 14/14] DCE/DSE: vmlinux.lds.h: allow NO_KEEP on __ex_table sections Yuan Tan
2023-11-03 16:04   ` Yuan Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152d812cb6fa2c6018794ea7f05f487631542d6e.1699025537.git.tanyuan@tinylab.org \
    --to=tanyuan@tinylab.org \
    --cc=arnd@arndb.de \
    --cc=falcon@tinylab.org \
    --cc=i@maskray.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=palmer@rivosinc.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paulburton@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=tim.bird@sony.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.