Re: [PATCH v7 0/5] LoongArch: Support toolchain with new relocation types

From: Xi Ruoyao
Date: Wed Aug 31 2022 - 02:10:19 EST


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.

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