I'm studying for a test in assembly and in the subject of "Position-Independent-Code" I find the difference between a relative jump and an absolute jump confusing. How can I tell what kind of jump it is?
I understand what a relative jump is (the offset from current line). But what does an absolute jump look like? When does it happen?
Anything that looks like just plain jmp label
is relative.
Absolute jumps look like
jmp register
jmp [address]
jmp segment:absoluteaddr
jmp far [address]
Any far jump is absolute, any indirect jump is absolute, the combination (far, indirect) is therefore also absolute. Far jump only happen when necessary (you have to change cs
and it's not a call
). Indirect jumps are used for function pointers, branch tables (used in some cases for switch
statements), dynamic dispatch (virtual methods) and maybe for imported functions (usually you call them, but maybe it's a tail call).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With