Skip to content

Commit dca5da2

Browse files
author
Peter Zijlstra
committed
x86,objtool: Move the ASM_REACHABLE annotation to objtool.h
Because we need a variant for .S files too. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/Yi9gOW9f1GGwwUD6@hirez.programming.kicks-ass.net
1 parent be00759 commit dca5da2

5 files changed

Lines changed: 34 additions & 7 deletions

File tree

arch/x86/include/asm/bug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <linux/stringify.h>
66
#include <linux/instrumentation.h>
7+
#include <linux/objtool.h>
78

89
/*
910
* Despite that some emulators terminate on UD2, we use it for WARN().

arch/x86/include/asm/irq_stack.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _ASM_X86_IRQ_STACK_H
44

55
#include <linux/ptrace.h>
6+
#include <linux/objtool.h>
67

78
#include <asm/processor.h>
89

include/linux/compiler.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
125125
})
126126
#define annotate_unreachable() __annotate_unreachable(__COUNTER__)
127127

128-
#define ASM_REACHABLE \
129-
"998:\n\t" \
130-
".pushsection .discard.reachable\n\t" \
131-
".long 998b - .\n\t" \
132-
".popsection\n\t"
133-
134128
/* Annotate a C jump table to allow objtool to follow the code flow */
135129
#define __annotate_jump_table __section(".rodata..c_jump_table")
136130

137131
#else
138132
#define annotate_unreachable()
139-
# define ASM_REACHABLE
140133
#define __annotate_jump_table
141134
#endif
142135

include/linux/objtool.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ struct unwind_hint {
8383
_ASM_PTR " 986b\n\t" \
8484
".popsection\n\t"
8585

86+
#define ASM_REACHABLE \
87+
"998:\n\t" \
88+
".pushsection .discard.reachable\n\t" \
89+
".long 998b - .\n\t" \
90+
".popsection\n\t"
91+
8692
#else /* __ASSEMBLY__ */
8793

8894
/*
@@ -142,6 +148,13 @@ struct unwind_hint {
142148
.popsection
143149
.endm
144150

151+
.macro REACHABLE
152+
.Lhere_\@:
153+
.pushsection .discard.reachable
154+
.long .Lhere_\@ - .
155+
.popsection
156+
.endm
157+
145158
#endif /* __ASSEMBLY__ */
146159

147160
#else /* !CONFIG_STACK_VALIDATION */
@@ -153,6 +166,7 @@ struct unwind_hint {
153166
#define STACK_FRAME_NON_STANDARD(func)
154167
#define STACK_FRAME_NON_STANDARD_FP(func)
155168
#define ANNOTATE_NOENDBR
169+
#define ASM_REACHABLE
156170
#else
157171
#define ANNOTATE_INTRA_FUNCTION_CALL
158172
.macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0
@@ -161,6 +175,8 @@ struct unwind_hint {
161175
.endm
162176
.macro ANNOTATE_NOENDBR
163177
.endm
178+
.macro REACHABLE
179+
.endm
164180
#endif
165181

166182
#endif /* CONFIG_STACK_VALIDATION */

tools/include/linux/objtool.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ struct unwind_hint {
8383
_ASM_PTR " 986b\n\t" \
8484
".popsection\n\t"
8585

86+
#define ASM_REACHABLE \
87+
"998:\n\t" \
88+
".pushsection .discard.reachable\n\t" \
89+
".long 998b - .\n\t" \
90+
".popsection\n\t"
91+
8692
#else /* __ASSEMBLY__ */
8793

8894
/*
@@ -142,6 +148,13 @@ struct unwind_hint {
142148
.popsection
143149
.endm
144150

151+
.macro REACHABLE
152+
.Lhere_\@:
153+
.pushsection .discard.reachable
154+
.long .Lhere_\@ - .
155+
.popsection
156+
.endm
157+
145158
#endif /* __ASSEMBLY__ */
146159

147160
#else /* !CONFIG_STACK_VALIDATION */
@@ -153,6 +166,7 @@ struct unwind_hint {
153166
#define STACK_FRAME_NON_STANDARD(func)
154167
#define STACK_FRAME_NON_STANDARD_FP(func)
155168
#define ANNOTATE_NOENDBR
169+
#define ASM_REACHABLE
156170
#else
157171
#define ANNOTATE_INTRA_FUNCTION_CALL
158172
.macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0
@@ -161,6 +175,8 @@ struct unwind_hint {
161175
.endm
162176
.macro ANNOTATE_NOENDBR
163177
.endm
178+
.macro REACHABLE
179+
.endm
164180
#endif
165181

166182
#endif /* CONFIG_STACK_VALIDATION */

0 commit comments

Comments
 (0)