From: Rosen Penev <rosenp@gmail.com>
To: linux-mips@vger.kernel.org
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] MIPS: boot: compressed: fix the vmlinuz link with ld.lld
Date: Fri, 9 Oct 2026 16:29:23 -0700 [thread overview]
Message-ID: <20261009232923.655907-1-rosenp@gmail.com> (raw)
ld.lld cannot link a 32-bit executable at a sign-extended address. With
a sign-extended ZBOOT_LOAD_ADDRESS, such as the BCM47XX default of
0xffffffff80400000, the vmlinuz link fails:
ld.lld: error: section .text at 0xffffffff80400000 of size 0x35a4
exceeds available address space
arch/mips/Makefile already avoids this for vmlinux by linking at
LINKER_LOAD_ADDRESS, which drops the upper 32 bits on 32-bit kernels.
Do the same for vmlinuz. The address computed by calc_vmlinuz_load_addr
is already derived from LINKER_LOAD_ADDRESS, which is why only an
explicit ZBOOT_LOAD_ADDRESS is affected.
Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
arch/mips/boot/compressed/Makefile | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index e0b8ec9a9516..ee554eaaa18f 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -96,12 +96,20 @@ VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
endif
UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
+# Like LINKER_LOAD_ADDRESS in arch/mips/Makefile: ld.lld cannot link a
+# 32-bit executable at a sign-extended address, so drop the upper 32 bits.
+ifdef CONFIG_64BIT
+VMLINUZ_LINK_ADDRESS = $(VMLINUZ_LOAD_ADDRESS)
+else
+VMLINUZ_LINK_ADDRESS = $(subst 0xffffffff,0x,$(VMLINUZ_LOAD_ADDRESS))
+endif
+
vmlinuzobjs-y += $(obj)/piggy.o
targets += ../../../../vmlinuz
quiet_cmd_zld = LD $@
- cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
+ cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LINK_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
quiet_cmd_strip = STRIP $@
cmd_strip = $(STRIP) -s $@
--
2.56.0
reply other threads:[~2026-10-09 23:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261009232923.655907-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®