From 48e1b2c250ec2fcd0b528d4062609c576afe1780 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 10 Mar 2023 09:01:29 +0100 Subject: boot: Add support for -fstack-protector --- meson.build | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index b1521e5937..b575b04dc6 100644 --- a/meson.build +++ b/meson.build @@ -397,7 +397,14 @@ possible_common_cc_flags = [ '-Wno-error=#warnings', # clang '-Wno-string-plus-int', # clang + '-fstack-protector', + '-fstack-protector-strong', '-fstrict-flex-arrays', + '--param=ssp-buffer-size=4', +] + +possible_common_link_flags = [ + '-fstack-protector', ] c_args = get_option('c_args') @@ -432,7 +439,6 @@ possible_link_flags = [ '-Wl,--fatal-warnings', '-Wl,-z,now', '-Wl,-z,relro', - '-fstack-protector', ] if get_option('b_sanitize') == 'none' @@ -459,11 +465,8 @@ possible_cc_flags = [ '-fdiagnostics-show-option', '-fno-common', '-fno-strict-aliasing', - '-fstack-protector', - '-fstack-protector-strong', '-fstrict-flex-arrays=1', '-fvisibility=hidden', - '--param=ssp-buffer-size=4', ] if get_option('buildtype') != 'debug' @@ -486,6 +489,10 @@ add_project_arguments( ), language : 'c') +add_project_link_arguments( + cc.get_supported_link_arguments(possible_common_link_flags), + language : 'c') + userspace_c_args += cc.get_supported_arguments(possible_cc_flags) userspace_c_ld_args += cc.get_supported_link_arguments(possible_link_flags) -- cgit v1.2.1