public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents
Date: Fri, 28 Oct 2016 12:42:52 +0100	[thread overview]
Message-ID: <1477654974-5598-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1477654974-5598-1-git-send-email-ard.biesheuvel@linaro.org>

The GCC ARM builds have access to ADRL/LDRL macros that emit relative
symbol references, i.e., references that do not require fixing up at
load time (or FV generation time for XIP modules)

Implement equivalent functionality for RVCT: note that this does not
use movw/movt pairs, but the more compatible add/add/add or add/add/ldr
sequences (which Clang does not support, unfortunately, hence the use
of movw/movt for the GCC toolchain family)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPkg/Include/AsmMacroIoLib.inc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
index c9cad5230c94..4bc3146fb399 100644
--- a/ArmPkg/Include/AsmMacroIoLib.inc
+++ b/ArmPkg/Include/AsmMacroIoLib.inc
@@ -26,4 +26,24 @@
   ldr  $Reg, =($Data)
   MEND
 
+  MACRO
+  adrll   $Reg, $Symbol
+  add     $Reg, pc, #-8
+  RELOC   R_ARM_ALU_PC_G0_NC, $Symbol
+  add     $Reg, $Reg, #-4
+  RELOC   R_ARM_ALU_PC_G1_NC, $Symbol
+  add     $Reg, $Reg, #0
+  RELOC   R_ARM_ALU_PC_G2, $Symbol
+  MEND
+
+  MACRO
+  ldrl    $Reg, $Symbol
+  add     $Reg, pc, #-8
+  RELOC   R_ARM_ALU_PC_G0_NC, $Symbol
+  add     $Reg, $Reg, #-4
+  RELOC   R_ARM_ALU_PC_G1_NC, $Symbol
+  ldr     $Reg, [$Reg, #0]
+  RELOC   R_ARM_LDR_PC_G2, $Symbol
+  MEND
+
   END
-- 
2.7.4



  reply	other threads:[~2016-10-28 11:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 11:42 [PATCH 0/3] ArmPkg/ArmPlatformPkg: some cleanups Ard Biesheuvel
2016-10-28 11:42 ` Ard Biesheuvel [this message]
2016-10-28 15:21   ` [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents Leif Lindholm
2016-10-28 11:42 ` [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd Ard Biesheuvel
2016-10-28 15:21   ` Leif Lindholm
2016-10-28 11:42 ` [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros Ard Biesheuvel
2016-10-28 15:21   ` Leif Lindholm

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-list 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=1477654974-5598-2-git-send-email-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /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