Re: [PATCH] LoongArch: Define the symbol fault as a local label in fpu.S

From: Xi Ruoyao
Date: Tue Aug 29 2023 - 02:47:24 EST


On Tue, 2023-08-29 at 14:28 +0800, Tiezhu Yang wrote:
> The initial aim is to silence the following objtool warnings:
>
>   arch/loongarch/kernel/fpu.o: warning: objtool: _save_fp_context() falls through to next function fault()
>   arch/loongarch/kernel/fpu.o: warning: objtool: _restore_fp_context() falls through to next function fault()
>   arch/loongarch/kernel/fpu.o: warning: objtool: _save_lsx_context() falls through to next function fault()
>   arch/loongarch/kernel/fpu.o: warning: objtool: _restore_lsx_context() falls through to next function fault()
>   arch/loongarch/kernel/fpu.o: warning: objtool: _save_lasx_context() falls through to next function fault()
>   arch/loongarch/kernel/fpu.o: warning: objtool: _restore_lasx_context() falls through to next function fault()
>
> Obviously, the symbol fault is not a function, it is just a local label,

Hmm why? To me this seems a function. We don't branch to it but store
its address (a "function pointer") in the extable.

And these warnings do not make any sense to me:

/* snip */

> diff --git a/arch/loongarch/kernel/fpu.S b/arch/loongarch/kernel/fpu.S
> index b4032de..7defe50 100644
> --- a/arch/loongarch/kernel/fpu.S
> +++ b/arch/loongarch/kernel/fpu.S
> @@ -521,7 +521,7 @@ SYM_FUNC_START(_restore_lasx_context)
>         jr      ra

_restore_lasx_context returns with this instruction. How can it fall
through into fault?

>  SYM_FUNC_END(_restore_lasx_context)

> -SYM_FUNC_START(fault)
> +SYM_CODE_START_LOCAL(fault)
>         li.w    a0, -EFAULT                             # failure
>         jr      ra
> -SYM_FUNC_END(fault)
> +SYM_CODE_END(fault)

--
Xi Ruoyao <xry111@xxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University