When switching from CONFIG_GENKSYMS to CONFIG_GENDWARFKSYMS enabled, the
build is failed:
AS arch/x86/entry/entry.o
In file included from ./arch/x86/include/asm/asm-prototypes.h:2,
from <stdin>:3:
./arch/x86/include/asm/ftrace.h: In function ‘arch_ftrace_get_symaddr’:
./arch/x86/include/asm/ftrace.h:46:21: error: implicit declaration of function
‘get_kernel_nofault’ [-Werror=implicit-function-declaration]
46 | if (get_kernel_nofault(instr, (u32 *)(fentry_ip -
ENDBR_INSN_SIZE)))
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
File "asm-prototypes.h" is added to entry.S by 'scripts/Makefile.build',
adding the missed declaration header file can also fix the error:
getasmexports = \
{ echo "\#include <linux/kernel.h>" ; \
echo "\#include <linux/string.h>" ; \
+ echo "\#include <linux/uaccess.h>"; \
echo "\#include <asm/asm-prototypes.h>" ; \
$(call getexportsymbols,EXPORT_SYMBOL(\1);) ; }
Fixes: 2bc56fdae1ba ("ftrace: Add ftrace_get_symaddr to convert fentry_ip to
symaddr")
Signed-off-by: Haiyue Wang <[email protected]>
---
arch/x86/include/asm/ftrace.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index f9cb4d07df58..063ce70837bb 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -34,6 +34,10 @@ static inline unsigned long ftrace_call_adjust(unsigned long
addr)
return addr;
}
+#ifdef CONFIG_X86_KERNEL_IBT
+#include <linux/uaccess.h>
+#endif
+
static inline unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
{
#ifdef CONFIG_X86_KERNEL_IBT
--
2.48.1