ANDROID: kbuild: handle excessively long argument lists

Modules with a large number of compilation units may be
exceeding AR and LD command argument list. Handle this gracefully by
writing the long argument list in a file. The command line options
read from file are inserted in place of the original @file option.

The usage is well documented at
https://www.gnu.org/software/make/manual/html_node/File-Function.html

Bug: 175420573
Change-Id: I3f9b8b9c59b9ba0c01ddd00d39fc3bbc62fda832
Signed-off-by: Mahesh Kumar Kalikot Veetil <mkalikot@codeaurora.org>
Signed-off-by: Jeff Johnson <jjohnson@codeaurora.org>
This commit is contained in:
Mahesh Kumar Kalikot Veetil
2020-12-09 22:53:42 -08:00
committed by Todd Kjos
parent 631b20dd6c
commit f50aeaf27c

View File

@@ -440,10 +440,15 @@ quiet_cmd_link_multi-m = AR [M] $@
cmd_link_multi-m = \
$(cmd_update_lto_symversions); \
rm -f $@; \
$(AR) cDPrsT $@ $(filter %.o,$^)
$(file >$@.in,$(filter %.o,$^)) \
$(AR) cDPrsT $@ @$@.in; \
rm -f $@.in
else
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^)
cmd_link_multi-m = \
$(file >$@.in,$(filter %.o,$^)) \
$(LD) $(ld_flags) -r -o $@ @$@.in; \
rm -f $@.in
endif
$(multi-used-m): FORCE