While reversing a 32bit Mach-O binary with Hopper, I noticed this peculiar method. The instruction on 0x0000e506 seems to be calling an address right below the instruction. What would be the reason for this? Is it some kind of register cleaning trickery? 
What is the reason for this method to call itself?
obfuscation;x86;assembly;hopper
This is for position independent code. The call 0xe50b instruction pushes the address of the next instruction, and then jumps. It jumps to the immediately following instruction, which has no effect. The next instruction, pop eax, loads its own address into eax (as it was the value pushed by call).Further down it uses an offset from eax:mov eax, dword [ds:eax-0xe50b+objc_msg_close]The value being subtracted, 0xe50b, is the address that we moved into eax. If the code hasn't been moved anywhere, eax-0xe50b will be zero, but if the code has been moved to a different location, it will be the offset. We then add the address objc_msg_close, so we'll be able to reference it, even if the code has been moved in memory.Hopper is actually being quite clever about it, because the instruction just says (from ndisasm):mov eax,[eax+0x45fe75]but Hopper knows that eax contains the value of the instruction pointer at 0xe50b, so uses that offset to find the symbol for you.