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: Richard Henderson
Subject: Re: [PATCH RESEND] osdep: set _FORTIFY_SOURCE=2 when optimization is enabled
Date: Tue, 3 Oct 2023 07:03:00 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

On 10/3/23 02:15, 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(-)

I agree this is better than the meson fragment.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



reply via email to

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