GCC optimization removing my function call
Posted: Fri Nov 18, 2022 3:20 pm
Hello, somehow gcc removes my puts function from my code when optimizing, anyone knows why?
main.c: https://github.com/cheyao/AsmOS/blob/master/lib/main.c
You can also see from the elf file disasembly that the third call (puts) is gone
With -O0 https://github.com/cheyao/AsmOS/blob/master/O0.dis
With -O1 https://github.com/cheyao/AsmOS/blob/master/O1.dis
The only thing i changed that may effect this is changed "" to <> include brackets (and changed the file's directories but that shouldn't effect it)
main.c: https://github.com/cheyao/AsmOS/blob/master/lib/main.c
You can also see from the elf file disasembly that the third call (puts) is gone
With -O0 https://github.com/cheyao/AsmOS/blob/master/O0.dis
With -O1 https://github.com/cheyao/AsmOS/blob/master/O1.dis
The only thing i changed that may effect this is changed "" to <> include brackets (and changed the file's directories but that shouldn't effect it)