What does the hash (#) value associated with the ARM LDR instruction mean?

前端 未结 3 1847
滥情空心
滥情空心 2021-02-20 18:46

I\'m trying to debug a crash I am experiencing in my application. The stack trace is pointing to an LDR instruction with the following format (thanks disassembler):



        
相关标签:
3条回答
  • 2021-02-20 18:54

    In GNU gas, the hash # is only required for ARMv7 when not using .syntax unified

    For example, you can write it without # for ARMv8 aarch64-linux-gnu-as:

    LDR x0, [x0,4]
    

    or if use .syntax unified in arm-linux-gnueabihf-as:

    .syntax unified
    LDR x0, [x0,4]
    

    More details at: Is the hash required for immediate values in ARM assembly?

    0 讨论(0)
  • 2021-02-20 19:02

    It loads R3 from the address in R0 + 4 bytes. So, yes, it is a byte offset. See this explanation of the addressing modes.

    0 讨论(0)
  • 2021-02-20 19:05

    It adds 4 to the value in R0 and uses that as the address to load a 32 bit value into the register R3

    0 讨论(0)
提交回复
热议问题