[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c53303bf-a5d2-098f-8975-efadbe0b2f2e@loongson.cn>
Date: Wed, 31 Aug 2022 14:58:19 +0800
From: Jinyang He <hejinyang@...ngson.cn>
To: Xi Ruoyao <xry111@...111.site>,
Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>
Cc: loongarch@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>,
Youling Tang <tangyouling@...ngson.cn>
Subject: Re: [PATCH v7 0/5] LoongArch: Support toolchain with new relocation
types
On 08/31/2022 02:10 PM, Xi Ruoyao wrote:
> On Wed, 2022-08-31 at 13:44 +0800, Huacai Chen wrote:
>
>> With this series applied and ARCH_WANT_LD_ORPHAN_WARN enabled, we get
>> loongarch64-unknown-linux-gnu-ld: warning: orphan section `.got' from
>> `arch/loongarch/kernel/head.o' being placed in section `.got'
>> loongarch64-unknown-linux-gnu-ld: warning: orphan section `.got.plt'
>> from `arch/loongarch/kernel/head.o' being placed in section `.got.plt'
>>
>> I think we should add this lines in vmlinux.lds.S
>> .got : { *(.got) }
>> .got.plt : { *(.got.plt) }
>>
>> But put them to which patch? Patch 2 or Patch 5?
> In patch 2 IMO. Because in patch 2 we already know "-Wa,-mla-global-
> with-pcrel" does not prevent the generation of GOT with new toolchain.
>
> If you need a v8 please tell me to send it, but I don't know how to
> handle -Woverride-init warnings (IMO the fix for this warning should be
> a standalone patch outside of the series).
>
> P. S. The ld warning message seems a little strange because "head.o"
> does not contain .got or .got.plt sections... I guess there is a linker
> bug causing it outputs the very first input file in the message, instead
> of the first input file really containing an orphaned section.
>
> Another P. S.: the use of GOT is actually unneeded in main kernel image
> but we don't have something equivalent to "-Wa,-mla-global-with-pcrel"
> in the new toolchain. Perhaps we can add this feature to GCC later.
>
That's right. Also I am wondering why new toolchain produce .got* in
kernel. It's unneeded. In the past, gcc create la.global and parsed
to la.pcrel by gas, and kernel works well. Now it seems we lost this
feature in gcc. I checked the x86 asm code just now. And some info
follows,
LoongArch64, ./net/ipv4/udp_diag.s, *have reloc hint*
pcalau12i $r4,%got_pc_hi20(udplite_table)
ld.d $r4,$r4,%got_pc_lo12(udplite_table)
b udp_dump
x86_64, ./net/ipv4/udp_diag.s
movq $udplite_table, %rdi
jmp udp_dump
It seems related to -fno-PIE and -cmodel=kernel on x86_64.
Hope new gcc with this feature now.
Powered by blists - more mailing lists