未定义的地址引用,即使在提到的行中没有引用它

undefined reference to address even though there's no reference to it on the line mentioned

我收到以下错误:

build/main.o:source/main.s:91: undefined reference to `addr_r'
collect2: error: ld returned 1 exit status

来自此代码:

82] @ Register Aliases for subroutines
83] addr_r  .req    r4
84]
85] write_latch:
86]     mov     fp, sp              @ save position in calling code
87]     PUSH    {r4-r10}            @ preserve variable registers
89]         @ do stuff here later
90]     POP     {r4-r10}            @ restore variable registers
91]     bx      lr                  @ return to position in calling code

我在 Raspberry Pi 3 运行 rasbian 上使用 ARMv7。任何人都可以帮助解释为什么或如何解决它吗?

事实证明问题根本不在第 91 行,问题出在不同子程序中的以下行:

ldr r0, =addr_r     @ address for GPFSEL{n}

我将别名寄存器称为标签,将其更改为:

mov r0, addr_r      @ address for GPFSEL{n}

这解决了问题! :D