Commit 077b8b22 authored by Daniel P. Berrangé's avatar Daniel P. Berrangé

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: default avatarDaniel P. Berrangé <berrange@redhat.com>
parent 974c78f2
......@@ -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')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment