[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <oe4qtqbftyadl2id6dlouh6i37jamvjrccrccvpgks62locdbe@d667vrpnzxzk>
Date: Sun, 7 Dec 2025 06:51:26 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 5/8] objtool: Convert annotations to assembler macros
On Sat, Dec 06, 2025 at 01:41:12PM -0800, Josh Poimboeuf wrote:
> Improve code generation readability by converting the objtool
> annotations into assembler macros which are created when annotate.h is
> included.
>
> Before:
>
> .pushsection .discard.annotate_insn, "M", @progbits, 8; .long 1b - ., 8; .popsection
>
> After:
>
> ANNOTATE_REACHABLE loc=1b
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
This needs the following to build on non-x86:
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 770321c908e5..e63810bfdc68 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -3,14 +3,12 @@
#define _ASM_X86_ASM_H
#ifdef __ASSEMBLER__
-# define __ASM_C(a,b) a
# define __ASM_FORM(x, ...) x,## __VA_ARGS__
# define __ASM_FORM_RAW(x, ...) x,## __VA_ARGS__
# define __ASM_FORM_COMMA(x, ...) x,## __VA_ARGS__,
# define __ASM_REGPFX %
#else
#include <linux/stringify.h>
-# define __ASM_C(a,b) b
# define __ASM_FORM(x, ...) " " __stringify(x,##__VA_ARGS__) " "
# define __ASM_FORM_RAW(x, ...) __stringify(x,##__VA_ARGS__)
# define __ASM_FORM_COMMA(x, ...) " " __stringify(x,##__VA_ARGS__) ","
@@ -115,10 +113,6 @@
#endif
-#define DEFINE_MACRO(name) \
- __ASM_C(DEFINE_ ## name, \
- asm(__stringify(DEFINE_ ## name)))
-
#ifndef __ASSEMBLER__
static __always_inline __pure void *rip_rel_ptr(void *p)
{
diff --git a/include/linux/annotate.h b/include/linux/annotate.h
index a80fef36dc92..a099a1d5e410 100644
--- a/include/linux/annotate.h
+++ b/include/linux/annotate.h
@@ -4,7 +4,7 @@
#include <linux/objtool_types.h>
#include <linux/stringify.h>
-#include <asm/asm.h>
+#include <linux/asm.h>
#define DEFINE___ANNOTATE \
.macro __ANNOTATE sec, type, loc; \
diff --git a/include/linux/asm.h b/include/linux/asm.h
new file mode 100644
index 000000000000..94836aa217b4
--- /dev/null
+++ b/include/linux/asm.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_ASM_H
+#define _LINUX_ASM_H
+
+#ifdef __ASSEMBLER__
+# define __ASM_C(a,b) a
+#else
+# define __ASM_C(a,b) b
+#endif
+
+#define DEFINE_MACRO(name) \
+ __ASM_C(DEFINE_ ## name, \
+ asm(__stringify(DEFINE_ ## name)))
+
+#endif /* _LINUX_ASM_H */
Powered by blists - more mailing lists