From 0f7950fb2a9e8c9c3014da2f1ada1883e5ea0ad3 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Mon, 8 Mar 2021 17:07:17 -0300 Subject: [PATCH] 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 Signed-off-by: Wainer dos Santos Moschetta --- tools/packaging/scripts/configure-hypervisor.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/packaging/scripts/configure-hypervisor.sh b/tools/packaging/scripts/configure-hypervisor.sh index a7fa127eb..c1df82e37 100755 --- a/tools/packaging/scripts/configure-hypervisor.sh +++ b/tools/packaging/scripts/configure-hypervisor.sh @@ -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