I am fairly new to PPC assembly, and I am interested in how the compiler encodes the branch link.
Example:
00000000 fnc_1()
00000000 std r1 , 0x7FFFF
00000004 li r2 , 0x0
00000008 mr r3 , r2
*** -> 0000000C bl fnc_2 -> | 10010 | ?? 24bits ?? | 0 | 1 | ****
00000010 blr
00000014 fnc_2()
00000014 ..
00000018 ..
0000001C ..
00000020 blr
So, my question boils down to: How does the compiler take the offset 0x14, and transform it into the 24bits in the bl opcode. I have looked at programs in hex but still cant figure it out. I have read this: http://www.eecs.umich.edu/eecs/courses/eecs373/GreenBook/ch4-bran.pdf Any clarification would help!