I am writing boot code where I would like to use only relative addressing with branch instructions.
I have noticed the following assembly code:
110: lwz r4,0(r6)
...
...
b 110b
The destination of the branch is a label that is all numerics and the branch instruction has the letter 'b' after the label. I assume the 'b' means backwards. I have also seen 'f', which I assume means forward.
This notation would seem to imply relative addressing, but I can't find any documentation stating such.
Is the notation of using numerics followed by 'f' or 'b' the only mechanism to guarantee relative branching? or can an alphanumeric label (more meaningful names) be used with a f/b suffix?
I am using a gcc cross-compiler.
The relative/absolute distinction is inferred from the instruction used. There should be no need for the assembler to guess which one you want. For PPC:
b 110b ; relative
ba 110b ; absolute