Skip to content

Commit c5339b7

Browse files
authored
[libc] Use response files for hdrgen entry points (llvm#183267)
This avoids the build failure when the command line ends up being too long which can be especially problematic on Windows. Fixes llvm#182374
1 parent 5dd1600 commit c5339b7

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

libc/cmake/modules/LLVMLibCHeaderRules.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ function(add_gen_header target_name)
109109
set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
110110
endif()
111111

112+
# TODO: Use $<LIST:PREPEND,list,item,...> after we bump CMake to 3.27.
112113
list(TRANSFORM entry_points PREPEND "--entry-point=")
114+
set(rsp_file "${CMAKE_CURRENT_BINARY_DIR}/${relative_path}.rsp")
115+
file(GENERATE OUTPUT ${rsp_file} CONTENT "$<JOIN:${entry_points},\n>")
113116

114117
add_custom_command(
115118
OUTPUT ${out_file}
@@ -119,9 +122,9 @@ function(add_gen_header target_name)
119122
--depfile ${dep_file}
120123
--write-if-changed
121124
${proxy_arg}
122-
${entry_points}
123125
${yaml_file}
124-
DEPENDS ${yaml_file}
126+
"@${rsp_file}"
127+
DEPENDS ${yaml_file} ${rsp_file}
125128
DEPFILE ${dep_file}
126129
COMMENT "Generating header ${ADD_GEN_HDR_GEN_HDR} from ${yaml_file}"
127130
)

libc/utils/hdrgen/hdrgen/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919

2020
def main():
21-
parser = argparse.ArgumentParser(description="Generate header files from YAML")
21+
parser = argparse.ArgumentParser(
22+
description="Generate header files from YAML", fromfile_prefix_chars="@"
23+
)
2224
parser.add_argument(
2325
"yaml_file",
2426
help="Path to the YAML file containing header specification",

0 commit comments

Comments
 (0)