qemu-kvm/0037-build-system-use-b_sta...

78 lines
3.2 KiB
Diff

From 50b575b27b9daa331da08d10dbe6524de0580833 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Wed, 16 Dec 2020 17:53:08 -0500
Subject: build-system: use b_staticpic=false
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <20201216175308.1463822-3-pbonzini@redhat.com>
Patchwork-id: 100484
O-Subject: [RHEL-AV-8.4.0 qemu-kvm PATCH 2/2] build-system: use b_staticpic=false
Bugzilla: 1899619
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
Meson 0.56.0 correctly builds non-PIC static libraries with -fPIE if
b_pie=true, while Meson 0.55.3 has a bug that causes the library
to use non-PIE objects and fail to link. Therefore, upstream
QEMU looks at the meson version in order to decide between
b_staticpic=false and b_staticpic=$pie.
Unfortunately, b_staticpic=$pie still has a negative effect
on performance when you QEMU is compiled with --enable-pie
like RHEL does. Therefore, we have backported the fix
to Meson 0.55.3-3.el8. We can require it and unconditionally
use b_staticpic=false.
The patch is RHEL-specific, but a similar change is included
in the larger patch for "meson: switch minimum meson version to
0.56.0".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
configure | 5 -----
meson.build | 4 ++--
redhat/qemu-kvm.spec.template | 2 +-
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 18c26e0389..d60097c0d4 100755
--- a/configure
+++ b/configure
@@ -6979,10 +6979,6 @@ fi
mv $cross config-meson.cross
rm -rf meson-private meson-info meson-logs
-unset staticpic
-if ! version_ge "$($meson --version)" 0.56.0; then
- staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi)
-fi
NINJA=$ninja $meson setup \
--prefix "$prefix" \
--libdir "$libdir" \
@@ -7002,7 +6998,6 @@ NINJA=$ninja $meson setup \
-Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
-Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
- ${staticpic:+-Db_staticpic=$staticpic} \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
-Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
diff --git a/meson.build b/meson.build
index 8c38b2ea36..c482d075d5 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('qemu', ['c'], meson_version: '>=0.55.0',
- default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto'] +
- (meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []),
+ default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto',
+ 'b_staticpic=false' ],
version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
not_found = dependency('', required: false)