[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e9396ca-460b-49ca-818e-73f0a8997b15@huawei.com>
Date: Thu, 22 Feb 2024 19:24:30 +0800
From: "liuyuntao (F)" <liuyuntao12@...wei.com>
To: Arnd Bergmann <arnd@...db.de>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
CC: Russell King <linux@...linux.org.uk>, Andrew Davis <afd@...com>, Andrew
Morton <akpm@...ux-foundation.org>, "Kirill A. Shutemov"
<kirill.shutemov@...ux.intel.com>, Geert Uytterhoeven
<geert+renesas@...der.be>, Jonathan Corbet <corbet@....net>, Mike Rapoport
<rppt@...nel.org>, Eric DeVolder <eric.devolder@...cle.com>, Rob Herring
<robh@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Linus Walleij
<linus.walleij@...aro.org>
Subject: Re: [PATCH -next] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
On 2024/2/21 23:51, Arnd Bergmann wrote:
> I have given your patch some build testing with random
> configurations in my build setup and it seems to work
> fine with gcc/binutils, but unfortunately I came across
> a link failure using clang/lld:
>
> ld.lld: error: ./arch/arm/kernel/vmlinux.lds:35: ( expected, but got }
>>>> __vectors_lma = .; OVERLAY 0xffff0000 : AT(__vectors_lma) { .vectors { KEEP(*(.vectors)) } .vectors.bhb.loop8 { KEEP(*(.vectors.bhb.loop8)) } .vectors.bhb.bpiall { KEEP(*(.vectors.bhb.bpiall)) } } __vectors_start = LOADADDR(.vectors); __vectors_end = LOADADDR(.vectors) + SIZEOF(.vectors); __vectors_bhb_loop8_start = LOADADDR(.vectors.bhb.loop8); __vectors_bhb_loop8_end = LOADADDR(.vectors.bhb.loop8) + SIZEOF(.vectors.bhb.loop8); __vectors_bhb_bpiall_start = LOADADDR(.vectors.bhb.bpiall); __vectors_bhb_bpiall_end = LOADADDR(.vectors.bhb.bpiall) + SIZEOF(.vectors.bhb.bpiall); . = __vectors_lma + SIZEOF(.vectors) + SIZEOF(.vectors.bhb.loop8) + SIZEOF(.vectors.bhb.bpiall); __stubs_lma = .; .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { *(.stubs) } __stubs_start = LOADADDR(.stubs); __stubs_end = LOADADDR(.stubs) + SIZEOF(.stubs); . = __stubs_lma + SIZEOF(.stubs); PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
>>>> ^
>
> I don't immediately see what the problem is here, I hope you
> can address it before you send a v2.
>
> Arnd
I reproduced this issue with make LLVM=1 ARCH=arm -j320 > ../make.txt.
Based on the position of the caret, I speculate that the issue arises from
lld's inability to recognize the KEEP() command preceding the OUTPUT
section in the OVERLAY command.
>
The full syntax of the OVERLAY command is as follows: OVERLAY [start] :
[NOCROSSREFS] [AT ( ldaddr )] { secname1 { output-section-command
output-section-command … } [:phdr…] [=fill] secname2 {
output-section-command output-section-command … } [:phdr…] [=fill] … }
[>region] [:phdr…] [=fill] [,]
>
I attempted to modify KEEP(*(.vectors)) to KEEP(*(.vectors))(.vectors),
and received the following error message:
ld.lld: error: ./arch/arm/kernel/vmlinux.lds:36: ( expected, but got } >
__vectors_lma = .; OVERLAY 0xffff0000 : AT(__vectors_lma) { .vectors {
KEEP(*(.vectors))(.vectors) } .vectors.bhb.loop8 {
KEEP(*(.vectors.bhb.loop8)) } .vectors.bhb.bpiall {
KEEP(*(.vectors.bhb.bpiall)) } } __vectors_start = LOADADDR(.vectors);
__vectors_end = LOADADDR(.vectors) + SIZEOF(.vectors);
__vectors_bhb_loop8_start = LOADADDR(.vectors.bhb.loop8);
__vectors_bhb_loop8_end = LOADADDR(.vectors.bhb.loop8) +
SIZEOF(.vectors.bhb.loop8); __vectors_bhb_bpiall_start =
LOADADDR(.vectors.bhb.bpiall); __vectors_bhb_bpiall_end =
LOADADDR(.vectors.bhb.bpiall) + SIZEOF(.vectors.bhb.bpiall); . =
__vectors_lma + SIZEOF(.vectors) + SIZEOF(.vectors.bhb.loop8) +
SIZEOF(.vectors.bhb.bpiall); __stubs_lma = .; .stubs ADDR(.vectors) +
0x1000 : AT(__stubs_lma) { *(.stubs) } __stubs_start = LOADADDR(.stubs);
__stubs_end = LOADADDR(.stubs) + SIZEOF(.stubs); . = __stubs_lma +
SIZEOF(.stubs); PROVIDE(vector_fiq_offset = vector_fiq -
ADDR(.vectors)); > ^
The position of the caret has been moved below the right brace
of { KEEP(*(.vectors.bhb.loop8)) }, indicating that lld is treating
the entire `KEEP(*(.vectors))` as a file name. This could potentially be
a bug in lld. Perhaps we can temporarily
enable the DCE option only when option LD_IS_LLD is disabled,
like risc-v:
`select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD`.
Powered by blists - more mailing lists