From bf5274d1cbc2ba592b3990c40065e3c843075252 Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Wed, 20 Jul 2022 17:45:36 +0100 Subject: =?UTF-8?q?Enable=20integrated=20assembler=20for=20Android?= =?UTF-8?q?=E2=84=A2=2013=20and=20onwards=20only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Androidâ„¢ 13, the underlying NDK has deprecated system assembler and favors integrated assembler instead Please also see https://github.com/android/ndk/wiki/Changelog-r23 Resolves COMPMID-5410 Signed-off-by: SiCong Li Change-Id: Ib9fa8a22f6cdb5cb4f0095e15bf332484f709630 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7956 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir Reviewed-by: Ramy Elgammal Comments-Addressed: Arm Jenkins --- SConstruct | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index 7f0ebc1a0b..9e046161ac 100644 --- a/SConstruct +++ b/SConstruct @@ -426,12 +426,21 @@ if not GetOption("help"): if not version_at_least(compiler_ver, '7.0.0') and env['os'] == 'bare_metal': env.Append(LINKFLAGS = ['-fstack-protector-strong']) - # For NDK >= r21, clang 9 or above is used - if env['os'] == 'android' and version_at_least(compiler_ver, '9.0.0'): - env['ndk_above_r21'] = True - - if env['openmp']: - env.Append(LINKFLAGS = ['-static-openmp']) + # Add Android NDK toolchain specific flags + if 'clang++' in cpp_compiler and env['os'] == 'android': + # For NDK >= r21, clang 9 or above is used + if version_at_least(compiler_ver, '9.0.0'): + env['ndk_above_r21'] = True + + if env['openmp']: + env.Append(LINKFLAGS = ['-static-openmp']) + + # For NDK >= r23, clang 12 or above is used. This condition detects NDK < r23 + if not version_at_least(compiler_ver, '12.0.0'): + # System assembler is deprecated and integrated assembler is preferred since r23. + # However integrated assembler has always been suppressed for NDK < r23. + # Thus for backward compatibility, we include this flag only for NDK < r23 + env.Append(CXXFLAGS = ['-no-integrated-as']) if env['high_priority'] and env['build_config']: print("The high priority library cannot be built in conjunction with a user-specified build configuration") -- cgit v1.2.1