From 6a9e801743b85706177b01e1ffb31320222c4378 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Fri, 7 Feb 2020 09:45:55 +0000 Subject: COMPMID-3830: Support baremetal with gcc7+ Change-Id: I987a1c6b87419a10dd85ecd7f71baad416d359e1 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4139 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Sang-Hoon Park --- examples/SConscript | 10 +++++++--- tests/SConscript | 8 +++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/SConscript b/examples/SConscript index dc0d3e9655..cd07c6a15a 100644 --- a/examples/SConscript +++ b/examples/SConscript @@ -48,6 +48,10 @@ else: arm_compute_dependency = arm_compute_so graph_dependency = [arm_compute_graph_so] +extra_link_flags = [] +if env['os'] != 'bare_metal': + extra_link_flags += ['-fstack-protector-strong'] + # Build graph examples graph_utils = examples_env.Object("../utils/GraphUtils.cpp") graph_utils += examples_env.Object("../utils/CommonGraphOptions.cpp") @@ -57,7 +61,7 @@ for file in Glob("./graph_*.cpp"): prog = None if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive', '-fstack-protector-strong']) + prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'] + extra_link_flags) Depends(prog, graph_dependency) prog = install_bin(prog) else: @@ -109,7 +113,7 @@ if env['neon']: prog = None if env['os'] in ['bare_metal']: - prog = examples_env.Program(example, ["{}.cpp".format(example), utils], LINKFLAGS=examples_env["LINKFLAGS"]+['-fstack-protector'], LIBS = examples_libs + arm_compute_libs) + prog = examples_env.Program(example, ["{}.cpp".format(example), utils], LINKFLAGS=examples_env["LINKFLAGS"], LIBS = examples_libs + arm_compute_libs) else: prog = examples_env.Program(example, ["{}.cpp".format(example), utils], LIBS = examples_libs + arm_compute_libs) @@ -133,7 +137,7 @@ for file in Glob("#3rdparty/examples/graph_*.cpp"): prog = None if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = examples_env.Program(example, [examples_env.Object(source=file, target=example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive', '-fstack-protector-strong']) + prog = examples_env.Program(example, [examples_env.Object(source=file, target=example), utils, graph_utils], LIBS = examples_libs + arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'] + extra_link_flags) Depends(prog, graph_dependency) prog = install_bin(prog) else: diff --git a/tests/SConscript b/tests/SConscript index 9e6c78d8c5..6fc67af747 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -154,10 +154,12 @@ if env['gles_compute']: files_validation += Glob('validation/GLES_COMPUTE/*/*.cpp') files_validation += Glob('validation/GLES_COMPUTE/*.cpp') +extra_link_flags = [] if env['os'] == 'android': test_env.Append(LIBS = ["log"]) elif env['os'] != 'bare_metal': test_env.Append(LIBS = ["rt"]) + extra_link_flags += ['-fstack-protector-strong'] if test_env['benchmark_tests']: arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects) @@ -167,7 +169,7 @@ if test_env['benchmark_tests']: Default(arm_compute_benchmark) Export('arm_compute_benchmark') -bm_link_flags = ['-fstack-protector-strong'] +bm_link_flags = [] if test_env['linker_script']: bm_link_flags += ['-Wl,--build-id=none', '-T', env['linker_script']] @@ -219,7 +221,7 @@ if test_env['validation_tests']: for file in Glob("validate_examples/graph_*.cpp"): example = "validate_" + os.path.basename(os.path.splitext(str(file))[0]) if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',arm_compute_lib,'-Wl,--no-whole-archive'] + bm_link_flags) + prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',arm_compute_lib,'-Wl,--no-whole-archive'] + bm_link_flags + extra_link_flags) arm_compute_validate_examples += [ prog ] else: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies @@ -268,7 +270,7 @@ if test_env['benchmark_examples']: for file in Glob("%s/graph_*.cpp" % examples_folder ): example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0]) if env['os'] in ['android', 'bare_metal'] or env['standalone']: - prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',arm_compute_lib,'-Wl,--no-whole-archive'] + bm_link_flags) + prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',arm_compute_lib,'-Wl,--no-whole-archive'] + bm_link_flags + extra_link_flags) arm_compute_benchmark_examples += [ prog ] else: #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies -- cgit v1.2.1