[libc-commits] [libc] [libc] Output all headers with LIBC_CONF_OUTPUT_ALL_HEADERS (PR #144114)

William Huynh via libc-commits libc-commits at lists.llvm.org
Fri Jun 13 10:12:25 PDT 2025


https://github.com/saturn691 updated https://github.com/llvm/llvm-project/pull/144114

>From d3f4b77142d0db98ed46d3f62d5c24597acc87d8 Mon Sep 17 00:00:00 2001
From: William Huynh <William.Huynh at arm.com>
Date: Fri, 13 Jun 2025 17:33:29 +0100
Subject: [PATCH 1/3] [libc] Output all headers with
 LIBC_CONF_OUTPUT_ALL_HEADERS

---
 libc/cmake/modules/LLVMLibCHeaderRules.cmake | 7 ++++++-
 libc/test/UnitTest/CMakeLists.txt            | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 99f90244e0134..add58756dfc17 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -97,8 +97,13 @@ function(add_gen_header target_name)
   set(out_file ${LIBC_INCLUDE_DIR}/${relative_path})
   set(dep_file "${out_file}.d")
   set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})
+  
+  if(LIBC_CONF_OUTPUT_ALL_HEADERS)
+    set(entry_points "")
+  else()
+    set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
+  endif()
 
-  set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
   list(TRANSFORM entry_points PREPEND "--entry-point=")
 
   add_custom_command(
diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index b0a3a7431c222..c32809da577d4 100644
--- a/libc/test/UnitTest/CMakeLists.txt
+++ b/libc/test/UnitTest/CMakeLists.txt
@@ -35,7 +35,7 @@ function(add_unittest_framework_library name)
   else()
     _get_common_test_compile_options(compile_options "" "")
     target_compile_options(${name}.unit PRIVATE ${compile_options})
-endif()
+  endif()
 
   _get_hermetic_test_compile_options(compile_options "")
   target_include_directories(${name}.hermetic PRIVATE ${LIBC_INCLUDE_DIR})

>From b4b3960cbd5b46fdcc393b6dc89d43ae547c81dd Mon Sep 17 00:00:00 2001
From: William Huynh <William.Huynh at arm.com>
Date: Fri, 13 Jun 2025 18:07:58 +0100
Subject: [PATCH 2/3] fixup! [libc] Output all headers with
 LIBC_CONF_OUTPUT_ALL_HEADERS

---
 libc/CMakeLists.txt                          | 1 +
 libc/cmake/modules/LLVMLibCHeaderRules.cmake | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index f21fc2fba7305..77b60610c1025 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -135,6 +135,7 @@ endif()
 option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc" ${default_to_full_build})
 option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
 option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF)
+option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless of whether it has been implemented" OFF)
 
 option(LIBC_CONFIG_PATH "The path to user provided folder that configures the build for the target system." OFF)
 
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index add58756dfc17..01c288f0b9198 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -98,7 +98,7 @@ function(add_gen_header target_name)
   set(dep_file "${out_file}.d")
   set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})
   
-  if(LIBC_CONF_OUTPUT_ALL_HEADERS)
+  if(LLVM_LIBC_ALL_HEADERS)
     set(entry_points "")
   else()
     set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")

>From f90851f59bf33ae3f28ffebeefc35e9c460b9ce2 Mon Sep 17 00:00:00 2001
From: William Huynh <113542065+saturn691 at users.noreply.github.com>
Date: Fri, 13 Jun 2025 18:12:18 +0100
Subject: [PATCH 3/3] Update libc/CMakeLists.txt

Co-authored-by: Michael Jones <michaelrj at google.com>
---
 libc/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 77b60610c1025..9907adfc55a5f 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -135,7 +135,7 @@ endif()
 option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc" ${default_to_full_build})
 option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
 option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF)
-option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless of whether it has been implemented" OFF)
+option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless of whether they are enabled on this target" OFF)
 
 option(LIBC_CONFIG_PATH "The path to user provided folder that configures the build for the target system." OFF)
 



More information about the libc-commits mailing list