1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-03 05:17:54 +03:00

meson: build everything with PIE

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-24 13:20:40 +02:00
parent 8770571e4d
commit 179797ee05
12 changed files with 1 additions and 60 deletions

View File

@ -180,7 +180,6 @@ fi
# Check for compiler and library settings. # Check for compiler and library settings.
LIBVIRT_COMPILE_WARNINGS LIBVIRT_COMPILE_WARNINGS
LIBVIRT_COMPILE_PIE
LIBVIRT_LINKER_RELRO LIBVIRT_LINKER_RELRO
LIBVIRT_LINKER_NO_INDIRECT LIBVIRT_LINKER_NO_INDIRECT
LIBVIRT_LINKER_NO_UNDEFINED LIBVIRT_LINKER_NO_UNDEFINED

View File

@ -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 <http://www.gnu.org/licenses/>.
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])
])

View File

@ -5,6 +5,7 @@ project(
meson_version: '>= 0.54.0', meson_version: '>= 0.54.0',
default_options: [ default_options: [
'buildtype=debugoptimized', 'buildtype=debugoptimized',
'b_pie=true',
'c_std=gnu99', 'c_std=gnu99',
], ],
) )

View File

@ -617,7 +617,6 @@ libexec_PROGRAMS += libvirt_iohelper
libvirt_iohelper_SOURCES = $(UTIL_IO_HELPER_SOURCES) libvirt_iohelper_SOURCES = $(UTIL_IO_HELPER_SOURCES)
libvirt_iohelper_LDFLAGS = \ libvirt_iohelper_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NULL) $(NULL)
libvirt_iohelper_LDADD = \ libvirt_iohelper_LDADD = \
libvirt.la \ libvirt.la \
@ -629,7 +628,6 @@ endif WITH_DTRACE_PROBES
libvirt_iohelper_CFLAGS = \ libvirt_iohelper_CFLAGS = \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(NULL) $(NULL)

View File

@ -135,12 +135,10 @@ virtlockd_CFLAGS = \
-I$(builddir)/locking \ -I$(builddir)/locking \
-I$(builddir)/rpc \ -I$(builddir)/rpc \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(XDR_CFLAGS) \ $(XDR_CFLAGS) \
$(NULL) $(NULL)
virtlockd_LDFLAGS = \ virtlockd_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(XDR_LIBS) \ $(XDR_LIBS) \
$(NO_UNDEFINED_LDFLAGS) \ $(NO_UNDEFINED_LDFLAGS) \
$(NULL) $(NULL)
@ -187,11 +185,9 @@ libvirt_sanlock_helper_SOURCES = $(LOCK_DRIVER_SANLOCK_HELPER_SOURCES)
libvirt_sanlock_helper_CFLAGS = \ libvirt_sanlock_helper_CFLAGS = \
-I$(srcdir)/conf \ -I$(srcdir)/conf \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(NULL) $(NULL)
libvirt_sanlock_helper_LDFLAGS = \ libvirt_sanlock_helper_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NULL) $(NULL)
libvirt_sanlock_helper_LDADD = \ libvirt_sanlock_helper_LDADD = \
libvirt.la \ libvirt.la \

View File

@ -81,12 +81,10 @@ virtlogd_CFLAGS = \
-I$(builddir)/logging \ -I$(builddir)/logging \
-I$(builddir)/rpc \ -I$(builddir)/rpc \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(XDR_CFLAGS) \ $(XDR_CFLAGS) \
$(NULL) $(NULL)
virtlogd_LDFLAGS = \ virtlogd_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(XDR_LIBS) \ $(XDR_LIBS) \
$(NO_UNDEFINED_LDFLAGS) \ $(NO_UNDEFINED_LDFLAGS) \
$(NULL) $(NULL)

View File

@ -198,7 +198,6 @@ nodist_libvirt_lxc_SOURCES = \
$(NULL) $(NULL)
libvirt_lxc_LDFLAGS = \ libvirt_lxc_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(CAPNG_LIBS) \ $(CAPNG_LIBS) \
$(LIBXML_LIBS) \ $(LIBXML_LIBS) \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
@ -218,7 +217,6 @@ libvirt_lxc_CFLAGS = \
-I$(builddir)/rpc \ -I$(builddir)/rpc \
-I$(srcdir)/hypervisor \ -I$(srcdir)/hypervisor \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(CAPNG_CFLAGS) \ $(CAPNG_CFLAGS) \
$(LIBXML_CFLAGS) \ $(LIBXML_CFLAGS) \
$(GLIB_CFLAGS) \ $(GLIB_CFLAGS) \

View File

@ -126,7 +126,6 @@ libexec_PROGRAMS += libvirt_leaseshelper
libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES) libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES)
libvirt_leaseshelper_LDFLAGS = \ libvirt_leaseshelper_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NULL) $(NULL)
libvirt_leaseshelper_LDADD = \ libvirt_leaseshelper_LDADD = \
libvirt.la \ libvirt.la \
@ -138,7 +137,6 @@ endif WITH_DTRACE_PROBES
libvirt_leaseshelper_CFLAGS = \ libvirt_leaseshelper_CFLAGS = \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(NULL) $(NULL)
INSTALL_DATA_DIRS += network INSTALL_DATA_DIRS += network

View File

@ -41,7 +41,6 @@ REMOTE_DAEMON_CFLAGS = \
$(XDR_CFLAGS) \ $(XDR_CFLAGS) \
$(DBUS_CFLAGS) \ $(DBUS_CFLAGS) \
$(LIBNL_CFLAGS) \ $(LIBNL_CFLAGS) \
$(PIE_CFLAGS) \
-I$(srcdir)/access \ -I$(srcdir)/access \
-I$(builddir)/access \ -I$(builddir)/access \
-I$(srcdir)/conf \ -I$(srcdir)/conf \
@ -52,7 +51,6 @@ REMOTE_DAEMON_CFLAGS = \
REMOTE_DAEMON_LD_FLAGS = \ REMOTE_DAEMON_LD_FLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NO_UNDEFINED_LDFLAGS) \ $(NO_UNDEFINED_LDFLAGS) \
$(NULL) $(NULL)

View File

@ -76,7 +76,6 @@ virt_aa_helper_SOURCES = $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)
virt_aa_helper_LDFLAGS = \ virt_aa_helper_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NULL) $(NULL)
virt_aa_helper_LDADD = \ virt_aa_helper_LDADD = \
libvirt.la \ libvirt.la \
@ -91,7 +90,6 @@ virt_aa_helper_CFLAGS = \
-I$(top_srcdir)/src/hypervisor \ -I$(top_srcdir)/src/hypervisor \
-I$(srcdir)/security \ -I$(srcdir)/security \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(NULL) $(NULL)
endif WITH_LIBVIRTD endif WITH_LIBVIRTD
endif WITH_SECDRIVER_APPARMOR endif WITH_SECDRIVER_APPARMOR

View File

@ -437,7 +437,6 @@ libexec_PROGRAMS += libvirt_parthelper
libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES) libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
libvirt_parthelper_LDFLAGS = \ libvirt_parthelper_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NULL) $(NULL)
libvirt_parthelper_LDADD = \ libvirt_parthelper_LDADD = \
$(LIBPARTED_LIBS) \ $(LIBPARTED_LIBS) \
@ -451,6 +450,5 @@ endif WITH_DTRACE_PROBES
libvirt_parthelper_CFLAGS = \ libvirt_parthelper_CFLAGS = \
$(LIBPARTED_CFLAGS) \ $(LIBPARTED_CFLAGS) \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(NULL) $(NULL)
endif WITH_STORAGE_DISK endif WITH_STORAGE_DISK

View File

@ -31,7 +31,6 @@ STANDALONE_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = \ AM_CFLAGS = \
$(WARN_CFLAGS) \ $(WARN_CFLAGS) \
$(COVERAGE_CFLAGS) \ $(COVERAGE_CFLAGS) \
$(PIE_CFLAGS) \
$(LIBXML_CFLAGS) \ $(LIBXML_CFLAGS) \
$(GLIB_CFLAGS) \ $(GLIB_CFLAGS) \
$(NULL) $(NULL)
@ -92,7 +91,6 @@ libvirt_shell_la_CFLAGS = \
$(NULL) $(NULL)
libvirt_shell_la_LDFLAGS = \ libvirt_shell_la_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(COVERAGE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \
$(NULL) $(NULL)
libvirt_shell_la_LIBADD = \ libvirt_shell_la_LIBADD = \
@ -132,7 +130,6 @@ endif WITH_BHYVE
virt_host_validate_LDFLAGS = \ virt_host_validate_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(COVERAGE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \
$(NULL) $(NULL)
@ -158,7 +155,6 @@ virt_login_shell_helper_SOURCES = \
virt_login_shell_helper_LDFLAGS = \ virt_login_shell_helper_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(COVERAGE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \
$(NULL) $(NULL)
virt_login_shell_helper_LDADD = \ virt_login_shell_helper_LDADD = \
@ -204,7 +200,6 @@ virsh_SOURCES = \
virsh_LDFLAGS = \ virsh_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(COVERAGE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \
$(NULL) $(NULL)
virsh_LDADD = \ virsh_LDADD = \
@ -225,7 +220,6 @@ virt_admin_LDFLAGS = \
$(AM_LDFLAGS) \ $(AM_LDFLAGS) \
$(COVERAGE_LDFLAGS) \ $(COVERAGE_LDFLAGS) \
$(STATIC_BINARIES) \ $(STATIC_BINARIES) \
$(PIE_LDFLAGS) \
$(NULL) $(NULL)
virt_admin_LDADD = \ virt_admin_LDADD = \
../src/libvirt-admin.la \ ../src/libvirt-admin.la \