Daniel P. Berrangé 9afa888ce0 osdep: set _FORTIFY_SOURCE=2 when optimization is enabled
Currently we set _FORTIFY_SOURCE=2 as a compiler argument when the
meson 'optimization' setting is non-zero, the compiler is GCC and
the target is Linux.

While the default QEMU optimization level is 2, user could override
this by setting CFLAGS="-O0" or --extra-cflags="-O0" when running
configure and this won't be reflected in the meson 'optimization'
setting. As a result we try to enable _FORTIFY_SOURCE=2 and then the
user gets compile errors as it only works with optimization.

Rather than trying to improve detection in meson, it is simpler to
just check the __OPTIMIZE__ define from osdep.h.

The comment about being incompatible with clang appears to be
outdated, as compilation works fine without excluding clang.

In the coroutine code we must set _FORTIFY_SOURCE=0 to stop the
logic in osdep.h then enabling it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20231003091549.223020-1-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2023-10-04 09:52:06 -04:00
..
2023-05-30 17:37:26 +02:00
2023-03-20 12:43:50 +01:00
2023-08-31 19:47:43 +02:00
2023-05-23 15:20:15 +08:00
2020-01-06 18:41:32 +04:00
2023-03-20 12:43:50 +01:00
2023-09-07 20:32:11 -05:00
2022-04-21 17:03:51 +04:00
2023-06-13 17:42:01 +10:00
2023-08-31 19:47:43 +02:00
2019-09-11 08:46:17 +02:00
2023-04-24 11:29:00 +02:00
2020-12-10 17:16:44 +01:00
2023-08-31 19:47:43 +02:00
2022-06-29 10:56:12 +03:00
2023-08-31 19:47:43 +02:00
2018-12-20 10:29:08 +01:00
2023-02-02 11:48:20 +00:00
2023-03-28 15:23:10 -07:00
2023-08-31 19:47:43 +02:00
2023-04-27 16:39:43 +02:00
2018-08-24 20:26:37 +02:00
2021-04-01 15:27:44 +04:00