[libc-commits] [libc] 58af0d5 - [libc] Allow target architecture independent configs

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Jun 29 13:41:52 PDT 2021


Author: Siva Chandra Reddy
Date: 2021-06-29T20:41:28Z
New Revision: 58af0d567d88eb5a7eec436886da066308d7a39e

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

LOG: [libc] Allow target architecture independent configs

Previously, we required entrypoints.txt for every target architecture
supported by a target OS. With this change, we allow architecture
independent config for a target OS. That is, if an architecture specific
entrypoints.txt is missing, then a generic entrypoints.txt for that
target OS will be used.

Reviewed By: caitlyncano

Differential Revision: https://reviews.llvm.org/D105147

Added: 
    

Modified: 
    libc/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 30ffa35111db9..5f891510fbb5a 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -77,8 +77,20 @@ include(CMakeParseArguments)
 include(LLVMLibCRules)
 include(LLVMLibCCheckCpuFeatures)
 
-include("${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/entrypoints.txt")
-include("${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/headers.txt")
+if(EXISTS "${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/entrypoints.txt")
+  set(entrypoint_file "${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/entrypoints.txt")
+elseif(EXISTS "${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/entrypoints.txt")
+  set(entrypoint_file "${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/entrypoints.txt")
+else()
+  message(FATAL_ERROR "entrypoints.txt file for the target platform not found.")
+endif()
+include(${entrypoint_file})
+
+if(EXISTS "${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/headers.txt")
+  include("${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/headers.txt")
+elseif(EXISTS "${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/headers.txt")
+  include("${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}//headers.txt")
+endif()
 
 set(TARGET_ENTRYPOINT_NAME_LIST "")
 foreach(entrypoint IN LISTS TARGET_LLVMLIBC_ENTRYPOINTS)


        


More information about the libc-commits mailing list