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

From: Jinyang He
Date: Tue Aug 29 2023 - 04:34:18 EST


On 2023-08-29 14:28, 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,
so use SYM_CODE_START_LOCAL and SYM_CODE_END to define the symbol fault.

Before:

$ readelf -s arch/loongarch/kernel/fpu.o | awk -F: /fault/'{print $2}'
000000000000053c 8 FUNC GLOBAL DEFAULT 1 fault

After:

$ readelf -s arch/loongarch/kernel/fpu.o | awk -F: /fault/'{print $2}'
000000000000053c 8 NOTYPE LOCAL DEFAULT 1 fault

Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
arch/loongarch/kernel/fpu.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

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
SYM_FUNC_END(_restore_lasx_context)
-SYM_FUNC_START(fault)
+SYM_CODE_START_LOCAL(fault)


Hi, Tiezhu,

The include/linux/linkage.h noted,
 * FUNC -- C-like functions (proper stack frame etc.)
 * CODE -- non-C code (e.g. irq handlers with different, special stack etc.)
I think here should be SYM_FUNC_START_LOCAL. Thus, it may create debug
info like sp_offset == 0 && ra == CFI_UNDEFINED, (just some impressions).

BTW, I've noticed some funcs should be marked as SYM_CODE.., e.g.
handle_syscall, handle_tlb_xxx. If you are sure that changes are
necessary, fix them.

Thanks!

Jinyang


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