[PATCH v3 2/7] arm: clean up v7 and v8 linker scripts for bss_start/end

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Mar 13 22:43:42 CET 2024


Hi Richard,

On Wed, 13 Mar 2024 at 22:19, Richard Henderson
<richard.henderson at linaro.org> wrote:
>
> On 3/13/24 06:23, Ilias Apalodimas wrote:
> > +++ b/arch/arm/cpu/armv8/u-boot-spl.lds
> > @@ -63,18 +63,11 @@ SECTIONS
> >
> >       _image_binary_end = .;
> >
> > -     .bss_start (NOLOAD) : {
> > -             . = ALIGN(8);
> > -             KEEP(*(.__bss_start));
> > -     } >.sdram
> > -
> > -     .bss (NOLOAD) : {
> > +     .bss : {
> > +             __bss_start = .;
> >               *(.bss*)
> > -              . = ALIGN(8);
> > -     } >.sdram
> > -
> > -     .bss_end (NOLOAD) : {
> > -             KEEP(*(.__bss_end));
> > +             . = ALIGN(8);
> > +             __bss_end = .;
>
> Still missing the alignment on .bss, previously in .bss_start.

Since this is emitted in .sdram memory I can't define it as
.bss ALIGN(8) : {....} since the calculated memory will be outside the
sdram-defined region

I could define it as
.bss : {
        . = ALIGN(8);
        __bss_start = .;
        ......
}

But instead, I added an assert at the bottom which will break the
linking if the __bss_start is not 8byte aligned.

Looking at the output for xilinx_zynqmp_kria_defconfig (which is a v8
board & SPL) looks identical and correct since
CONFIG_SPL_BSS_START_ADDR=0x1000 for that board.

$~ readelf -sW spl/u-boot-spl | grep bss_start
  1550: 0000000000001000     0 NOTYPE  GLOBAL DEFAULT    6 __bss_start

Isn't the assert enough? Or do you think adding the . = ALIGN(8) in
the section definition is better?

Thanks
/Ilias


>
> With that fixed,
> Reviewed-by: Richard Henderson <richard.henderson at linaro.org>
>
> r~


More information about the U-Boot mailing list