aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara2020-09-30 17:39:14 +0100
committerTom Rini2020-10-08 11:42:36 -0400
commit9a984f100ed1d2d4a3aed7db9cfd1a3892e2bccd (patch)
treeead0e6a3694bb5d4fe59e355dbfc0b2e2e6307dd
parenteabc0902155aa36f603f628360706767202affb2 (diff)
arm64: PIE: Skip fixups if distance is zero
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>
-rw-r--r--arch/arm/cpu/armv8/start.S3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index e5c2856cf57..662449156b1 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -83,7 +83,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
adrp x2, __rel_dyn_start /* x2 <- Runtime &__rel_dyn_start */
add x2, x2, #:lo12:__rel_dyn_start
adrp x3, __rel_dyn_end /* x3 <- Runtime &__rel_dyn_end */