[PATCH v5 14/33] objtool: arm64: Add annotate_reachable() for objtools
Chen Zhongjin
chenzhongjin at huawei.com
Wed Jun 22 08:49:01 PDT 2022
x86 removed annotate_reachable and replaced it with ASM_REACHABLE
which is not suitable for arm64 micro because there are some cases
GCC will merge duplicate inline asm.
Re-add annotation_reachable() for arm64.
Signed-off-by: Chen Zhongjin <chenzhongjin at huawei.com>
---
include/linux/compiler.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 01ce94b58b42..c8bce9421fa7 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -117,6 +117,14 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
*/
#define __stringify_label(n) #n
+#define __annotate_reachable(c) ({ \
+ asm volatile(__stringify_label(c) ":\n\t" \
+ ".pushsection .discard.reachable\n\t" \
+ ".long " __stringify_label(c) "b - .\n\t" \
+ ".popsection\n\t"); \
+})
+#define annotate_reachable() __annotate_reachable(__COUNTER__)
+
#define __annotate_unreachable(c) ({ \
asm volatile(__stringify_label(c) ":\n\t" \
".pushsection .discard.unreachable\n\t" \
@@ -129,6 +137,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#define __annotate_jump_table __section(".rodata..c_jump_table")
#else /* !CONFIG_OBJTOOL */
+#define annotate_reachable()
#define annotate_unreachable()
#define __annotate_jump_table
#endif /* CONFIG_OBJTOOL */
--
2.17.1
More information about the linux-arm-kernel
mailing list