Files
system76-edk2/ArmPkg/Include/AsmMacroIoLib.inc
Ard Biesheuvel 4101c8753f ArmPkg RVCT: add ADRL/LDRL macro equivalents
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>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-10-28 16:26:15 +01:00

50 lines
1.3 KiB
PHP

;%HEADER%
;/** @file
; Macros to work around lack of Apple support for LDR register, =expr
;
; Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
; Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
;**/
MACRO
LoadConstantMacro $Data
ldr r0, =($Data)
MEND
MACRO
LoadConstantToRegMacro $Data, $Reg
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