[gtk-vnc] meson: enable stack protector on freebsd and windows
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] meson: enable stack protector on freebsd and windows
- Date: Wed, 19 Aug 2020 17:57:30 +0000 (UTC)
commit 077b8b22fc1cf5440aad03b84cc84e51466023b0
Author: Daniel P. Berrangé <dan berrange com>
Date: Wed Aug 19 18:56:13 2020 +0100
meson: enable stack protector on freebsd and windows
Fedora 33 rawhide no longer successfully builds GTK-VNC on mingw using
fortify source, without also having stack protector flags enabled/
Signed-off-by: Daniel P. Berrangé <berrange redhat com>
meson.build | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index 79ebb2d..70b9494 100644
--- a/meson.build
+++ b/meson.build
@@ -231,12 +231,6 @@ check_cflags = [
'-Wno-suggest-attribute=pure',
'-Wno-suggest-attribute=const',
]
-if host_machine.system() == 'linux'
- check_cflags += [
- '-fstack-protector-all',
- '--param=ssp-buffer-size=4',
- ]
-endif
cflags = []
foreach cflag: check_cflags
@@ -246,6 +240,21 @@ foreach cflag: check_cflags
endforeach
+if host_machine.system() in [ 'linux', 'freebsd', 'windows' ]
+ # we prefer -fstack-protector-strong but fallback to -fstack-protector-all
+ fstack_cflags = cc.first_supported_argument([
+ '-fstack-protector-strong',
+ '-fstack-protector-all',
+ ])
+ cflags += fstack_cflags
+
+ # When building with mingw using -fstack-protector requires libssp library
+ # which is included by using -fstack-protector with linker.
+ if fstack_cflags.length() == 1 and host_machine.system() == 'windows'
+ add_project_link_arguments(fstack_cflags, language: 'c')
+ endif
+endif
+
add_project_arguments(cflags, language: 'c')
gtk_vnc_prefix = get_option('prefix')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]