Skip to content

Commit 8d5b98e

Browse files
committed
Create a custom config for LLVM libc
Since LLVM libc lacks an AArch64 config, LIBC_CONFIG_PATH is set to the arm subdirectory to force it to use the existing AArch32 config. However, this has the side effect of never loading the generic baremetal config.json file, which is instead in the parent directory. In order to combine the entrypoints in the arm config with the values set in the generic baremetal config, this patch copies both to the same location to be used in the build.
1 parent 7d96754 commit 8d5b98e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,19 @@ if(LLVM_TOOLCHAIN_C_LIBRARY STREQUAL llvmlibc)
392392
# find one for every libc type. We have no current setup to run the LLVM
393393
# libc test suite.
394394
add_custom_target(check-llvmlibc)
395+
396+
# LLVM libc lacks a configuration for AArch64, but the AArch32 one works
397+
# fine. However, setting the configuration for both architectures to the
398+
# arm config directory means the baremetal config.json is never loaded,
399+
# as it resides in the directory above. To ensure both are used, copy
400+
# them to the same location and point libc to that.
401+
set(LIBC_CFG_DIR ${CMAKE_BINARY_DIR}/llvmlibc-config)
402+
file(COPY
403+
${llvmproject_SOURCE_DIR}/libc/config/baremetal/config.json
404+
${llvmproject_SOURCE_DIR}/libc/config/baremetal/arm/.
405+
DESTINATION
406+
${LIBC_CFG_DIR}
407+
)
395408
endif()
396409

397410
add_subdirectory(
@@ -911,7 +924,7 @@ function(
911924
${common_cmake_args}
912925
-DLIBC_TARGET_TRIPLE=${target_triple}
913926
-DLIBC_HDRGEN_EXE=${LIBC_HDRGEN}
914-
-DLIBC_CONFIG_PATH=${llvmproject_SOURCE_DIR}/libc/config/baremetal/arm # llvmlibc has no AArch64 bare-metal configuration, but the AArch32 one is fine
927+
-DLIBC_CONFIG_PATH=${LIBC_CFG_DIR}
915928
-DLIBC_CONF_TIME_64BIT=ON
916929
-DLLVM_CMAKE_DIR=${LLVM_BINARY_DIR}/lib/cmake/llvm
917930
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON

0 commit comments

Comments
 (0)