[PATCH] arm64: Properly clear BSS
Ilias Apalodimas
ilias.apalodimas at linaro.org
Wed Sep 3 09:02:18 CEST 2025
Hi Brock
On Tue, 2 Sept 2025 at 09:57, brock.zheng <yzheng at techyauld.com> wrote:
>
> i am glad to see my patch been reviewed.
>
> I can not access the international network easily.
> so any of you can fix / rewrite / change that patch.
No worries, I fixed up the comments.
>
> If I can see the fixup in the offical git repo, I will be very very glad.
Tom, I know this is late in the cycle, but this is an obvious bug fix.
Any chance we can pull it early in -master so people can test?
Thanks
/Ilias
>
>
> On 2025-09-02 09:08:12, Ilias Apalodimas wrote:
> > Date: Tue, 2 Sep 2025 09:08:12 +0300
> > From: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > To: trini at konsulko.com
> > Cc: heinrich.schuchardt at canonical.com, Ilias Apalodimas
> > <ilias.apalodimas at linaro.org>, brock_zheng <yzheng at techyauld.com>, Simon
> > Glass <sjg at chromium.org>, Marek Vasut <marek.vasut+renesas at mailbox.org>,
> > u-boot at lists.denx.de
> > Subject: [PATCH] arm64: Properly clear BSS
> > X-Mailer: git-send-email 2.50.1
> >
> > Brock reports a breakage on an RK3568 SoC. His patch is
> > correct but he never followed up on the requested changes.
> >
> > We currently use ldr to calculate the address of __bss_start and
> > __bss_end. However the absolute addresses of the literal pool are never
> > relocated and we end up clearing the wrong memory section. Use
> > PC-relative addressing instead.
> >
> > Link: https://lore.kernel.org/u-boot/zfknlzcemnnaka5w2er5wjwefwoidrpndc4gjhx6d5xr6nlcjr@pasfayjiutii/
> >
> > Suggested-by: brock_zheng <yzheng at techyauld.com>
> > Reported-by: brock_zheng <yzheng at techyauld.com>
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > ---
> > arch/arm/lib/crt0_64.S | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
> > index f3f279f2c39c..3e7627aa389b 100644
> > --- a/arch/arm/lib/crt0_64.S
> > +++ b/arch/arm/lib/crt0_64.S
> > @@ -158,8 +158,10 @@ relocation_return:
> > /*
> > * Clear BSS section
> > */
> > - ldr x0, =__bss_start /* this is auto-relocated! */
> > - ldr x1, =__bss_end /* this is auto-relocated! */
> > + adrp x0, __bss_start
> > + add x0, x0, #:lo12:__bss_start
> > + adrp x1, __bss_end
> > + add x1, x1, #:lo12:__bss_end
> > clear_loop:
> > str xzr, [x0], #8
> > cmp x0, x1
> > --
> > 2.50.1
> >
> >
> >
>
> --
> Brock Zheng <yzheng at techyauld.com>
>
>
More information about the U-Boot
mailing list