Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lkdtm: mark execute_location as noinline

The kernel sometimes fails to link when lkdrm is built-in and
compiled with clang:

relocation truncated to fit: R_ARM_THM_CALL against `.bss'

The reason here is that a relocation from .text to .bss fails to
generate a trampoline because .bss is not an executable section.

Marking the function 'noinline' turns the relative branch to .bss
into an absolute branch to the function argument, and that works
fine.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Arnd Bergmann and committed by
Greg Kroah-Hartman
ececdc02 c074abe0

+1 -1
+1 -1
drivers/misc/lkdtm.c
··· 335 335 memset((void *)data, 0, 64); 336 336 } 337 337 338 - static void execute_location(void *dst) 338 + static void noinline execute_location(void *dst) 339 339 { 340 340 void (*func)(void) = dst; 341 341