[libc-commits] [libc] [libc] Use response files for hdrgen entry points (PR #183267)

via libc-commits libc-commits at lists.llvm.org
Wed Feb 25 02:05:33 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

This avoids the build failure when the command line ends up being too long which can be especially problematic on Windows.

Fixes #<!-- -->182374

---
Full diff: https://github.com/llvm/llvm-project/pull/183267.diff


2 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCHeaderRules.cmake (+6-2) 
- (modified) libc/utils/hdrgen/hdrgen/main.py (+2-1) 


``````````diff
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index dc2bb843fdcb9..ad540b5ca27d0 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -111,6 +111,10 @@ function(add_gen_header target_name)
 
   list(TRANSFORM entry_points PREPEND "--entry-point=")
 
+  set(rsp_file "${CMAKE_CURRENT_BINARY_DIR}/${out_file}.rsp")
+  string(REPLACE ";" " " entry_points "${entry_points}")
+  file(WRITE ${rsp_file} "${entry_points}")
+
   add_custom_command(
     OUTPUT ${out_file}
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
@@ -119,9 +123,9 @@ function(add_gen_header target_name)
             --depfile ${dep_file}
             --write-if-changed
             ${proxy_arg}
-            ${entry_points}
             ${yaml_file}
-    DEPENDS ${yaml_file}
+            "@${rsp_file}"
+    DEPENDS ${yaml_file} ${rsp_file}
     DEPFILE ${dep_file}
     COMMENT "Generating header ${ADD_GEN_HDR_GEN_HDR} from ${yaml_file}"
   )
diff --git a/libc/utils/hdrgen/hdrgen/main.py b/libc/utils/hdrgen/hdrgen/main.py
index eaeb9c6aedb04..1e45186de24b5 100755
--- a/libc/utils/hdrgen/hdrgen/main.py
+++ b/libc/utils/hdrgen/hdrgen/main.py
@@ -18,7 +18,8 @@
 
 
 def main():
-    parser = argparse.ArgumentParser(description="Generate header files from YAML")
+    parser = argparse.ArgumentParser(description="Generate header files from YAML",
+                                     fromfile_prefix_chars="@")
     parser.add_argument(
         "yaml_file",
         help="Path to the YAML file containing header specification",

``````````

</details>


https://github.com/llvm/llvm-project/pull/183267


More information about the libc-commits mailing list