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 1/5] arm64: PIE: Skip fixups if distance is zero
Date: Thu, 24 Sep 2020 01:17:11 +0100	[thread overview]
Message-ID: <20200924001715.30975-2-andre.przywara@arm.com> (raw)
In-Reply-To: <20200924001715.30975-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>
---
 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

  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 ` Andre Przywara [this message]
2020-09-24 14:45   ` [PATCH 1/5] arm64: PIE: Skip fixups if distance is zero 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 ` [PATCH 2/5] arm64: PIE: Allow fixed stack pointer Andre Przywara
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-2-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.