BOOL32 doStuff() { return TRUE; }
gcc 2.95 for vxworks 5.x by compiling the above code with -O0 for the 32-bit x86 generated by the following code:
doStuff: 0e9de190: push %ebp 0e9de191: mov %esp,%ebp 308 return TRUE; 0e9de193: mov $0x1,%eax 0e9de198: jmp 0xe9de1a0 <doStuff+16> 312 { 0e9de19a: lea 0x0(%esi),%esi // The JMP jumps here 0e9de1a0: mov %ebp,%esp 0e9de1a2: pop %ebp 0e9de1a3: ret
Everything looks fine before the JMP and LEA commands. What are they needed for?
I suppose this is some kind of alignment, but I'm not sure about that.
I would do something like this:
doStuff: 0e9de190: push %ebp 0e9de191: mov %esp,%ebp 308 return TRUE; 0e9de193: mov $0x1,%eax 0e9de1XX: mov %ebp,%esp 0e9de1XX: pop %ebp 0e9de1XX: ret 0e9de1XX: fill with lea 0x0, %esi
source share