[PATCH] LoongArch: Make align symbol be in same section with alignment directive
Xi Ruoyao
xry111@xry111.site
Sun Jan 7 13:09:28 GMT 2024
On Sun, 2024-01-07 at 18:27 +0800, Jinyang He wrote:
> On 2024-01-06 19:18, Xi Ruoyao wrote:
>
> > On Sat, 2024-01-06 at 15:23 +0800, Jinyang He wrote:
> > > R_LARCH_ALIGN (psABI v2.30) requires a symbol index. The symbol is only
> > > created at the first time to handle alignment directive. This means that
> > > all other sections may use this symbol. If the section of this symbol is
> > > discarded, there may be problems. Search it in its own section.
> > >
> > > gas/ChangeLog:
> > >
> > > * config/tc-loongarch.c: (get_align_symbol) New function.
> > > * gas/testsuite/gas/loongarch/relax_align2.d: New test.
> > > * gas/testsuite/gas/loongarch/relax_align2.s: Likewise.
> > >
> > > Reported-by: WANG Xuerui <git@xen0n.name>
> > > Link: https://lore.kernel.org/loongarch/2abbb633-a10e-71cc-a5e1-4d9e39074066@loongson.cn/T/#t
> > Hmm, but shouldn't we avoid using R_LARCH_ALIGN in the first place if -
> > mno-relax?
>
> That is true, but currently there is no test that R_LARCH_ALIGN is used
> in -mno-relax. I suspect that is not the key about this modpost problem.
> I used "make V=1" to find the error command, which was
> "scripts/mod/modpost -M -m -o Module.symvers -T modules.order vmlinux.o".
> R_LARCH_ALIGN is present in vmlinux.o because the kernel does not add
> arguments to the Makefile to avoid relax.
Yes, we'll disable relax for kernel as well (currently we only disable
it for modules) in the next kernel release but if we can make objtool
support relax we may enable it again in the future.
> We can simply modify the modpost to avoid reporting error. But the
> real reason is that the section of the symbol is inconsistent with the
> section of the alignment directive. Fix it in GNU assembler can reduce
> other potential errors.
Agree.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the Binutils
mailing list