aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-04-04 03:07:38 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-04-04 21:18:10 -0400
commitea4054a2384a115cd340151f4bb4628bfaee41a1 (patch)
tree9446e973e135a1ee51c446d593b4bc414027ed2c
parent712f9b46843d941347e86dcd2e1d63f9d3b112cb (diff)
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>
-rw-r--r--scripts/Makefile.modpost8
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
60modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers 60modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers
61 61
62# Step 1), find all modules listed in $(MODVERDIR)/ 62# Step 1), find all modules listed in $(MODVERDIR)/
63__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 63MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u
64__modules := $(shell $(MODLISTCMD))
64modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) 65modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
65 66
66# Stop after building .o files if NOFINAL is set. Makes compile tests quicker 67# Stop after building .o files if NOFINAL is set. Makes compile tests quicker
@@ -78,12 +79,13 @@ modpost = scripts/mod/modpost \
78 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
79 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 80 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
80 81
82# We can go over command line length here, so be careful.
81quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 83quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
82 cmd_modpost = $(modpost) -s 84 cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T -
83 85
84PHONY += __modpost 86PHONY += __modpost
85__modpost: $(modules:.ko=.o) FORCE 87__modpost: $(modules:.ko=.o) FORCE
86 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) 88 $(call cmd,modpost) $(wildcard vmlinux)
87 89
88quiet_cmd_kernel-mod = MODPOST $@ 90quiet_cmd_kernel-mod = MODPOST $@
89 cmd_kernel-mod = $(modpost) $@ 91 cmd_kernel-mod = $(modpost) $@