ARMv7:有没有办法从寄存器中用 link 进行分支?

ARMv7: Is there a way to branch with link from a register?

在 ARMv7 中,我知道有 bl 指令分支到一个地址并更新 link 寄存器以指向紧随其后的指令。我也知道可以使用bl跳转到直接引用的标签如下:

bl example_label
mov r5, 0
example_label:
mov r5, 111
@ blah blah blah

但是,当 example_label 引用的地址在寄存器内时,比方说 r0,执行以下操作时出现错误:

bl r0
mov r5, 0
example_label:
mov r5, 111
@ blah blah blah

有没有办法可以使用寄存器执行 bl 指令?我必须使用其他方法吗?还是完全不可能?

提前致谢!

编辑:

根据 tum_

的要求更新了代码片段
push lr  # you need to store this
ldr r0, =example_label
blx r0  # overwrites existing lr.
mov r5, 0
pop pc   # return to saved caller and don't execute example label again...
example_label:
mov r5, 111
@ blah blah blah
bx lr # not blah blah, you need to return control to caller.

使用

blx r0

请参阅 https://developer.arm.com/documentation/dui0497/a/the-cortex-m0-instruction-set/branch-and-control-instructions/b--bl--bx--and-blx 以获取完整参考