qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RESEND] osdep: set _FORTIFY_SOURCE=2 when optimization is ena


From: Stefan Hajnoczi
Subject: Re: [PATCH RESEND] osdep: set _FORTIFY_SOURCE=2 when optimization is enabled
Date: Tue, 3 Oct 2023 13:35:40 -0400

On Tue, Oct 03, 2023 at 10:15:49AM +0100, Daniel P. Berrangé wrote:
> 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>
> ---
> 
> Re-sent due to previous bad patch submission
> 
>  include/qemu/osdep.h         |  4 ++++
>  meson.build                  | 10 ----------
>  util/coroutine-sigaltstack.c |  4 ++--
>  util/coroutine-ucontext.c    |  4 ++--
>  4 files changed, 8 insertions(+), 14 deletions(-)

Thanks, applied to my block tree:
https://gitlab.com/stefanha/qemu/commits/block

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]