[compiler-rt] a68ccba - [compiler-rt] Fix COMPILER_RT_OS_DIR for Android

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 16:57:12 PDT 2021


Author: Shoaib Meenai
Date: 2021-07-29T16:52:05-07:00
New Revision: a68ccba77a48494a5200245ddcd085e49a77a2d1

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

LOG: [compiler-rt] Fix COMPILER_RT_OS_DIR for Android

Android has its own CMAKE_SYSTEM_NAME, but the OS is Linux (Android
target triples look like aarch64-none-linux-android21). The driver will
therefore search for compiler-rt libraries in the "linux" directory and
not the "android" directory, so the default placement of Android
compiler-rt libraries was incorrect. You could fix it by specifying
COMPILER_RT_OS_DIR manually, but it also makes sense to fix the default,
to save others from having to discover and fix the issue for themselves.

Added: 
    

Modified: 
    compiler-rt/cmake/base-config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index c11342e68813b..8526252dc93ac 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -100,7 +100,13 @@ function(extend_install_path joined_path current_segment)
 endfunction()
 
 if(NOT DEFINED COMPILER_RT_OS_DIR)
-  string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
+  if(ANDROID)
+    # The CMAKE_SYSTEM_NAME for Android is Android, but the OS is Linux and the
+    # driver will search for compiler-rt libraries in the "linux" directory.
+    set(COMPILER_RT_OS_DIR linux)
+  else()
+    string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
+  endif()
 endif()
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
   set(COMPILER_RT_OUTPUT_LIBRARY_DIR


        


More information about the llvm-commits mailing list