[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220622154920.95075-15-chenzhongjin@huawei.com>
Date: Wed, 22 Jun 2022 23:49:01 +0800
From: Chen Zhongjin <chenzhongjin@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-arch@...r.kernel.org>,
<linuxppc-dev@...ts.ozlabs.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kbuild@...r.kernel.org>, <live-patching@...r.kernel.org>
CC: <jpoimboe@...nel.org>, <peterz@...radead.org>,
<catalin.marinas@....com>, <will@...nel.org>,
<masahiroy@...nel.org>, <michal.lkml@...kovi.net>,
<ndesaulniers@...gle.com>, <mark.rutland@....com>,
<pasha.tatashin@...een.com>, <broonie@...nel.org>,
<chenzhongjin@...wei.com>, <rmk+kernel@...linux.org.uk>,
<madvenka@...ux.microsoft.com>, <christophe.leroy@...roup.eu>
Subject: [PATCH v5 14/33] objtool: arm64: Add annotate_reachable() for objtools
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@...wei.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
Powered by blists - more mailing lists