From cfac305f825dd23035281ac87f72dd2dd3300327 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 14 Oct 2020 12:06:28 +0100 Subject: COMPMID-3599: Fix bare metal compilation issues Newer toolchains don't have support for libssp. Make sure not to compile with -fstack-protector on bare_metal if the compiler version is greater than 7.0.0 Change-Id: I3f4e9496774e138ae13c4a5ec96902c19534a17f Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4154 Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- SConstruct | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index 985f34c6cd..fdb8d5c308 100644 --- a/SConstruct +++ b/SConstruct @@ -25,12 +25,14 @@ import os import subprocess def version_at_least(version, required): - end = min(len(version), len(required)) - for i in range(0, end, 2): - if int(version[i]) < int(required[i]): + version_list = version.split('.') + required_list = required.split('.') + end = min(len(version_list), len(required_list)) + for i in range(0, end): + if int(version_list[i]) < int(required_list[i]): return False - elif int(version[i]) > int(required[i]): + elif int(version_list[i]) > int(required_list[i]): return True return True @@ -283,6 +285,9 @@ if not GetOption("help"): if compiler_ver == '4.8.3': env.Append(CXXFLAGS = ['-Wno-array-bounds']) + if not version_at_least(compiler_ver, '7.0.0') and env['os'] == 'bare_metal': + env.Append(LINKFLAGS = ['-fstack-protector-strong']) + if env['data_type_support']: if any(i in env['data_type_support'] for i in ['all', 'fp16']): env.Append(CXXFLAGS = ['-DENABLE_FP16_KERNELS']) -- cgit v1.2.1