Skip to content

Commit ae3d697

Browse files
arndbRussell King (Oracle)
authored andcommitted
ARM: 9145/1: patch: fix BE32 compilation
On BE32 kernels, the __opcode_to_mem_thumb32() interface is intentionally not defined, but it is referenced whenever runtime patching is enabled for the kernel, which may be for ftrace, jump label, kprobes or kgdb: arch/arm/kernel/patch.c: In function '__patch_text_real': arch/arm/kernel/patch.c:94:32: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration] 94 | insn = __opcode_to_mem_thumb32(insn); | ^~~~~~~~~~~~~~~~~~~~~~~ Since BE32 kernels never run Thumb2 code, we never end up using the result of this call, so providing an extern declaration without a definition makes it build correctly. Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent ecb108e commit ae3d697

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/arm/include/asm/opcodes.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,17 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
110110
#define __opcode_to_mem_thumb16(x) ___opcode_identity16(x)
111111
#define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x)
112112
#define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x)
113-
#ifndef CONFIG_CPU_ENDIAN_BE32
113+
#ifdef CONFIG_CPU_ENDIAN_BE32
114+
#ifndef __ASSEMBLY__
114115
/*
115116
* On BE32 systems, using 32-bit accesses to store Thumb instructions will not
116117
* work in all cases, due to alignment constraints. For now, a correct
117-
* version is not provided for BE32.
118+
* version is not provided for BE32, but the prototype needs to be there
119+
* to compile patch.c.
118120
*/
121+
extern __u32 __opcode_to_mem_thumb32(__u32);
122+
#endif
123+
#else
119124
#define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x)
120125
#define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x)
121126
#endif

0 commit comments

Comments
 (0)