Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-libc build: remove all references to libc-hdrgen. #629

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,25 +336,6 @@ if(LLVM_TOOLCHAIN_C_LIBRARY STREQUAL llvmlibc)
COMPONENT llvm-toolchain-llvmlibc-configs
)

# We need to build libc-hdrgen
ExternalProject_Add(
libc_hdrgen
SOURCE_DIR ${llvmproject_SOURCE_DIR}/llvm
DEPENDS ${lib_tool_dependencies}
CMAKE_ARGS
-DLLVM_ENABLE_RUNTIMES=libc
-DLLVM_LIBC_FULL_BUILD=ON
-DCMAKE_BUILD_TYPE=Debug
STEP_TARGETS build install
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target libc-hdrgen
INSTALL_COMMAND ${CMAKE_COMMAND} -E true
# Always run the build command so that incremental builds are correct.
BUILD_ALWAYS TRUE
CONFIGURE_HANDLED_BY_BUILD TRUE
)
ExternalProject_Get_property(libc_hdrgen BINARY_DIR)
set(LIBC_HDRGEN ${BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})

# LLVM libc lacks a configuration for AArch64, but the AArch32 one works
# fine. However, setting the configuration for both architectures to the
# arm config directory means the baremetal config.json is never loaded,
Expand Down Expand Up @@ -599,7 +580,6 @@ if(NOT PREBUILT_TARGET_LIBRARIES)
-DLLVM_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/llvm
-DMULTILIB_JSON=${LLVM_TOOLCHAIN_MULTILIB_JSON}
-DENABLE_VARIANTS=${ENABLE_VARIANTS_PASSTHROUGH}
-DLIBC_HDRGEN=${LIBC_HDRGEN}
-DFVP_INSTALL_DIR=${FVP_INSTALL_DIR}
-DENABLE_QEMU_TESTING=${ENABLE_QEMU_TESTING}
-DENABLE_FVP_TESTING=${ENABLE_FVP_TESTING}
Expand Down
27 changes: 0 additions & 27 deletions arm-multilib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ set(ENABLE_VARIANTS "all" CACHE STRING "Semicolon separated list of variants to
set(C_LIBRARY "picolibc" CACHE STRING "Which C library to use.")
set_property(CACHE C_LIBRARY PROPERTY STRINGS picolibc newlib llvmlibc)
set(LLVM_BINARY_DIR "" CACHE PATH "Path to LLVM toolchain build or install root.")
set(LIBC_HDRGEN "" CACHE PATH "Path to prebuilt lbc-hdrgen if not included in LLVM binaries set by LLVM_BINARY_DIR")
option(
ENABLE_QEMU_TESTING
"Enable tests that use QEMU. This option is ON by default."
Expand Down Expand Up @@ -64,7 +63,6 @@ endif()
# Arguments to pass down to the library projects.
foreach(arg
LLVM_BINARY_DIR
LIBC_HDRGEN
FVP_INSTALL_DIR
FVP_CONFIG_DIR
)
Expand All @@ -89,31 +87,6 @@ endif()
# Target for any dependencies to build the runtimes project.
add_custom_target(runtimes-depends)

# If building llvm-libc, ensure libc-hdrgen is available.
if(C_LIBRARY STREQUAL llvmlibc)
if(NOT LIBC_HDRGEN)
if(EXISTS ${LLVM_BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})
set(LIBC_HDRGEN ${LLVM_BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})
else()
ExternalProject_Add(
libc_hdrgen
SOURCE_DIR ${llvmproject_SOURCE_DIR}/llvm
CMAKE_ARGS
-DLLVM_ENABLE_RUNTIMES=libc
-DLLVM_LIBC_FULL_BUILD=ON
-DCMAKE_BUILD_TYPE=Debug
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target libc-hdrgen
INSTALL_COMMAND ${CMAKE_COMMAND} -E true
CONFIGURE_HANDLED_BY_BUILD TRUE
)
ExternalProject_Get_property(libc_hdrgen BINARY_DIR)
set(LIBC_HDRGEN ${BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})
add_dependencies(runtimes-depends libc_hdrgen)
endif()
endif()
list(APPEND passthrough_dirs "-DLIBC_HDRGEN=${LIBC_HDRGEN}")
endif()

# Create one target to run all the tests.
add_custom_target(check-${C_LIBRARY})
add_custom_target(check-compiler-rt)
Expand Down
26 changes: 0 additions & 26 deletions arm-runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ set(ENABLE_LIBC_TESTS ${ENABLE_LIBC_TESTS_def} CACHE BOOL "Enable libc tests (pi
set(ENABLE_COMPILER_RT_TESTS ${ENABLE_COMPILER_RT_TESTS_def} CACHE BOOL "Enable compiler-rt tests.")
set(ENABLE_LIBCXX_TESTS ${ENABLE_LIBCXX_TESTS_def} CACHE BOOL "Enable libcxx tests.")
set(LLVM_BINARY_DIR "" CACHE PATH "Path to LLVM toolchain root to build libraries with")
set(LIBC_HDRGEN "" CACHE PATH "Path to prebuilt lbc-hdrgen if not included in LLVM binaries set by LLVM_BINARY_DIR")

# Temporary location to collect the libraries as they are built.
set(TEMP_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp_install")
Expand Down Expand Up @@ -581,39 +580,14 @@ if(C_LIBRARY STREQUAL llvmlibc)
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
)

if(LIBC_HDRGEN)
# If libc-hdrgen is provided, there is no need to build it,
# but a target is still needed to satisfy the dependency.
add_custom_target(libc_hdrgen)
elseif(EXISTS ${LLVM_BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})
set(LIBC_HDRGEN ${LLVM_BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})
add_custom_target(libc_hdrgen)
else()
ExternalProject_Add(
libc_hdrgen
SOURCE_DIR ${llvmproject_SOURCE_DIR}/llvm
CMAKE_ARGS
-DLLVM_ENABLE_RUNTIMES=libc
-DLLVM_LIBC_FULL_BUILD=ON
-DCMAKE_BUILD_TYPE=Debug
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target libc-hdrgen
INSTALL_COMMAND ${CMAKE_COMMAND} -E true
CONFIGURE_HANDLED_BY_BUILD TRUE
)
ExternalProject_Get_property(libc_hdrgen BINARY_DIR)
set(LIBC_HDRGEN ${BINARY_DIR}/bin/libc-hdrgen${CMAKE_EXECUTABLE_SUFFIX})
endif()

ExternalProject_Add(
llvmlibc
SOURCE_DIR ${llvmproject_SOURCE_DIR}/runtimes
INSTALL_DIR llvmlibc/install
DEPENDS libc_hdrgen
CMAKE_ARGS
${compiler_launcher_cmake_args}
${common_llvmlibc_cmake_args}
-DLIBC_TARGET_TRIPLE=${target_triple}
-DLIBC_HDRGEN_EXE=${LIBC_HDRGEN}
-DLIBC_CONFIG_PATH=${LIBC_CFG_DIR}
-DLIBC_CONF_TIME_64BIT=ON
-DLLVM_CMAKE_DIR=${LLVM_BINARY_DIR}/lib/cmake/llvm
Expand Down
Loading