diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-04 09:07:38 +0200 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-05 03:18:10 +0200 |
commit | ea4054a2384a115cd340151f4bb4628bfaee41a1 (patch) | |
tree | 9446e973e135a1ee51c446d593b4bc414027ed2c /scripts/Makefile.modpost | |
parent | modpost: add -T option to read module names from file/stdin. (diff) | |
download | linux-ea4054a2384a115cd340151f4bb4628bfaee41a1.tar.xz linux-ea4054a2384a115cd340151f4bb4628bfaee41a1.zip |
modpost: handle huge numbers of modules.
strace shows:
72102 execve("/bin/sh", ["/bin/sh", "-c", "echo ' scripts/mod/modpost -m -a
-o /cc/wfg/sound-compiletest/Module.symvers -s'; scripts/
mod/modpost -m -a -o /cc/wfg/sound-compiletest/Module.symvers -s vmlinux
arch/x86/crypto/ablk_helper.o arch/x86/crypto/aes-i586.o arch
/x86/crypto/aesni-intel.o arch/x86/crypto/crc32-pclmul.o
...
drivers/ata/sata_promise.o "...], [/* 119 vars */] <unfinished ...>
71827 wait4(-1, <unfinished ...>
72102 <... execve resumed> ) = -1 E2BIG (Argument list too long)
So we re-run the shell command which produces the list and feed it into modpost -T -.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'scripts/Makefile.modpost')
-rw-r--r-- | scripts/Makefile.modpost | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index cf82c832458f..8dcdca27d836 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -60,7 +60,8 @@ kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers # Step 1), find all modules listed in $(MODVERDIR)/ -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) +MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u +__modules := $(shell $(MODLISTCMD)) modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) # Stop after building .o files if NOFINAL is set. Makes compile tests quicker @@ -78,12 +79,13 @@ modpost = scripts/mod/modpost \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) +# We can go over command line length here, so be careful. quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules - cmd_modpost = $(modpost) -s + cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T - PHONY += __modpost __modpost: $(modules:.ko=.o) FORCE - $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) + $(call cmd,modpost) $(wildcard vmlinux) quiet_cmd_kernel-mod = MODPOST $@ cmd_kernel-mod = $(modpost) $@ |