From f50aeaf27cfbbbf5f6ba3e2a470e16b10dbb0bf4 Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Kalikot Veetil Date: Wed, 9 Dec 2020 22:53:42 -0800 Subject: [PATCH] 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 Signed-off-by: Jeff Johnson --- scripts/Makefile.build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 17d04ea62cd1..1d969811c691 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -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