Skip to content

Commit

Permalink
Revert "[libc] Disable old headergen checks unless enabled" (llvm#104627
Browse files Browse the repository at this point in the history
)

Reverts llvm#104522

Caused crashes on Fuchsia
  • Loading branch information
michaelrj-google authored Aug 16, 2024
1 parent 89a1f14 commit 9791986
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
33 changes: 16 additions & 17 deletions libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,31 @@ set(LIBC_NAMESPACE ${default_namespace}
CACHE STRING "The namespace to use to enclose internal implementations. Must start with '__llvm_libc'."
)

option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)

if(LIBC_USE_NEW_HEADER_GEN)
add_subdirectory(newhdrgen)
else()
if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD)
if(NOT LIBC_HDRGEN_EXE)
# We need to set up hdrgen first since other targets depend on it.
add_subdirectory(utils/LibcTableGenUtil)
add_subdirectory(utils/HdrGen)
# Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in
# PARENT_SCOPE which get lost until saved in the cache.
set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "")
set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "")
else()
message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.")
endif()
add_subdirectory(newhdrgen)


if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD)
if(NOT LIBC_HDRGEN_EXE)
# We need to set up hdrgen first since other targets depend on it.
add_subdirectory(utils/LibcTableGenUtil)
add_subdirectory(utils/HdrGen)
# Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in
# PARENT_SCOPE which get lost until saved in the cache.
set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "")
set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "")
else()
message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.")
endif()
endif()

# We will build the GPU utilities if we are not doing a runtimes build.
option(LIBC_BUILD_GPU_LOADER "Always build the GPU loader utilities" OFF)
if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
add_subdirectory(utils/gpu)
endif()

option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)

set(NEED_LIBC_HDRGEN FALSE)
if(NOT LLVM_RUNTIMES_BUILD)
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
Expand Down
14 changes: 6 additions & 8 deletions libc/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,21 +420,19 @@ add_header_macro(
.llvm-libc-types.posix_spawn_file_actions_t
)

add_header_macro(
add_gen_header(
link
../libc/newhdrgen/yaml/link.yaml
link.h.def
link.h
DEF_FILE link.h.def
GEN_HDR link.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.link_macros
)

add_header_macro(
add_gen_header(
elf
../libc/newhdrgen/yaml/elf.yaml
elf.h.def
elf.h
DEF_FILE elf.h.def
GEN_HDR elf.h
DEPENDS
.llvm-libc-macros.elf_macros
)
Expand Down
3 changes: 1 addition & 2 deletions llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,7 @@ if(build_runtimes)
endforeach()
endif()
if("libc" IN_LIST LLVM_ENABLE_PROJECTS AND
(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD) AND
(NOT LIBC_USE_NEW_HEADER_GEN))
(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD))
if(LIBC_HDRGEN_EXE)
set(hdrgen_exe ${LIBC_HDRGEN_EXE})
else()
Expand Down

0 comments on commit 9791986

Please sign in to comment.