[PATCH] arm: Add OVERLAY command to BSS section

Avoid allocating and loading the BSS section.
$ aarch64-linux-gnu-objdump -Sh u-boot
Before: 10 .bss_start 00000000 00000000000f21d8 00000000000f21d8 001021d8 2**0 CONTENTS, ALLOC, LOAD, DATA 11 .bss 000068f8 00000000000f2200 00000000000f2200 001021d8 2**6 ALLOC 12 .bss_end 00000000 00000000000f8af8 00000000000f8af8 00108af8 2**0 CONTENTS, ALLOC, LOAD, DATA
After: 10 .bss_start 00000000 00000000000f21d8 00000000000f21d8 001021d8 2**0 CONTENTS 11 .bss 000068f8 00000000000f2200 00000000000f2200 00102200 2**6 CONTENTS 12 .bss_end 00000000 00000000000f21d8 00000000000f21d8 00108af8 2**0 CONTENTS
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com --- arch/arm/cpu/armv8/u-boot.lds | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index fb6a30c922f..25838b9892c 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -151,16 +151,16 @@ SECTIONS
. = ALIGN(8);
- .bss_start : { + .bss_start (OVERLAY) : { KEEP(*(.__bss_start)); }
- .bss : { + .bss (OVERLAY) : { *(.bss*) . = ALIGN(8); }
- .bss_end : { + .bss_end (OVERLAY) : { KEEP(*(.__bss_end)); }

On Sat, Dec 16, 2023 at 07:08:22PM +0100, Marek Vasut wrote:
Avoid allocating and loading the BSS section.
$ aarch64-linux-gnu-objdump -Sh u-boot
Before: 10 .bss_start 00000000 00000000000f21d8 00000000000f21d8 001021d8 2**0 CONTENTS, ALLOC, LOAD, DATA 11 .bss 000068f8 00000000000f2200 00000000000f2200 001021d8 2**6 ALLOC 12 .bss_end 00000000 00000000000f8af8 00000000000f8af8 00108af8 2**0 CONTENTS, ALLOC, LOAD, DATA
After: 10 .bss_start 00000000 00000000000f21d8 00000000000f21d8 001021d8 2**0 CONTENTS 11 .bss 000068f8 00000000000f2200 00000000000f2200 00102200 2**6 CONTENTS 12 .bss_end 00000000 00000000000f21d8 00000000000f21d8 00108af8 2**0 CONTENTS
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com
arch/arm/cpu/armv8/u-boot.lds | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index fb6a30c922f..25838b9892c 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -151,16 +151,16 @@ SECTIONS
. = ALIGN(8);
- .bss_start : {
- .bss_start (OVERLAY) : { KEEP(*(.__bss_start)); }
- .bss : {
- .bss (OVERLAY) : { *(.bss*) . = ALIGN(8); }
- .bss_end : {
- .bss_end (OVERLAY) : { KEEP(*(.__bss_end)); }
This is, I think not sufficient. Looking at arch/arm/cpu/u-boot.lds, seeing the comment about overlay ordering (and that it needs to point to arch/arm/lib/sections.c not bss.c now) and looking harder at arch/arm/cpu/armv8/u-boot.lds I don't know what to think at first about what's going on here. My guess is that what v7 has to / had to do for relocation / etc stuff back at the time is just done differently with the v8 infrastructure (and possibly v7m).

On Sat, 16 Dec 2023 at 11:08, Marek Vasut marek.vasut+renesas@mailbox.org wrote:
Avoid allocating and loading the BSS section.
$ aarch64-linux-gnu-objdump -Sh u-boot
Before: 10 .bss_start 00000000 00000000000f21d8 00000000000f21d8 001021d8 2**0 CONTENTS, ALLOC, LOAD, DATA 11 .bss 000068f8 00000000000f2200 00000000000f2200 001021d8 2**6 ALLOC 12 .bss_end 00000000 00000000000f8af8 00000000000f8af8 00108af8 2**0 CONTENTS, ALLOC, LOAD, DATA
After: 10 .bss_start 00000000 00000000000f21d8 00000000000f21d8 001021d8 2**0 CONTENTS 11 .bss 000068f8 00000000000f2200 00000000000f2200 00102200 2**6 CONTENTS 12 .bss_end 00000000 00000000000f21d8 00000000000f21d8 00108af8 2**0 CONTENTS
This one seems wrong to me. I would expect to see it after the end of .bss
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com
arch/arm/cpu/armv8/u-boot.lds | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Regards, Simon
participants (3)
-
Marek Vasut
-
Simon Glass
-
Tom Rini