Skip to content

Commit 305c8dc

Browse files
jpoimboeingomolnar
authored andcommitted
objtool: Consolidate annotation macros
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. Turn this: 911: .pushsection .discard.annotate_insn,"M", @progbits, 8 .long 911b - . .long 1 .popsection jmp __x86_return_thunk Into: 911: .pushsection ".discard.annotate_insn", "M", @progbits, 8; .long 911b - .; .long 1; .popsection jmp __x86_return_thunk Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://patch.msgid.link/c05ff40d3383e85c3b59018ef0b3c7aaf993a60d.1764694625.git.jpoimboe@kernel.org
1 parent f387d0e commit 305c8dc

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

include/linux/annotate.h

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,35 @@
66

77
#ifdef CONFIG_OBJTOOL
88

9-
#ifndef __ASSEMBLY__
10-
119
#define __ASM_ANNOTATE(section, label, type) \
12-
".pushsection " section ",\"M\", @progbits, 8\n\t" \
13-
".long " __stringify(label) " - .\n\t" \
14-
".long " __stringify(type) "\n\t" \
15-
".popsection\n\t"
10+
.pushsection section, "M", @progbits, 8; \
11+
.long label - .; \
12+
.long type; \
13+
.popsection
14+
15+
#ifndef __ASSEMBLY__
1616

1717
#define ASM_ANNOTATE_LABEL(label, type) \
18-
__ASM_ANNOTATE(".discard.annotate_insn", label, type)
18+
__stringify(__ASM_ANNOTATE(".discard.annotate_insn", label, type)) "\n\t"
1919

2020
#define ASM_ANNOTATE(type) \
21-
"911:\n\t" \
22-
ASM_ANNOTATE_LABEL(911b, type)
21+
"911: " \
22+
__stringify(__ASM_ANNOTATE(".discard.annotate_insn", 911b, type)) "\n\t"
2323

2424
#define ASM_ANNOTATE_DATA(type) \
25-
"912:\n\t" \
26-
__ASM_ANNOTATE(".discard.annotate_data", 912b, type)
25+
"912: " \
26+
__stringify(__ASM_ANNOTATE(".discard.annotate_data", 912b, type)) "\n\t"
2727

2828
#else /* __ASSEMBLY__ */
2929

30-
.macro __ANNOTATE section, type
31-
.Lhere_\@:
32-
.pushsection \section, "M", @progbits, 8
33-
.long .Lhere_\@ - .
34-
.long \type
35-
.popsection
36-
.endm
37-
3830
.macro ANNOTATE type
39-
__ANNOTATE ".discard.annotate_insn", \type
31+
.Lhere_\@:
32+
__ASM_ANNOTATE(".discard.annotate_insn", .Lhere_\@, \type)
4033
.endm
4134

4235
.macro ANNOTATE_DATA type
43-
__ANNOTATE ".discard.annotate_data", \type
36+
.Lhere_\@:
37+
__ASM_ANNOTATE(".discard.annotate_data", .Lhere_\@, \type)
4438
.endm
4539

4640
#endif /* __ASSEMBLY__ */

0 commit comments

Comments
 (0)