From 179797ee059391df832a9ce58d8a63235a208d70 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Wed, 24 Jun 2020 13:20:40 +0200 Subject: [PATCH] meson: build everything with PIE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Hrdina Reviewed-by: Ján Tomko Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- configure.ac | 1 - m4/virt-compile-pie.m4 | 35 ----------------------------------- meson.build | 1 + src/Makefile.am | 2 -- src/locking/Makefile.inc.am | 4 ---- src/logging/Makefile.inc.am | 2 -- src/lxc/Makefile.inc.am | 2 -- src/network/Makefile.inc.am | 2 -- src/remote/Makefile.inc.am | 2 -- src/security/Makefile.inc.am | 2 -- src/storage/Makefile.inc.am | 2 -- tools/Makefile.am | 6 ------ 12 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 m4/virt-compile-pie.m4 diff --git a/configure.ac b/configure.ac index 64725b6af7..cda488308e 100644 --- a/configure.ac +++ b/configure.ac @@ -180,7 +180,6 @@ fi # Check for compiler and library settings. LIBVIRT_COMPILE_WARNINGS -LIBVIRT_COMPILE_PIE LIBVIRT_LINKER_RELRO LIBVIRT_LINKER_NO_INDIRECT LIBVIRT_LINKER_NO_UNDEFINED diff --git a/m4/virt-compile-pie.m4 b/m4/virt-compile-pie.m4 deleted file mode 100644 index da5cdf57b7..0000000000 --- a/m4/virt-compile-pie.m4 +++ /dev/null @@ -1,35 +0,0 @@ -dnl -dnl Check for support for position independent executables -dnl -dnl Copyright (C) 2013 Red Hat, Inc. -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License, or (at your option) any later version. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see -dnl . -dnl - -AC_DEFUN([LIBVIRT_COMPILE_PIE],[ - PIE_CFLAGS= - PIE_LDFLAGS= - case "$host" in - *-*-mingw* ) - ;; dnl All code is position independent on Win32 target - *) - gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [ - PIE_CFLAGS="-fPIE -DPIE" - PIE_LDFLAGS="-pie" - ]) - esac - AC_SUBST([PIE_CFLAGS]) - AC_SUBST([PIE_LDFLAGS]) -]) diff --git a/meson.build b/meson.build index ea2590ac8f..54e6c1732e 100644 --- a/meson.build +++ b/meson.build @@ -5,6 +5,7 @@ project( meson_version: '>= 0.54.0', default_options: [ 'buildtype=debugoptimized', + 'b_pie=true', 'c_std=gnu99', ], ) diff --git a/src/Makefile.am b/src/Makefile.am index 390e784c67..c3738c87fe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -617,7 +617,6 @@ libexec_PROGRAMS += libvirt_iohelper libvirt_iohelper_SOURCES = $(UTIL_IO_HELPER_SOURCES) libvirt_iohelper_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(NULL) libvirt_iohelper_LDADD = \ libvirt.la \ @@ -629,7 +628,6 @@ endif WITH_DTRACE_PROBES libvirt_iohelper_CFLAGS = \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(NULL) diff --git a/src/locking/Makefile.inc.am b/src/locking/Makefile.inc.am index c8247508eb..476a8521c0 100644 --- a/src/locking/Makefile.inc.am +++ b/src/locking/Makefile.inc.am @@ -135,12 +135,10 @@ virtlockd_CFLAGS = \ -I$(builddir)/locking \ -I$(builddir)/rpc \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(XDR_CFLAGS) \ $(NULL) virtlockd_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(XDR_LIBS) \ $(NO_UNDEFINED_LDFLAGS) \ $(NULL) @@ -187,11 +185,9 @@ libvirt_sanlock_helper_SOURCES = $(LOCK_DRIVER_SANLOCK_HELPER_SOURCES) libvirt_sanlock_helper_CFLAGS = \ -I$(srcdir)/conf \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(NULL) libvirt_sanlock_helper_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(NULL) libvirt_sanlock_helper_LDADD = \ libvirt.la \ diff --git a/src/logging/Makefile.inc.am b/src/logging/Makefile.inc.am index 2194b8cac5..133b52f3a9 100644 --- a/src/logging/Makefile.inc.am +++ b/src/logging/Makefile.inc.am @@ -81,12 +81,10 @@ virtlogd_CFLAGS = \ -I$(builddir)/logging \ -I$(builddir)/rpc \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(XDR_CFLAGS) \ $(NULL) virtlogd_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(XDR_LIBS) \ $(NO_UNDEFINED_LDFLAGS) \ $(NULL) diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am index ad4c779c15..1154999ae5 100644 --- a/src/lxc/Makefile.inc.am +++ b/src/lxc/Makefile.inc.am @@ -198,7 +198,6 @@ nodist_libvirt_lxc_SOURCES = \ $(NULL) libvirt_lxc_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(CAPNG_LIBS) \ $(LIBXML_LIBS) \ $(GLIB_LIBS) \ @@ -218,7 +217,6 @@ libvirt_lxc_CFLAGS = \ -I$(builddir)/rpc \ -I$(srcdir)/hypervisor \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(CAPNG_CFLAGS) \ $(LIBXML_CFLAGS) \ $(GLIB_CFLAGS) \ diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am index 9a1a371707..5a5d1630a0 100644 --- a/src/network/Makefile.inc.am +++ b/src/network/Makefile.inc.am @@ -126,7 +126,6 @@ libexec_PROGRAMS += libvirt_leaseshelper libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES) libvirt_leaseshelper_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(NULL) libvirt_leaseshelper_LDADD = \ libvirt.la \ @@ -138,7 +137,6 @@ endif WITH_DTRACE_PROBES libvirt_leaseshelper_CFLAGS = \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(NULL) INSTALL_DATA_DIRS += network diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index 572f16be05..631b974463 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -41,7 +41,6 @@ REMOTE_DAEMON_CFLAGS = \ $(XDR_CFLAGS) \ $(DBUS_CFLAGS) \ $(LIBNL_CFLAGS) \ - $(PIE_CFLAGS) \ -I$(srcdir)/access \ -I$(builddir)/access \ -I$(srcdir)/conf \ @@ -52,7 +51,6 @@ REMOTE_DAEMON_CFLAGS = \ REMOTE_DAEMON_LD_FLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(NO_UNDEFINED_LDFLAGS) \ $(NULL) diff --git a/src/security/Makefile.inc.am b/src/security/Makefile.inc.am index 02b67dc70f..ec0bb5f569 100644 --- a/src/security/Makefile.inc.am +++ b/src/security/Makefile.inc.am @@ -76,7 +76,6 @@ virt_aa_helper_SOURCES = $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES) virt_aa_helper_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(NULL) virt_aa_helper_LDADD = \ libvirt.la \ @@ -91,7 +90,6 @@ virt_aa_helper_CFLAGS = \ -I$(top_srcdir)/src/hypervisor \ -I$(srcdir)/security \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(NULL) endif WITH_LIBVIRTD endif WITH_SECDRIVER_APPARMOR diff --git a/src/storage/Makefile.inc.am b/src/storage/Makefile.inc.am index 43010ee966..e201b9938d 100644 --- a/src/storage/Makefile.inc.am +++ b/src/storage/Makefile.inc.am @@ -437,7 +437,6 @@ libexec_PROGRAMS += libvirt_parthelper libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES) libvirt_parthelper_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(NULL) libvirt_parthelper_LDADD = \ $(LIBPARTED_LIBS) \ @@ -451,6 +450,5 @@ endif WITH_DTRACE_PROBES libvirt_parthelper_CFLAGS = \ $(LIBPARTED_CFLAGS) \ $(AM_CFLAGS) \ - $(PIE_CFLAGS) \ $(NULL) endif WITH_STORAGE_DISK diff --git a/tools/Makefile.am b/tools/Makefile.am index d6eedbe9d5..34046817bd 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -31,7 +31,6 @@ STANDALONE_CPPFLAGS = -I$(top_srcdir) AM_CFLAGS = \ $(WARN_CFLAGS) \ $(COVERAGE_CFLAGS) \ - $(PIE_CFLAGS) \ $(LIBXML_CFLAGS) \ $(GLIB_CFLAGS) \ $(NULL) @@ -92,7 +91,6 @@ libvirt_shell_la_CFLAGS = \ $(NULL) libvirt_shell_la_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \ $(NULL) libvirt_shell_la_LIBADD = \ @@ -132,7 +130,6 @@ endif WITH_BHYVE virt_host_validate_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \ $(NULL) @@ -158,7 +155,6 @@ virt_login_shell_helper_SOURCES = \ virt_login_shell_helper_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \ $(NULL) virt_login_shell_helper_LDADD = \ @@ -204,7 +200,6 @@ virsh_SOURCES = \ virsh_LDFLAGS = \ $(AM_LDFLAGS) \ - $(PIE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \ $(NULL) virsh_LDADD = \ @@ -225,7 +220,6 @@ virt_admin_LDFLAGS = \ $(AM_LDFLAGS) \ $(COVERAGE_LDFLAGS) \ $(STATIC_BINARIES) \ - $(PIE_LDFLAGS) \ $(NULL) virt_admin_LDADD = \ ../src/libvirt-admin.la \