1*4882a593SmuzhiyunFrom 54cf1897ef3aa4d0a35b5f4eb1f5c6928b033af5 Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3*4882a593SmuzhiyunDate: Fri, 24 Sep 2021 17:24:43 +0200 4*4882a593SmuzhiyunSubject: [PATCH] meson: add stack_protector option 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunAdd stack_protector option to allow the user to disable it as some 7*4882a593Smuzhiyunembedded toolchains don't support it which will result in the following 8*4882a593Smuzhiyunbuild failure: 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun/home/giuliobenetti/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/9.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: usbredirparser/libusbredirparser.so.1.1.0.p/usbredirparser.c.o: in function `va_log': 11*4882a593Smuzhiyunusbredirparser.c:(.text+0x1c4): undefined reference to `__stack_chk_guard' 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunFixes: 14*4882a593Smuzhiyun - http://autobuild.buildroot.org/results/40de5443e98157ad50c6841ea70a835cd5ad4fe9 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 17*4882a593Smuzhiyun[Upstream status: 18*4882a593Smuzhiyunhttps://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/53] 19*4882a593Smuzhiyun--- 20*4882a593Smuzhiyun meson.build | 6 +++++- 21*4882a593Smuzhiyun meson_options.txt | 5 +++++ 22*4882a593Smuzhiyun 2 files changed, 10 insertions(+), 1 deletion(-) 23*4882a593Smuzhiyun 24*4882a593Smuzhiyundiff --git a/meson.build b/meson.build 25*4882a593Smuzhiyunindex a6d21b8..4350f53 100644 26*4882a593Smuzhiyun--- a/meson.build 27*4882a593Smuzhiyun+++ b/meson.build 28*4882a593Smuzhiyun@@ -17,8 +17,12 @@ cc_flags = [ 29*4882a593Smuzhiyun if host_machine.system() != 'windows' 30*4882a593Smuzhiyun cc_flags += [ 31*4882a593Smuzhiyun '-Wp,-D_FORTIFY_SOURCE=2', 32*4882a593Smuzhiyun- '-fstack-protector', 33*4882a593Smuzhiyun ] 34*4882a593Smuzhiyun+ if get_option('stack_protector').enabled() 35*4882a593Smuzhiyun+ cc_flags += [ 36*4882a593Smuzhiyun+ '-fstack-protector', 37*4882a593Smuzhiyun+ ] 38*4882a593Smuzhiyun+ endif 39*4882a593Smuzhiyun endif 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun # Check if we are building from .git 42*4882a593Smuzhiyundiff --git a/meson_options.txt b/meson_options.txt 43*4882a593Smuzhiyunindex 63e8c85..34dd392 100644 44*4882a593Smuzhiyun--- a/meson_options.txt 45*4882a593Smuzhiyun+++ b/meson_options.txt 46*4882a593Smuzhiyun@@ -17,6 +17,11 @@ option('fuzzing-install-dir', 47*4882a593Smuzhiyun type : 'string', 48*4882a593Smuzhiyun description : 'Installation directory for fuzzing binaries') 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun+option('stack_protector', 51*4882a593Smuzhiyun+ type : 'feature', 52*4882a593Smuzhiyun+ value : 'enabled', 53*4882a593Smuzhiyun+ description : 'Build usbredir\'s with stack-protector') 54*4882a593Smuzhiyun+ 55*4882a593Smuzhiyun option('tools', 56*4882a593Smuzhiyun type : 'feature', 57*4882a593Smuzhiyun value : 'enabled', 58*4882a593Smuzhiyun-- 59*4882a593Smuzhiyun2.33.0 60*4882a593Smuzhiyun 61