gcc - Linux 32 bit disassembly has call instructions to next byte -
i'm creating driver 32 , 64 bit linux os. 1 of requirements of code needs self contained no call outs. on 64-bit i've no issues, on 32-bit gcc seems add call instruction next byte. after searching bit found link:
http://forum.soft32.com/linux/strange-problem-disassembling-shared-lib-ftopict439936.html
is there way disable on 32-bit linux?
example: 32 bit disassembly:
<testfunc>: 0: push %ebp 1: mov %esp, %ebp 3: call 4 <test_func+0x4> <...some operation on ebx mentioned in link above>
64 bit disassebmly:
<testfunc>: 0: push %rbp 1: mov %rsp, %rbp 3: <...no call here>
there no call in "testfunc" @ all. why 32-bit compiler adding these "call" instructions? appreciated.
what you're seeing in 32-bit disassembly may way make code position-independent. remember call
pushes onto stack return address, equal eip
+constant? in 64-bit mode there rip
-relative addressing. in 32-bit there isn't. call may simulate instruction-pointer-relative addressing.
Comments
Post a Comment