6.3.8 Methods of importing linker-defined symbols in Arm® assembly language

You can import linker-defined symbols into your Arm® assembly code.

To import linker-defined symbols into your assembly language source code, use the .global directive.

32-bit applications

Create a 32-bit data word to hold the value of the symbol, for example:

         .global Image$$ER_ZI$$Limit
         …
.zi_limit:
         .word Image$$ER_ZI$$Limit

To load the value into a register, such as r1, use the LDR instruction:

         LDR r1, .zi_limit

The LDR instruction must be able to reach the 32-bit data word. The accessible memory range varies between A64, A32, and T32, and the architecture you are using.

64-bit applications

Create a 64-bit data word to hold the value of the symbol, for example:

         .global Image$$ER_ZI$$Limit
         …
.zi_limit:
         .quad Image$$ER_ZI$$Limit

To load the value into a register, such as x1, use the LDR instruction:

         LDR x1, .zi_limit

The LDR instruction must be able to reach the 64-bit data word.

Non-ConfidentialPDF file icon PDF versionDUI0803J
Copyright © 2014–2017, 2019 Arm Limited or its affiliates. All rights reserved.