[libc-commits] [libc] [libc] Use response files for hdrgen entry points (PR #183267)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Wed Feb 25 02:05:08 PST 2026
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/183267
This avoids the build failure when the command line ends up being too long which can be especially problematic on Windows.
Fixes #182374
>From b0f273ca180b8a958af3c5b08640d49796394274 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Wed, 25 Feb 2026 10:01:49 +0000
Subject: [PATCH] [libc] Use response files for hdrgen entry points
This avoids the build failure when the command line ends up being too
long which can be especially problematic on Windows.
Fixes #182374
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 8 ++++++--
libc/utils/hdrgen/hdrgen/main.py | 3 ++-
2 files changed, 8 insertions(+), 3 deletions(-)
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",
More information about the libc-commits
mailing list