All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/5] arm64: PIE: Allow fixed stack pointer
Date: Thu, 24 Sep 2020 01:17:12 +0100	[thread overview]
Message-ID: <20200924001715.30975-3-andre.przywara@arm.com> (raw)
In-Reply-To: <20200924001715.30975-1-andre.przywara@arm.com>

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 --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
-- 
2.17.5

  parent reply	other threads:[~2020-09-24  0:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  0:17 [PATCH 0/5] qemu-arm64: Allow booting via Trusted Firmware Andre Przywara
2020-09-24  0:17 ` [PATCH 1/5] arm64: PIE: Skip fixups if distance is zero Andre Przywara
2020-09-24 14:45   ` André Przywara
2020-09-24 14:49     ` Ard Biesheuvel
2020-09-24 20:22     ` Stephen Warren
2020-09-25  9:08       ` André Przywara
2020-09-24  0:17 ` Andre Przywara [this message]
2020-09-24  0:17 ` [PATCH 3/5] qemu-arm: Remove need to specify flash banks Andre Przywara
2020-09-24  0:17 ` [PATCH 4/5] qemu: Drop ARCH_SUPPORT_TFABOOT Andre Przywara
2020-09-29 13:23   ` Tom Rini
2020-09-29 17:13     ` André Przywara
2020-09-29 17:21       ` Tom Rini
2020-09-24  0:17 ` [PATCH 5/5] qemu-arm64: Enable POSITION_INDEPENDENT Andre Przywara
2020-09-24 20:25   ` Stephen Warren
2020-09-24  7:57 ` [PATCH 0/5] qemu-arm64: Allow booting via Trusted Firmware Amit Tomar
2020-09-24  8:39   ` André Przywara
2020-09-24  8:44   ` Heinrich Schuchardt
2020-09-24  9:13     ` Amit Tomar
2020-09-24  9:26     ` André Przywara
2020-09-24  8:52   ` Ard Biesheuvel
2020-09-24  9:10     ` Amit Tomar
2020-09-29 13:01 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200924001715.30975-3-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.