[BUG Report] undefined reference to `convert_to_fxsr'
From: Miaohe Lin
Date: Wed Dec 28 2022 - 07:31:48 EST
Hi all:
When I compile the mainline kernel v6.2-rc1, the below link error occurs:
ld: arch/x86/kernel/fpu/signal.o: in function `__fpu_restore_sig':
/home/linmiaohe/linux-next/arch/x86/kernel/fpu/signal.c:421: undefined reference to `convert_to_fxsr'
make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
make: *** [Makefile:1252: vmlinux] Error 2
make: *** Waiting for unfinished jobs....
I think it's because convert_to_fxsr() is only defined when CONFIG_X86_32 or CONFIG_IA32_EMULATION is enabled. But it can be
call from __fpu_restore_sig() via below path:
bool fpu__restore_sig(void __user *buf, int ia32_frame):
if (!IS_ENABLED(CONFIG_X86_64) && !cpu_feature_enabled(X86_FEATURE_FPU)) {
success = !fpregs_soft_set(current, NULL, 0,
sizeof(struct user_i387_ia32_struct),
NULL, buf);
} else {
success = __fpu_restore_sig(buf, buf_fx, ia32_fxstate); /* Will call convert_to_fxsr() later. */
}
__fpu_restore_sig() will call convert_to_fxsr() even if neither CONFIG_X86_32 nor CONFIG_IA32_EMULATION is enabled. So the link error occurs.
But I'm not really sure how to fix it. Any reply or fix is appreciated.
Thanks,
Miaohe Lin