• Soby Mathew's avatar
    Add helper to return reference to a symbol · 6a7b3005
    Soby Mathew authored
    
    
    This patch adds a utility function to return
    the address of a symbol. By default, the compiler
    generates adr/adrp instruction pair to return
    the reference and this utility is used to override
    this compiler generated to code and use `ldr`
    instruction.
    
    This is needed for Position Independent Executable
    when it needs to reference a symbol which is constant
    and does not depend on the execute address of the
    binary.
    
    For example, on the FVP, the GICv3 register context is
    stored in a secure carveout (arm_el3_tzc_dram) within
    DDR and does not relocate with the BL image. Now if
    BL31 is executing at a different address other than
    the compiled address, using adrp/adr instructions to
    reference this memory will not work as they generate an
    address that is PC relative. The way to get around this
    problem is to reference it as non-PC relative (i.e
    non-relocatable location) via `ldr` instruction.
    
    Change-Id: I5008a951b007144258121690afb68dc8e12ee6f7
    Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
    6a7b3005
utils.h 2.99 KB