diff mbox series

[2/5] arm64: PIE: Allow fixed stack pointer

Message ID 20200924001715.30975-3-andre.przywara@arm.com
State Superseded
Delegated to: Tom Rini
Headers show
Series qemu-arm64: Allow booting via Trusted Firmware | expand

Commit Message

André Przywara Sept. 24, 2020, 12:17 a.m. UTC
Currently selecting CONFIG_POSITION_INDEPENDENT also forces us to use an
initial stack pointer address relative to the load address. This makes
some sense, assuming there is some usable memory nearby.

However if U-Boot is started from some kind of ROM, a stack pointer
nearby will probably also end up in ROM, which is not very helpful.

Allow CONFIG_INIT_SP_RELATIVE to be turned off by a board's config, to
be able to select a fixed stack pointer, for instance in known good
DRAM.

This will help QEMU utilising PIE, when it's loaded to (Flash-)ROM.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
Verified all boards using CONFIG_POSITION_INDEPENDENT to generate the
same .config, before and after this patch.

Cheers,
Andre

 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 80702c23d34..d079e1930fc 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,7 +12,6 @@  config ARM64
 if ARM64
 config POSITION_INDEPENDENT
 	bool "Generate position-independent pre-relocation code"
-	select INIT_SP_RELATIVE
 	help
 	  U-Boot expects to be linked to a specific hard-coded address, and to
 	  be loaded to and run from that address. This option lifts that
@@ -23,6 +22,7 @@  config POSITION_INDEPENDENT
 
 config INIT_SP_RELATIVE
 	bool "Specify the early stack pointer relative to the .bss section"
+	default y if POSITION_INDEPENDENT
 	help
 	  U-Boot typically uses a hard-coded value for the stack pointer
 	  before relocation. Enable this option to instead calculate the