From c5339b7025863d4e1368c93ec66043cc8a222d2b Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Thu, 26 Feb 2026 00:42:17 -0800 Subject: [PATCH] [libc] Use response files for hdrgen entry points (#183267) 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 | 7 +++++-- libc/utils/hdrgen/hdrgen/main.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake index dc2bb843fdcb..d7e996be9e85 100644 --- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake +++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake @@ -109,7 +109,10 @@ function(add_gen_header target_name) set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}") endif() + # TODO: Use $ after we bump CMake to 3.27. list(TRANSFORM entry_points PREPEND "--entry-point=") + set(rsp_file "${CMAKE_CURRENT_BINARY_DIR}/${relative_path}.rsp") + file(GENERATE OUTPUT ${rsp_file} CONTENT "$") add_custom_command( OUTPUT ${out_file} @@ -119,9 +122,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 eaeb9c6aedb0..7b07a5f5e3ca 100755 --- a/libc/utils/hdrgen/hdrgen/main.py +++ b/libc/utils/hdrgen/hdrgen/main.py @@ -18,7 +18,9 @@ from hdrgen.yaml_to_classes import load_yaml_file, fill_public_api 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",