Re: [hatari-devel] Enabling _FORTIFY_SOURCE for Debug builds? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
On Freitag, 12. April 2024 20:17:47 CEST Thomas Huth wrote:
> So why does this not apply to your build?
Maybe depends on cmake version? (i'm using 3.27.2)
The command line that is executed is
/usr/bin/cc -DCONFDIR=\"/etc\" -I/home/sebilla/atari/hatari/src/includes -I/
home/sebilla/atari/hatari/src/debug -I/home/sebilla/atari/hatari/src/falcon -
I/home/sebilla/atari/hatari/Debug -I/home/sebilla/atari/hatari/src/cpu -I/
home/sebilla/atari/hatari/src/cpu/. -I/home/sebilla/atari/hatari/src/cpu/../..
-I/home/sebilla/atari/hatari/src/cpu/../includes -I/home/sebilla/atari/hatari/
src/cpu/softfloat -I/home/sebilla/atari/hatari/Debug/src/cpu -isystem /usr/
include/SDL2 -O -std=gnu99 -Wcast-qual -Wbad-function-cast -Wpointer-arith -
Wmissing-prototypes -Wstrict-prototypes -Wall -Wwrite-strings -Wsign-compare -
Wformat-security -D_FORTIFY_SOURCE=2 -Wimplicit-fallthrough=2 -Wshadow=local -
D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O0 -Wno-sign-compare -Wno-
unused-variable -Wno-shadow=local -Wno-unused-but-set-variable -MD -MT src/
cpu/CMakeFiles/UaeCpu.dir/cpuemu_11.c.o -MF CMakeFiles/UaeCpu.dir/
cpuemu_11.c.o.d -o CMakeFiles/UaeCpu.dir/cpuemu_11.c.o -c /home/sebilla/atari/
hatari/Debug/src/cpu/cpuemu_11.c
You can see that the "-O" is later overidden by "-O0"
Also, debug builds should IMHO not use any optimization. If you try to debug
such programs in gdb, the code jumps around like made and it is almost
impossible to step through functions.