public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/6] arm64: PIE: Skip fixups if distance is zero
Date: Wed, 30 Sep 2020 17:39:14 +0100	[thread overview]
Message-ID: <20200930163918.24995-3-andre.przywara@arm.com> (raw)
In-Reply-To: <20200930163918.24995-1-andre.przywara@arm.com>

When the actual offset between link and runtime address is zero, there
is no need for patching up U-Boot early when running with
CONFIG_POSITION_INDEPENDENT.

Skip the whole routine when the distance is 0.

This helps when U-Boot is loaded into ROM, or in otherwise sensitive
memory locations.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
---
 arch/arm/cpu/armv8/start.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index 002698b501c..02b952bb328 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -66,7 +66,8 @@ save_boot_params_ret:
 pie_fixup:
 	adr	x0, _start		/* x0 <- Runtime value of _start */
 	ldr	x1, _TEXT_BASE		/* x1 <- Linked value of _start */
-	sub	x9, x0, x1		/* x9 <- Run-vs-link offset */
+	subs	x9, x0, x1		/* x9 <- Run-vs-link offset */
+	beq	pie_fixup_done
 	adr	x2, __rel_dyn_start	/* x2 <- Runtime &__rel_dyn_start */
 	adr	x3, __rel_dyn_end	/* x3 <- Runtime &__rel_dyn_end */
 pie_fix_loop:
-- 
2.17.5

  parent reply	other threads:[~2020-09-30 16:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 16:39 [PATCH v2 0/6] qemu-arm64: Allow booting via Trusted Firmware Andre Przywara
2020-09-30 16:39 ` [PATCH v2 1/6] arm64: PIE: Do not skip static relocation Andre Przywara
2020-09-30 17:11   ` Stephen Warren
2020-10-01  8:33   ` Amit Tomar
2020-10-09 13:02   ` Tom Rini
2020-09-30 16:39 ` Andre Przywara [this message]
2020-10-09 13:02   ` [PATCH v2 2/6] arm64: PIE: Skip fixups if distance is zero Tom Rini
2020-09-30 16:39 ` [PATCH v2 3/6] arm64: PIE: Allow fixed stack pointer Andre Przywara
2020-10-09 13:02   ` Tom Rini
2020-09-30 16:39 ` [PATCH v2 4/6] qemu-arm: Remove need to specify flash banks Andre Przywara
2020-10-09 13:02   ` Tom Rini
2020-09-30 16:39 ` [PATCH v2 5/6] qemu-arm: Drop ARCH_SUPPORT_TFABOOT Andre Przywara
2020-09-30 17:40   ` Tom Rini
2020-10-09 13:02   ` Tom Rini
2020-09-30 16:39 ` [PATCH v2 6/6] qemu-arm64: Enable POSITION_INDEPENDENT Andre Przywara
2020-10-09 13:03   ` Tom Rini
2020-09-30 17:39 ` [PATCH v2 0/6] qemu-arm64: Allow booting via Trusted Firmware 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=20200930163918.24995-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox