[lkml]   [2020]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] arm/ftrace: fix building on BE32
Compiling patch.c on BE32 fails because there is no definition
of __opcode_to_mem_thumb32()

arch/arm/kernel/patch.c: In function '__patch_text_real':
arch/arm/kernel/patch.c:94:11: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]

Since we don't actually call it, only a declaration is required
here, add one without a definition that fixes the build here
but will cause a link failure if someone actually relies on the

Fixes: 5a735583b764 ("arm/ftrace: Use __patch_text()")
Signed-off-by: Arnd Bergmann <>
Not sure if this version is any less ugly than the first
approach of adding an #ifdef in patch.c
arch/arm/include/asm/opcodes.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h
index 6bff94b2372b..f75f59c1257a 100644
--- a/arch/arm/include/asm/opcodes.h
+++ b/arch/arm/include/asm/opcodes.h
@@ -110,14 +110,19 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
#define __opcode_to_mem_thumb16(x) ___opcode_identity16(x)
#define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x)
#define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x)
* On BE32 systems, using 32-bit accesses to store Thumb instructions will not
* work in all cases, due to alignment constraints. For now, a correct
- * version is not provided for BE32.
+ * version is not provided for BE32, only an extern declaration to allow
+ * compiling patch.c
#define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x)
#define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x)
+#ifndef __ASSEMBLY__
+extern unsigned __opcode_to_mem_thumb32(unsigned);

#endif /* ! CONFIG_CPU_ENDIAN_BE8 */
 \ /
  Last update: 2020-01-08 15:38    [W:0.033 / U:1.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site