ARM Assembly Local Labels

后端 未结 2 356
梦谈多话
梦谈多话 2021-01-02 08:27

I\'m currently reading a tutorial on Raspberry Pi OS development and was wondering about the way local labels are used in this code snippet (GCC ARM Assembly):



        
2条回答
  •  再見小時候
    2021-01-02 09:19

    The important difference is that the numbered local labels can be reused without worry and that is why you need to specify the direction too. You can jump to preceding or following one, but not the ones beyond them.

    1: foo
    ...
    1: bar
    ...
    jmp 1b # jumps to bar
    ...
    jmp 1f # jumps to baz
    ...
    1: baz
    ...
    1: qux
    ...
    jmp 1b # jumps to qux
    

    As long as you only use them within a single block only, you can be sure they will work as intended and not conflict with anything else.

提交回复
热议问题