Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22310

Why does gcc generates strange code without flag -fno-pie?

$
0
0

I am trying to compile dummy function in gcc with flag -fno-pie and without.

void dummy_test_entrypoint() { }

When i compile without the flag.

gcc -m32 -ffreestanding -c test.c -o test.o

I get the following disassembled code.

00000000 <dummy_test_entrypoint>:0:  55                      push   ebp1:  89 e5                   mov    ebp,esp3:  e8 fc ff ff ff          call   4 <dummy_test_entrypoint+0x4>8:  05 01 00 00 00          add    eax,0x1d:  90                      nope:  5d                      pop    ebpf:  c3                      ret    

When i compile with the flag.

00000000 <dummy_test_entrypoint>:0:  55                      push   ebp1:  89 e5                   mov    ebp,esp3:  90                      nop4:  5d                      pop    ebp5:  c3                      ret 

My question.

What is it???

3:  e8 fc ff ff ff          call   4 <dummy_test_entrypoint+0x4>8:  05 01 00 00 00          add    eax,0x1

Viewing all articles
Browse latest Browse all 22310

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>