Re: [PATCH v1 0/6] Add objtool and orc support for LoongArch

From: Tiezhu Yang
Date: Wed Aug 09 2023 - 05:55:40 EST




On 07/25/2023 08:01 PM, Peter Zijlstra wrote:
On Tue, Jul 25, 2023 at 04:15:04PM +0800, Tiezhu Yang wrote:

To be honest, there still exist some objtool warnings, I will try my best
to fix them in the later versions or the other separate patches.

Please give us some examples of what's still going wrong. Are you
running into jump-tables? IIRC I've not seen code for those yet.


Sorry for the late reply, I did more analysis and test recently.
I have already addressed most of the objtool warnings, discussed
offline with compiler engineers, sent separate patch to maillist
or modified the related code locally.

For example,
arch/loongarch/mm/fault.o: warning: objtool: no_context.part.0() falls through to next function do_sigsegv()
[PATCH] LoongArch: Remove noreturn attribute for die()
https://lore.kernel.org/loongarch/1690871581-23944-1-git-send-email-yangtiezhu@xxxxxxxxxxx/

Additionally, when I update the latest upstream gcc and binutils,
it generates more objtool warnings, like this:
init/version.o: warning: objtool: early_hostname+0x20: sibling call from callable instruction with modified stack frame

[fedora@linux 6.5.test]$ gcc --version
gcc (GCC) 14.0.0 20230803 (experimental)
[fedora@linux 6.5.test]$ as --version
GNU assembler (GNU Binutils) 2.41.50.20230803
[fedora@linux 6.5.test]$ objdump -M no-aliases -D init/version.o
0000000000000000 <early_hostname>:
0: 00150085 or $a1, $a0, $zero
4: 1a000004 pcalau12i $a0, 0
8: 02ffc063 addi.d $sp, $sp, -16
c: 02810406 addi.w $a2, $zero, 65
10: 02c00084 addi.d $a0, $a0, 0
14: 29c02061 st.d $ra, $sp, 8
18: 54000000 bl 0 # 18 <early_hostname+0x18>
1c: 0281000c addi.w $t0, $zero, 64
20: 6c001584 bgeu $t0, $a0, 20 # 34 <.L2>
24: 1a000004 pcalau12i $a0, 0
28: 02810005 addi.w $a1, $zero, 64
2c: 02c00084 addi.d $a0, $a0, 0
30: 54000000 bl 0 # 30 <early_hostname+0x30>

0000000000000034 <.L2>:
34: 28c02061 ld.d $ra, $sp, 8
38: 00150004 or $a0, $zero, $zero
3c: 02c04063 addi.d $sp, $sp, 16
40: 4c000020 jirl $zero, $ra, 0

A preliminary analysis shows that the common functions is_sibling_call()
and add_jump_destinations() in tools/objtool/check.c need to be modified
to handle the case "reloc->sym->type == STT_NOTYPE", I will send a patch
in the next week.

Thanks,
Tiezhu