summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Fontaine <fontaine.fabrice@gmail.com>2021-09-24 17:24:43 +0200
committerFabrice Fontaine <fontaine.fabrice@gmail.com>2021-09-24 22:48:39 +0200
commitdb13ad0206d4362af8ede6371044c32b443d64a2 (patch)
tree35c07651a84fd36d1848c9c8548653aba4abfdbb
parent186c4c7951319031771d69b580420c7a0065a107 (diff)
meson: add stack_protector option
Add stack_protector option to allow the user to disable it as some embedded toolchains don't support it which will result in the following build failure: /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': usbredirparser.c:(.text+0x1c4): undefined reference to `__stack_chk_guard' Fixes: - http://autobuild.buildroot.org/results/40de5443e98157ad50c6841ea70a835cd5ad4fe9 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
-rw-r--r--meson.build8
-rw-r--r--meson_options.txt5
2 files changed, 9 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index a6d21b8..e0311dd 100644
--- a/meson.build
+++ b/meson.build
@@ -15,10 +15,10 @@ cc_flags = [
'--param=ssp-buffer-size=4',
]
if host_machine.system() != 'windows'
- cc_flags += [
- '-Wp,-D_FORTIFY_SOURCE=2',
- '-fstack-protector',
- ]
+ cc_flags += [ '-Wp,-D_FORTIFY_SOURCE=2' ]
+ if not get_option('stack_protector').disabled()
+ cc_flags += [ '-fstack-protector' ]
+ endif
endif
# Check if we are building from .git
diff --git a/meson_options.txt b/meson_options.txt
index 63e8c85..34dd392 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -17,6 +17,11 @@ option('fuzzing-install-dir',
type : 'string',
description : 'Installation directory for fuzzing binaries')
+option('stack_protector',
+ type : 'feature',
+ value : 'enabled',
+ description : 'Build usbredir\'s with stack-protector')
+
option('tools',
type : 'feature',
value : 'enabled',