From: Nathan Chancellor <nathan@kernel.org>
To: Rob Landley <rob@landley.net>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Russell King <linux@armlinux.org.uk>,
Christian Eggers <ceggers@arri.de>, Arnd Bergmann <arnd@arndb.de>,
Yuntao Liu <liuyuntao12@huawei.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Rich Felker <dalias@libc.org>
Subject: Re: [PATCH 1/2] ARM: Require linker to support KEEP within OVERLAY for DCE
Date: Fri, 4 Jul 2025 17:24:02 -0700 [thread overview]
Message-ID: <20250705002402.GA1968690@ax162> (raw)
In-Reply-To: <6739da7d-e555-407a-b5cb-e5681da71056@landley.net>
On Fri, Jul 04, 2025 at 02:15:18PM -0500, Rob Landley wrote:
> On 3/13/25 03:48, Linus Walleij wrote:
> > On Tue, Mar 11, 2025 at 8:43 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > > ld.lld prior to 21.0.0 does not support using the KEEP keyword within an
> > > overlay description, which may be needed to avoid discarding necessary
> > > sections within an overlay with '--gc-sections', which can be enabled
> > > for the kernel via CONFIG_LD_DEAD_CODE_DATA_ELIMINATION.
> > >
> > > Disallow CONFIG_LD_DEAD_CODE_DATA_ELIMINATION without support for KEEP
> > > within OVERLAY and introduce a macro, OVERLAY_KEEP, that can be used to
> > > conditionally add KEEP when it is properly supported to avoid breaking
> > > old versions of ld.lld.
>
> I bisected the 6.15 armv7l build break my mkroot project hit to this commit
> (e7607f7d6d81):
>
> LD .tmp_vmlinux1
> Segmentation fault
> make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 139
> make[1]: ***
> [/home/landley/toybox/clean/root/build/armv7l-tmp/linux/Makefile:1226:
> vmlinux] Error 2
> make: *** [Makefile:251: __sub-make] Error 2
>
> The toolchain in question was built from gcc 11.4.0 and binutils 2.33.1
> which were the newest versions supported by
> https://github.com/richfelker/musl-cross-make when the still-current musl
> release (1.2.5) came out.
>
> You can grab a binary toolchain to smoketest with from https://landley.net/bin/toolchains/latest/armv7l-linux-musleabihf-cross.tar.xz
> and build using the attached miniconfig ala:
>
> for i in distclean allnoconfig ""
> do
> CROSS_COMPILE=armv7l-linux-musleabihf- make ARCH=arm \
> KCONFIG_ALLCONFIG=linux-miniconfig -j4 $i
> done
>
> This _just_ seems to affect armv7l: armv5l and aarch64 still build fine.
Hmm, I do see a bug in that change, as it allows DCE to be turned on
with binutils older than 2.36, which should be avoided with something
like
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3072731fe09c..962451e54fdd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -121,7 +121,7 @@ config ARM
select HAVE_KERNEL_XZ
select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
select HAVE_KRETPROBES if HAVE_KPROBES
- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >= 23600 || LD_CAN_USE_KEEP_IN_OVERLAY)
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >= 23600 || LD_IS_LLD) && LD_CAN_USE_KEEP_IN_OVERLAY
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_OPTPROBES if !THUMB2_KERNEL
but it does not seem like your test configuration enables
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION so I would expect this change to be
a no-op in that case? Does the above change work for you? I won't be
free to validate this until after the weekend.
Cheers,
Nathan
next prev parent reply other threads:[~2025-07-05 0:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 19:43 [PATCH 0/2] ARM: Fix ARM_VECTORS with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION Nathan Chancellor
2025-03-11 19:43 ` [PATCH 1/2] ARM: Require linker to support KEEP within OVERLAY for DCE Nathan Chancellor
2025-03-13 8:48 ` Linus Walleij
2025-07-04 19:15 ` Rob Landley
2025-07-05 0:24 ` Nathan Chancellor [this message]
2025-07-05 19:53 ` Rob Landley
2025-03-11 19:43 ` [PATCH 2/2] ARM: add KEEP() keyword to ARM_VECTORS Nathan Chancellor
2025-03-13 8:49 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250705002402.GA1968690@ax162 \
--to=nathan@kernel.org \
--cc=arnd@arndb.de \
--cc=ceggers@arri.de \
--cc=dalias@libc.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=liuyuntao12@huawei.com \
--cc=rob@landley.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.