Re: [hatari-devel] Enabling _FORTIFY_SOURCE for Debug builds? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Enabling _FORTIFY_SOURCE for Debug builds?
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sat, 13 Apr 2024 19:53:03 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1713037984; bh=DECY3XXgaKnMiR6j3d5X5fR7cHttmzkUFmVTTDGkRMA=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=jk1sjB/FuA9c/+6RveDsNocrxdxGx9oLRngLxULik0DBCM7Skt+WeC/wVaQRyWzjq 6Vj4nF9B0nX+AZCu0V8WgY8OeHaqjSmU9fahTOGAB9xi1ie+smRLOHAqYF6WpRP2C1 2fbKKnlUaDjnDBSkHuDEajAaENGmT5ceD/PXd+rVdZD2nhsZewfsHkpTI64VEmlNT1 4LAVyN89UOCK0aEVOcdXivjUKviZ+rxDVs7JFnmmfYTvToN7uIunQdNUlXI0Hq4UFf XvMGnz9irfneg8wRADCgHDGS0THS8wmhJY64ruyixm31P96WyejohKSedfI3vairzE 7E/jVRdqHxSMw==
Am Sat, 13 Apr 2024 07:51:44 +0200
schrieb Thorsten Otto <admin@xxxxxxxxxxx>:
> 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"
Weird, I'm using 3.27.7 (on Fedora), and for me, it does not add the -O0
after the -g ... but OK, if there are versions that add -O0 automatically,
it's likely better to remove the -D_FORTIFY_SOURCE again. Done now.
> 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.
Hatari without optimization is no fun at all, that's why it's there. And
-O1 should still be fine with debugging, as far as I can tell. I already
considered -Og in the past, too, but I think that might cause problems with
certain compilers, so it's just "-O" for now which should work OK
everywhere.
Thomas