Skip to content

Commit

Permalink
llvm-libc build: remove all references to libc-hdrgen. (#629)
Browse files Browse the repository at this point in the history
The 'newhdrgen' tool replaced it some time ago, and that's written in
Python, so it doesn't need to be built separately with host tools at
all.

As of upstream commit e0ae7793fca0c78, the migration is complete, and
the old C++ libc-hdrgen doesn't exist at all any more. So we need to
stop trying to build it – it will break our builds when no such build
target exists.
  • Loading branch information
statham-arm authored Jan 27, 2025
1 parent 49bfb9d commit 13ad84a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 73 deletions.
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,25 +350,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 @@ -616,7 +597,6 @@ if(NOT PREBUILT_TARGET_LIBRARIES)
-DENABLE_PARALLEL_LIB_CONFIG=${ENABLE_PARALLEL_LIB_CONFIG}
-DENABLE_PARALLEL_LIB_BUILD=${ENABLE_PARALLEL_LIB_BUILD}
-DPARALLEL_LIB_BUILD_LEVELS=${PARALLEL_LIB_BUILD_LEVELS}
-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 @@ -83,7 +82,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 @@ -108,31 +106,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 @@ -585,39 +584,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

0 comments on commit 13ad84a

Please sign in to comment.