[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
This commit is contained in:
Siva Chandra Reddy 2021-06-29 20:27:28 +00:00
parent 9952d591cc
commit 58af0d567d
1 changed files with 14 additions and 2 deletions

View File

@ -77,8 +77,20 @@ include(CMakeParseArguments)
include(LLVMLibCRules) include(LLVMLibCRules)
include(LLVMLibCCheckCpuFeatures) include(LLVMLibCCheckCpuFeatures)
include("${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/${LIBC_TARGET_ARCHITECTURE}/entrypoints.txt") if(EXISTS "${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") 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 "") set(TARGET_ENTRYPOINT_NAME_LIST "")
foreach(entrypoint IN LISTS TARGET_LLVMLIBC_ENTRYPOINTS) foreach(entrypoint IN LISTS TARGET_LLVMLIBC_ENTRYPOINTS)