[compiler-rt] e51631c - [sanitizer] Fix Android API level parsing on arm

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 14 01:55:00 PST 2020


Author: Vitaly Buka
Date: 2020-11-14T01:54:45-08:00
New Revision: e51631ca4cf461510019d5fc950eacb2fe45eb48

URL: https://github.com/llvm/llvm-project/commit/e51631ca4cf461510019d5fc950eacb2fe45eb48
DIFF: https://github.com/llvm/llvm-project/commit/e51631ca4cf461510019d5fc950eacb2fe45eb48.diff

LOG: [sanitizer] Fix Android API level parsing on arm

Added: 
    

Modified: 
    compiler-rt/CMakeLists.txt
    compiler-rt/test/lit.common.cfg.py
    compiler-rt/test/lit.common.configured.in

Removed: 
    


################################################################################
diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 1314d26e8504..7d99d3860381 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -121,7 +121,7 @@ if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
 endif()
 if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*")
   set(ANDROID 1)
-  string(REGEX MATCH "-target(=| +)[^ ]+android([0-9]+)" ANDROID_API_LEVEL "${CMAKE_C_FLAGS}")
+  string(REGEX MATCH "-target(=| +)[^ ]+android[a-z]*([0-9]+)" ANDROID_API_LEVEL "${CMAKE_C_FLAGS}")
   set(ANDROID_API_LEVEL ${CMAKE_MATCH_2})
 endif()
 pythonize_bool(ANDROID)

diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 6c913c89ee5c..ab2cfe822548 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -362,6 +362,7 @@ def get_macos_aligned_version(macos_vers):
     android_api_level = int(android_api_level_str)
   except ValueError:
     lit_config.fatal("Failed to read ro.build.version.sdk (using '%s' as adb): got '%s'" % (adb, android_api_level_str))
+  android_api_level = min(android_api_level, int(config.android_api_level))
   if android_api_level >= 26:
     config.available_features.add('android-26')
   if android_api_level >= 28:

diff  --git a/compiler-rt/test/lit.common.configured.in b/compiler-rt/test/lit.common.configured.in
index 4721b4b8beef..5653bcd90caa 100644
--- a/compiler-rt/test/lit.common.configured.in
+++ b/compiler-rt/test/lit.common.configured.in
@@ -40,6 +40,7 @@ set_default("use_thinlto", False)
 set_default("use_lto", config.use_thinlto)
 set_default("use_newpm", False)
 set_default("android", @ANDROID_PYBOOL@)
+set_default("android_api_level", "@ANDROID_API_LEVEL@")
 set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
 set_default("android_files_to_push", [])
 set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)


        


More information about the llvm-commits mailing list