1b and 1f in GNU assembly

末鹿安然 提交于 2019-12-03 07:37:50

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".

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!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!