While executing some tests for -O2 optimization of gcc compilers, I observed the following instruction in disassembled code for a function:
data32 data32 data32 data32 nopw %cs:0x0(%rax,%rax,1)
What does this instruction do?
To be more detailed, I tried to understand how the compiler optimizes useless recursions, such as below, with O2 optimization:
int foo(void) { return foo(); } int main (void) { return foo(); }
The above code causes a stack overflow during compilation without optimization, but works for optimized O2 code.
I think that with O2 he completely removed the foo function stack push, but why do data32 data32 data32 data32 nopw %cs:0x0(%rax,%rax,1) need data32 data32 data32 data32 nopw %cs:0x0(%rax,%rax,1) ?
0000000000400480 <foo>: foo(): 400480: eb fe jmp 400480 <foo> 400482: 66 66 66 66 66 2e 0f data32 data32 data32 data32 nopw %cs:0x0(%rax,%rax,1) 400489: 1f 84 00 00 00 00 00 0000000000400490 <main>: main(): 400490: eb fe jmp 400490 <main>
optimization c assembly gcc x86
cmidi
source share