Skip to content

Commit d6fb5d7

Browse files
committed
tools: fix execvp: printf: Argument list too long
When statically linking quictls/openssl 3.0.0alpha17 there are a number of architectures that error with the following message: execvp: printf: Argument list too long This commit adds a patch provided in #9137 to see if this will address this issue. Refs: #9137 (comment)
1 parent 7af03fe commit d6fb5d7

File tree

1 file changed

+69
-5
lines changed
  • tools/gyp/pylib/gyp/generator

1 file changed

+69
-5
lines changed

tools/gyp/pylib/gyp/generator/make.py

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,31 @@ def CalculateGeneratorInputInfo(params):
155155
quiet_cmd_link = LINK($(TOOLSET)) $@
156156
cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group
157157
158+
# Note: this does not handle spaces in paths
159+
define xargs
160+
$(1) $(word 1,$(2))
161+
$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2))))
162+
endef
163+
164+
define write-to-file
165+
@: >$(1)
166+
$(call xargs,@printf "%s\\n" >>$(1),$(2))
167+
endef
168+
169+
OBJ_FILE_LIST := ar-file-list
170+
171+
define create_archive
172+
rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
173+
$(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
174+
$(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
175+
endef
176+
177+
define create_thin_archive
178+
rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
179+
$(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
180+
$(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
181+
endef
182+
158183
# We support two kinds of shared objects (.so):
159184
# 1) shared_library, which is just bundling together many dependent libraries
160185
# into a link line.
@@ -199,6 +224,31 @@ def CalculateGeneratorInputInfo(params):
199224
quiet_cmd_alink_thin = AR($(TOOLSET)) $@
200225
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
201226
227+
# Note: this does not handle spaces in paths
228+
define xargs
229+
$(1) $(word 1,$(2))
230+
$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2))))
231+
endef
232+
233+
define write-to-file
234+
@: >$(1)
235+
$(call xargs,@printf "%s\\n" >>$(1),$(2))
236+
endef
237+
238+
OBJ_FILE_LIST := ar-file-list
239+
240+
define create_archive
241+
rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
242+
$(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
243+
$(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
244+
endef
245+
246+
define create_thin_archive
247+
rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
248+
$(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
249+
$(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
250+
endef
251+
202252
# Due to circular dependencies between libraries :(, we wrap the
203253
# special "figure out circular dependencies" flags around the entire
204254
# input list during linking.
@@ -1766,14 +1816,28 @@ def WriteTarget(
17661816
self.flavor not in ("mac", "openbsd", "netbsd", "win")
17671817
and not self.is_standalone_static_library
17681818
):
1769-
self.WriteDoCmd(
1819+
if self.flavor in ('linux', 'android'):
1820+
self.WriteMakeRule(
17701821
[self.output_binary],
17711822
link_deps,
1772-
"alink_thin",
1773-
part_of_all,
1774-
postbuilds=postbuilds,
1775-
)
1823+
actions = ['$(call create_thin_archive,$@,$^)']
1824+
)
1825+
else:
1826+
self.WriteDoCmd(
1827+
[self.output_binary],
1828+
link_deps,
1829+
"alink_thin",
1830+
part_of_all,
1831+
postbuilds=postbuilds,
1832+
)
17761833
else:
1834+
if self.flavor in ('linux', 'android'):
1835+
self.WriteMakeRule(
1836+
[self.output_binary],
1837+
link_deps,
1838+
actions = ['$(call create_archive,$@,$^)']
1839+
)
1840+
else:
17771841
self.WriteDoCmd(
17781842
[self.output_binary],
17791843
link_deps,

0 commit comments

Comments
 (0)