Skip to contentSkip to conversation

sunxi: u-boot-spl.lds: Pass _image_binary_end

PATCH In review Fabio Estevam 3 participants 9 messages Jul 1, 2023 – Jul 3, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 sunxi: u-boot-spl.lds: Pass _image_binary_end

From: Fabio Estevam <[email protected]>

Pass _image_binary_end to make a standard way to indicate the end of the text section in SPL.

The motivation for this is to have a uniform way to handle the SPL boundary checks.

---
Changes since v1:
- Newly introduced to avoid build failure.

 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 1 +
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds     | 1 +
 2 files changed, 2 insertions(+)
arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds +1 -0
index c10873681157..cf65e8c46281 100644
@@ -36,6 +36,7 @@ SECTIONS
 	. = ALIGN(4);
 	__image_copy_end = .;
 	_end = .;
+	_image_binary_end = .;
 
 	.bss :
 	{
arch/arm/cpu/armv7/sunxi/u-boot-spl.lds +1 -0
index 306a4ddf3cd2..fb7a789b28b8 100644
@@ -45,6 +45,7 @@ SECTIONS
 	. = ALIGN(4);
 	__image_copy_end = .;
 	_end = .;
+	_image_binary_end = .;
 
 	.bss :
 	{
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/3 microblaze: u-boot-spl.lds: Pass _image_binary_end

From: Fabio Estevam <[email protected]>

Pass _image_binary_end to make a standard way to indicate the end of the text section in SPL.

The motivation for this is to have a uniform way to handle the SPL boundary checks.

---
Changes since v1:
- Newly introduced to avoid build failure.

 arch/microblaze/cpu/u-boot-spl.lds | 1 +
 1 file changed, 1 insertion(+)
arch/microblaze/cpu/u-boot-spl.lds +1 -0
index 4ac5a21524c5..597095195cae 100644
@@ -54,6 +54,7 @@ SECTIONS
 		__bss_end = .;
 	}
 	_end = . ;
+	_image_binary_end = .;
 }
 
 #if defined(CONFIG_SPL_MAX_FOOTPRINT)
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v2 2/3] microblaze: u-boot-spl.lds: Pass _image_binary_end

In reply to Fabio Estevam
Quoted 10 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Pass _image_binary_end to make a standard way to indicate the end of the text section in SPL.

The motivation for this is to have a uniform way to handle the SPL boundary checks.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#4 lore raw

PATCH v2 3/3 spl: spl_legacy: Fix spl_end address

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently, spl_end points to the __bss_end address, which is an external RAM address instead of the end of the SPL text section in the internal RAM.

This causes boot failures on imx6-colibri, for example:

```
Trying to boot from MMC1
SPL: Image overlaps SPL
resetting ...
```

Fix this problem by assigning spl_end to _image_binary_end, as this symbol properly represents the end of the SPL text section.

From u-boot-spl.map:

.end
*(.__end)

                0x00000000009121a4                _image_binary_end = .
Fixes 77aed22b48ab ("spl: spl_legacy: Add extra address checks")

---
Changes since v1:
- None.

 common/spl/spl_legacy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_legacy.c +1 -1
index d34bc5492e8d..095443c63d8d 100644
@@ -19,7 +19,7 @@
 static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size)
 {
 	uintptr_t spl_start = (uintptr_t)_start;
-	uintptr_t spl_end = (uintptr_t)__bss_end;
+	uintptr_t spl_end = (uintptr_t)_image_binary_end;
 	uintptr_t end = start + size;
 
 	if ((start >= spl_start && start < spl_end) ||
Signature · 1 line
2.34.1
Reviewed-by Tested-by on v2 3/3
#5 lore raw

Re: [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address

Quoted 18 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently, spl_end points to the __bss_end address, which is an external RAM address instead of the end of the SPL text section in the internal RAM.

This causes boot failures on imx6-colibri, for example:

```
Trying to boot from MMC1
SPL: Image overlaps SPL
resetting ...
```

Fix this problem by assigning spl_end to _image_binary_end, as this symbol properly represents the end of the SPL text section.

Quoted 1 line

From u-boot-spl.map:

Quoted 8 lines

.end
*(.__end)

                 0x00000000009121a4                _image_binary_end = .
Fixes 77aed22b48ab ("spl: spl_legacy: Add extra address checks")
#6 lore raw

Re: [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address

In reply to Fabio Estevam
Quoted 20 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently, spl_end points to the __bss_end address, which is an external RAM address instead of the end of the SPL text section in the internal RAM.

This causes boot failures on imx6-colibri, for example:

```
Trying to boot from MMC1
SPL: Image overlaps SPL
resetting ...
```

Fix this problem by assigning spl_end to _image_binary_end, as this symbol properly represents the end of the SPL text section.

From u-boot-spl.map:

.end
*(.__end)

Quoted 8 lines
                0x00000000009121a4                _image_binary_end = .

Applied to u-boot/master, thanks!

Signature · 1 line
Tom