From: Josh Poimboeuf <jpoimboe@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH 3/4] objtool: Consolidate annotation macros
Date: Tue, 25 Nov 2025 22:06:59 -0800 [thread overview]
Message-ID: <aeb7663140e2a1150acde73f22b65f7f27cd158d.1764137163.git.jpoimboe@kernel.org> (raw)
In-Reply-To: <cover.1764137163.git.jpoimboe@kernel.org>
Consolidate __ASM_ANNOTATE into a single macro which is used by both C
and asm. This also makes the code generation a bit more palatable by
putting it all on a single line.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
include/linux/annotate.h | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/include/linux/annotate.h b/include/linux/annotate.h
index 7c10d34d198c..996126f5f9ec 100644
--- a/include/linux/annotate.h
+++ b/include/linux/annotate.h
@@ -6,41 +6,35 @@
#ifdef CONFIG_OBJTOOL
+#define __ASM_ANNOTATE(section, label, type) \
+ .pushsection section, "M", @progbits, 8; \
+ .long label - .; \
+ .long type; \
+ .popsection
+
#ifndef __ASSEMBLY__
-#define __ASM_ANNOTATE(section, label, type) \
- ".pushsection " section ",\"M\", @progbits, 8\n\t" \
- ".long " __stringify(label) " - .\n\t" \
- ".long " __stringify(type) "\n\t" \
- ".popsection\n\t"
-
#define ASM_ANNOTATE_LABEL(label, type) \
- __ASM_ANNOTATE(".discard.annotate_insn", label, type)
+ __stringify(__ASM_ANNOTATE(".discard.annotate_insn", label, type)) "\n\t"
#define ASM_ANNOTATE(type) \
- "911:\n\t" \
- ASM_ANNOTATE_LABEL(911b, type)
+ "911: " \
+ __stringify(__ASM_ANNOTATE(".discard.annotate_insn", 911b, type)) "\n\t"
#define ASM_ANNOTATE_DATA(type) \
- "912:\n\t" \
- __ASM_ANNOTATE(".discard.annotate_data", 912b, type)
+ "912: " \
+ __stringify(__ASM_ANNOTATE(".discard.annotate_data", 912b, type)) "\n\t"
#else /* __ASSEMBLY__ */
-.macro __ANNOTATE section, type
-.Lhere_\@:
- .pushsection \section, "M", @progbits, 8
- .long .Lhere_\@ - .
- .long \type
- .popsection
-.endm
-
.macro ANNOTATE type
- __ANNOTATE ".discard.annotate_insn", \type
+.Lhere_\@:
+ __ASM_ANNOTATE(".discard.annotate_insn", .Lhere_\@, \type)
.endm
.macro ANNOTATE_DATA type
- __ANNOTATE ".discard.annotate_data", \type
+.Lhere_\@:
+ __ASM_ANNOTATE(".discard.annotate_data", .Lhere_\@, \type)
.endm
#endif /* __ASSEMBLY__ */
--
2.51.1
next prev parent reply other threads:[~2025-11-26 6:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 6:06 [PATCH 0/4] objtool: Improve code generation for " Josh Poimboeuf
2025-11-26 6:06 ` [PATCH 1/4] x86/alternative: Remove ANNOTATE_DATA_SPECIAL usage Josh Poimboeuf
2025-11-26 6:06 ` [PATCH 2/4] x86/asm: " Josh Poimboeuf
2025-11-26 6:06 ` Josh Poimboeuf [this message]
2025-11-26 6:07 ` [PATCH 4/4] objtool: Remove newlines and tabs from annotation macros Josh Poimboeuf
2025-11-26 10:00 ` [PATCH 0/4] objtool: Improve code generation for " Peter Zijlstra
2025-12-03 15:59 ` Ingo Molnar
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=aeb7663140e2a1150acde73f22b65f7f27cd158d.1764137163.git.jpoimboe@kernel.org \
--to=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®