I was wondering about the following. I’ve noticed when writing assembly language that IA32 is designed in such a way as to promote the use of relative jumps i.e. jump a displacement amount of bytes vs the use of absolute jumps i.e. change eip to a specific address in memory. What is the logic behind this?
I was wondering about the following. I’ve noticed when writing assembly language that IA32
Share
Most jumps are to targets not far away from the jump instruction. Since jump instructions are provided that take a signed 16-bit value, they can be fewer bytes than needed for an absolute jump (usually 4 bytes plus the instruction itself).
One small additional advantage of relative branches is that they don’t need to be fixed up in the linker, or, for that matter, go through the extra indirection needed in PIC (position independent code).