I am looking at some code that has jmp $+5
instruction at the beginning of the entry code in a library, right after pushing registers to the stack. I understand that jmp $+5
puts IP at the next instruction but why is the jump there at all? Without it, the next instruction would have been executed anyway. The only thing that comes to mind is that it is PIE related and jump with displacement of 0 that could potentially be a non-zero value, but this code is a part of a big "blob" and I don't think its individual parts would be relocatable, at least not to a point where the jump displacement would be non-zero.
The compiler is GCC 3.7?, linux 32 bit
Version needs section '.gnu.version_r' contains 2 entries:
Addr: 0x0000000000017e0c Offset: 0x017e0c Link: 3 (.dynstr)
000000: Version: 1 File: libgcc_s.so.1 Cnt: 1
0x0010: Name: GCC_3.0 Flags: none Version: 7
Thanks