-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b59c65c
commit 2bd85de
Showing
2 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
208 changes: 208 additions & 0 deletions
208
openwrt-21.02/patches/node/010-execvp-arg-list-too-long.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
--- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | ||
+++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | ||
@@ -151,6 +151,32 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOL | ||
quiet_cmd_link = LINK($(TOOLSET)) $@ | ||
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group | ||
|
||
+define xargs | ||
+ $(1) $(wordlist 1,100,$(2)) | ||
+ $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2)))) | ||
+endef | ||
+ | ||
+define write-to-file | ||
+ @echo >$(1) | ||
+ $(call xargs,printf "%s\\n" >>$(1),$(2)) | ||
+endef | ||
+ | ||
+OBJ_FILE_LIST_SFX := ar-file-list | ||
+ | ||
+define create_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
+define create_thin_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
# We support two kinds of shared objects (.so): | ||
# 1) shared_library, which is just bundling together many dependent libraries | ||
# into a link line. | ||
@@ -195,6 +221,32 @@ cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) | ||
quiet_cmd_alink_thin = AR($(TOOLSET)) $@ | ||
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) | ||
|
||
+define xargs | ||
+ $(1) $(wordlist 1,100,$(2)) | ||
+ $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2)))) | ||
+endef | ||
+ | ||
+define write-to-file | ||
+ @echo >$(1) | ||
+ $(call xargs,printf "%s\\n" >>$(1),$(2)) | ||
+endef | ||
+ | ||
+OBJ_FILE_LIST_SFX := ar-file-list | ||
+ | ||
+define create_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
+define create_thin_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
# Due to circular dependencies between libraries :(, we wrap the | ||
# special "figure out circular dependencies" flags around the entire | ||
# input list during linking. | ||
@@ -1612,11 +1664,17 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj) | ||
"Spaces in alink input filenames not supported (%s)" % link_dep) | ||
if (self.flavor not in ('mac', 'openbsd', 'netbsd', 'win') and not | ||
self.is_standalone_static_library): | ||
- self.WriteDoCmd([self.output_binary], link_deps, 'alink_thin', | ||
- part_of_all, postbuilds=postbuilds) | ||
+ if self.flavor in ('linux', 'android'): | ||
+ self.WriteMakeRule([self.output_binary], link_deps, actions = ['$(call create_thin_archive,$@,$^)']) | ||
+ else: | ||
+ self.WriteDoCmd([self.output_binary], link_deps, 'alink_thin', | ||
+ part_of_all, postbuilds=postbuilds) | ||
else: | ||
- self.WriteDoCmd([self.output_binary], link_deps, 'alink', part_of_all, | ||
- postbuilds=postbuilds) | ||
+ if self.flavor in ('linux', 'android'): | ||
+ self.WriteMakeRule([self.output_binary], link_deps, actions = ['$(call create_archive,$@,$^)']) | ||
+ else: | ||
+ self.WriteDoCmd([self.output_binary], link_deps, 'alink', part_of_all, | ||
+ postbuilds=postbuilds) | ||
elif self.type == 'shared_library': | ||
self.WriteLn('%s: LD_INPUTS := %s' % ( | ||
QuoteSpaces(self.output_binary), | ||
--- a/tools/gyp/pylib/gyp/generator/make.py | ||
+++ b/tools/gyp/pylib/gyp/generator/make.py | ||
@@ -155,6 +155,32 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOL | ||
quiet_cmd_link = LINK($(TOOLSET)) $@ | ||
cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group | ||
|
||
+define xargs | ||
+ $(1) $(wordlist 1,100,$(2)) | ||
+ $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2)))) | ||
+endef | ||
+ | ||
+define write-to-file | ||
+ @echo >$(1) | ||
+ $(call xargs,printf "%s\\n" >>$(1),$(2)) | ||
+endef | ||
+ | ||
+OBJ_FILE_LIST_SFX := ar-file-list | ||
+ | ||
+define create_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
+define create_thin_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
# We support two kinds of shared objects (.so): | ||
# 1) shared_library, which is just bundling together many dependent libraries | ||
# into a link line. | ||
@@ -199,6 +225,32 @@ cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) | ||
quiet_cmd_alink_thin = AR($(TOOLSET)) $@ | ||
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) | ||
|
||
+define xargs | ||
+ $(1) $(wordlist 1,100,$(2)) | ||
+ $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2)))) | ||
+endef | ||
+ | ||
+define write-to-file | ||
+ @echo >$(1) | ||
+ $(call xargs,printf "%s\\n" >>$(1),$(2)) | ||
+endef | ||
+ | ||
+OBJ_FILE_LIST_SFX := ar-file-list | ||
+ | ||
+define create_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
+define create_thin_archive | ||
+ $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX)) | ||
+ rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` | ||
+ $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) | ||
+ $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) | ||
+endef | ||
+ | ||
# Due to circular dependencies between libraries :(, we wrap the | ||
# special "figure out circular dependencies" flags around the entire | ||
# input list during linking. | ||
@@ -1766,21 +1818,35 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj) | ||
self.flavor not in ("mac", "openbsd", "netbsd", "win") | ||
and not self.is_standalone_static_library | ||
): | ||
- self.WriteDoCmd( | ||
- [self.output_binary], | ||
- link_deps, | ||
- "alink_thin", | ||
- part_of_all, | ||
- postbuilds=postbuilds, | ||
- ) | ||
+ if self.flavor in ('linux', 'android'): | ||
+ self.WriteMakeRule( | ||
+ [self.output_binary], | ||
+ link_deps, | ||
+ actions = ['$(call create_thin_archive,$@,$^)'] | ||
+ ) | ||
+ else: | ||
+ self.WriteDoCmd( | ||
+ [self.output_binary], | ||
+ link_deps, | ||
+ 'alink_thin', | ||
+ part_of_all, | ||
+ postbuilds=postbuilds | ||
+ ) | ||
else: | ||
- self.WriteDoCmd( | ||
- [self.output_binary], | ||
- link_deps, | ||
- "alink", | ||
- part_of_all, | ||
- postbuilds=postbuilds, | ||
- ) | ||
+ if self.flavor in ('linux', 'android'): | ||
+ self.WriteMakeRule( | ||
+ [self.output_binary], | ||
+ link_deps, | ||
+ actions = ['$(call create_archive,$@,$^)'] | ||
+ ) | ||
+ else: | ||
+ self.WriteDoCmd( | ||
+ [self.output_binary], | ||
+ link_deps, | ||
+ 'alink', | ||
+ part_of_all, | ||
+ postbuilds=postbuilds | ||
+ ) | ||
elif self.type == "shared_library": | ||
self.WriteLn( | ||
"%s: LD_INPUTS := %s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters