Because we need a variant for .S files too.
Unified · Split
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | #include <linux/stringify.h> | 5 | #include <linux/stringify.h> |
| 6 | #include <linux/instrumentation.h> | 6 | #include <linux/instrumentation.h> |
| 7 | #include <linux/objtool.h> | ||
| 7 | 8 | ||
| 8 | /* | 9 | /* |
| 9 | * Despite that some emulators terminate on UD2, we use it for WARN(). | 10 | * Despite that some emulators terminate on UD2, we use it for WARN(). |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | #define _ASM_X86_IRQ_STACK_H | 3 | #define _ASM_X86_IRQ_STACK_H |
| 4 | 4 | ||
| 5 | #include <linux/ptrace.h> | 5 | #include <linux/ptrace.h> |
| 6 | #include <linux/objtool.h> | ||
| 6 | 7 | ||
| 7 | #include <asm/processor.h> | 8 | #include <asm/processor.h> |
| 8 | 9 | ||
| @@ -125,18 +125,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 124 unmodified lines | |||
| 125 | }) | 125 | }) |
| 126 | #define annotate_unreachable() __annotate_unreachable(__COUNTER__) | 126 | #define annotate_unreachable() __annotate_unreachable(__COUNTER__) |
| 127 | 127 | ||
| 128 | #define ASM_REACHABLE \ | ||
| 129 | "998:\n\t" \ | ||
| 130 | ".pushsection .discard.reachable\n\t" \ | ||
| 131 | ".long 998b - .\n\t" \ | ||
| 132 | ".popsection\n\t" | ||
| 133 | |||
| 134 | /* Annotate a C jump table to allow objtool to follow the code flow */ | 128 | /* Annotate a C jump table to allow objtool to follow the code flow */ |
| 135 | #define __annotate_jump_table __section(".rodata..c_jump_table") | 129 | #define __annotate_jump_table __section(".rodata..c_jump_table") |
| 136 | 130 | ||
| 137 | #else | 131 | #else |
| 138 | #define annotate_unreachable() | 132 | #define annotate_unreachable() |
| 139 | # define ASM_REACHABLE | ||
| 140 | #define __annotate_jump_table | 133 | #define __annotate_jump_table |
| 141 | #endif | 134 | #endif |
| 142 | 135 | ||
| @@ -83,6 +83,12 @@ struct unwind_hint { · 82 unmodified lines | |||
| 83 | _ASM_PTR " 986b\n\t" \ | 83 | _ASM_PTR " 986b\n\t" \ |
| 84 | ".popsection\n\t" | 84 | ".popsection\n\t" |
| 85 | 85 | ||
| 86 | #define ASM_REACHABLE \ | ||
| 87 | "998:\n\t" \ | ||
| 88 | ".pushsection .discard.reachable\n\t" \ | ||
| 89 | ".long 998b - .\n\t" \ | ||
| 90 | ".popsection\n\t" | ||
| 91 | |||
| 86 | #else /* __ASSEMBLY__ */ | 92 | #else /* __ASSEMBLY__ */ |
| 87 | 93 | ||
| 88 | /* | 94 | /* |
| @@ -142,6 +148,13 @@ struct unwind_hint { · 53 unmodified lines | |||
| 142 | .popsection | 148 | .popsection |
| 143 | .endm | 149 | .endm |
| 144 | 150 | ||
| 151 | .macro REACHABLE | ||
| 152 | .Lhere_\@: | ||
| 153 | .pushsection .discard.reachable | ||
| 154 | .long .Lhere_\@ - . | ||
| 155 | .popsection | ||
| 156 | .endm | ||
| 157 | |||
| 145 | #endif /* __ASSEMBLY__ */ | 158 | #endif /* __ASSEMBLY__ */ |
| 146 | 159 | ||
| 147 | #else /* !CONFIG_STACK_VALIDATION */ | 160 | #else /* !CONFIG_STACK_VALIDATION */ |
| @@ -153,6 +166,7 @@ struct unwind_hint { · 5 unmodified lines | |||
| 153 | #define STACK_FRAME_NON_STANDARD(func) | 166 | #define STACK_FRAME_NON_STANDARD(func) |
| 154 | #define STACK_FRAME_NON_STANDARD_FP(func) | 167 | #define STACK_FRAME_NON_STANDARD_FP(func) |
| 155 | #define ANNOTATE_NOENDBR | 168 | #define ANNOTATE_NOENDBR |
| 169 | #define ASM_REACHABLE | ||
| 156 | #else | 170 | #else |
| 157 | #define ANNOTATE_INTRA_FUNCTION_CALL | 171 | #define ANNOTATE_INTRA_FUNCTION_CALL |
| 158 | .macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0 | 172 | .macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0 |
| @@ -161,6 +175,8 @@ struct unwind_hint { · 2 unmodified lines | |||
| 161 | .endm | 175 | .endm |
| 162 | .macro ANNOTATE_NOENDBR | 176 | .macro ANNOTATE_NOENDBR |
| 163 | .endm | 177 | .endm |
| 178 | .macro REACHABLE | ||
| 179 | .endm | ||
| 164 | #endif | 180 | #endif |
| 165 | 181 | ||
| 166 | #endif /* CONFIG_STACK_VALIDATION */ | 182 | #endif /* CONFIG_STACK_VALIDATION */ |
| @@ -83,6 +83,12 @@ struct unwind_hint { · 82 unmodified lines | |||
| 83 | _ASM_PTR " 986b\n\t" \ | 83 | _ASM_PTR " 986b\n\t" \ |
| 84 | ".popsection\n\t" | 84 | ".popsection\n\t" |
| 85 | 85 | ||
| 86 | #define ASM_REACHABLE \ | ||
| 87 | "998:\n\t" \ | ||
| 88 | ".pushsection .discard.reachable\n\t" \ | ||
| 89 | ".long 998b - .\n\t" \ | ||
| 90 | ".popsection\n\t" | ||
| 91 | |||
| 86 | #else /* __ASSEMBLY__ */ | 92 | #else /* __ASSEMBLY__ */ |
| 87 | 93 | ||
| 88 | /* | 94 | /* |
| @@ -142,6 +148,13 @@ struct unwind_hint { · 53 unmodified lines | |||
| 142 | .popsection | 148 | .popsection |
| 143 | .endm | 149 | .endm |
| 144 | 150 | ||
| 151 | .macro REACHABLE | ||
| 152 | .Lhere_\@: | ||
| 153 | .pushsection .discard.reachable | ||
| 154 | .long .Lhere_\@ - . | ||
| 155 | .popsection | ||
| 156 | .endm | ||
| 157 | |||
| 145 | #endif /* __ASSEMBLY__ */ | 158 | #endif /* __ASSEMBLY__ */ |
| 146 | 159 | ||
| 147 | #else /* !CONFIG_STACK_VALIDATION */ | 160 | #else /* !CONFIG_STACK_VALIDATION */ |
| @@ -153,6 +166,7 @@ struct unwind_hint { · 5 unmodified lines | |||
| 153 | #define STACK_FRAME_NON_STANDARD(func) | 166 | #define STACK_FRAME_NON_STANDARD(func) |
| 154 | #define STACK_FRAME_NON_STANDARD_FP(func) | 167 | #define STACK_FRAME_NON_STANDARD_FP(func) |
| 155 | #define ANNOTATE_NOENDBR | 168 | #define ANNOTATE_NOENDBR |
| 169 | #define ASM_REACHABLE | ||
| 156 | #else | 170 | #else |
| 157 | #define ANNOTATE_INTRA_FUNCTION_CALL | 171 | #define ANNOTATE_INTRA_FUNCTION_CALL |
| 158 | .macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0 | 172 | .macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0 |
| @@ -161,6 +175,8 @@ struct unwind_hint { · 2 unmodified lines | |||
| 161 | .endm | 175 | .endm |
| 162 | .macro ANNOTATE_NOENDBR | 176 | .macro ANNOTATE_NOENDBR |
| 163 | .endm | 177 | .endm |
| 178 | .macro REACHABLE | ||
| 179 | .endm | ||
| 164 | #endif | 180 | #endif |
| 165 | 181 | ||
| 166 | #endif /* CONFIG_STACK_VALIDATION */ | 182 | #endif /* CONFIG_STACK_VALIDATION */ |