1b and 1f in GNU assembly

后端 未结 2 1302
傲寒
傲寒 2020-12-03 08:37

I am analyzing a linux exception code. By the way I can\'t understand gnu assembly syntax.

    svc_preempt:
    mov r8, lr
1:  bl  preempt_schedule_irq               


        
相关标签:
2条回答
  • 2020-12-03 09:13

    Labels "xb" and "xf", where "x" is a number are a smart extension to the GNU assembly. It branches to the first found label "x" searching "forward" for "f" or "backward" for "b".

    That means that in your first listing using "1b" as a target will search for "1" BEFORE the instruction that uses it. In the second listing "2f" will search for "2" AFTER the instruction that uses it, the "2b" at the end of this listing will then branch to the same "2", because it is BEFORE the instruction.

    There may be multiple labels with numbers in your code.

    See here - https://sourceware.org/binutils/docs-2.24/as/Symbol-Names.html#Symbol-Names - chapter "Local labels".

    0 讨论(0)
  • 2020-12-03 09:14

    These are relative branches (so many bytes forwards or backwards relative to the current position) so they don't really have a label. However, when visualizing code it is easier to actually have some kind of visualization of where it goes to - hence the "not-label" of 1 and the backwards and forwards jumps.

    I had to work with the alternative on the IBM370 mainframe - believe me, that's not fun!

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