packaging: configure QEMU with -O2

Currently the the configure-hypervisor.sh doesn't set any optimization flag when
compiling QEMU >= 5.2.0 since the configure script will implicitly set -O2 on Ubuntu. But
on other environments, for example CentOS 7, it won't be set any optimization and this
results on the compiler warn:

  # warning _FORTIFY_SOURCE requires compiling with optimization (-O)

To avoid this inconsistent behavior across different build environments, let's explicitly
set the -O2 flag.

Reported-by: Eric Ernst <eric.g.ernst@gmail.com>
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
Wainer dos Santos Moschetta 2021-03-08 17:07:17 -03:00
parent 224c50f420
commit 0f7950fb2a

View File

@ -474,6 +474,8 @@ generate_qemu_options() {
# On version 5.2.0 onward the Meson build system warns to not use -O3
if ! gt_eq "${qemu_version}" "5.2.0" ; then
_qemu_cflags+=" -O3"
else
_qemu_cflags+=" -O2"
fi
# Improve code quality by assuming identical semantics for interposed