aboutsummaryrefslogtreecommitdiff
path: root/include/lib
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2018-10-12 16:40:28 +0100
committerSoby Mathew <soby.mathew@arm.com>2018-10-29 09:54:31 +0000
commitf1722b693d363cc6a2b624d59f0442bf845baf62 (patch)
tree2b8a412e48830f66641cecdb308a152db268a60f /include/lib
parent3bd17c0fef46a7cd894974ac4c996801458f6d09 (diff)
downloadtrusted-firmware-a-f1722b693d363cc6a2b624d59f0442bf845baf62.tar.gz
PIE: Use PC relative adrp/adr for symbol reference
This patch fixes up the AArch64 assembly code to use adrp/adr instructions instead of ldr instruction for reference to symbols. This allows these assembly sequences to be Position Independant. Note that the the reference to sizes have been replaced with calculation of size at runtime. This is because size is a constant value and does not depend on execution address and using PC relative instructions for loading them makes them relative to execution address. Also we cannot use `ldr` instruction to load size as it generates a dynamic relocation entry which must *not* be fixed up and it is difficult for a dynamic loader to differentiate which entries need to be skipped. Change-Id: I8bf4ed5c58a9703629e5498a27624500ef40a836 Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Diffstat (limited to 'include/lib')
-rw-r--r--include/lib/pmf/pmf_asm_macros.S6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/lib/pmf/pmf_asm_macros.S b/include/lib/pmf/pmf_asm_macros.S
index d58829eecc..5e19e62f70 100644
--- a/include/lib/pmf/pmf_asm_macros.S
+++ b/include/lib/pmf/pmf_asm_macros.S
@@ -18,10 +18,12 @@
mov x9, x30
bl plat_my_core_pos
mov x30, x9
- ldr x1, =__PERCPU_TIMESTAMP_SIZE__
+ adr x2, __PMF_PERCPU_TIMESTAMP_END__
+ adr x1, __PMF_TIMESTAMP_START__
+ sub x1, x2, x1
mov x2, #(\_tid * PMF_TS_SIZE)
madd x0, x0, x1, x2
- ldr x1, =pmf_ts_mem_\_name
+ adr x1, pmf_ts_mem_\_name
add x0, x0, x1
.endm