summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2016-11-23 17:41:38 +0100
committerMichal Marek <mmarek@suse.com>2016-11-29 15:53:19 +0100
commitfe026a851b6bb9a11c27e93b9b15060cb310a3d6 (patch)
tree98d0a73b38592e5a997d614d7464f6d3f7cf6541 /scripts
parentkbuild: kallsyms allow 3-pass generation if symbols size has changed (diff)
downloadlinux-fe026a851b6bb9a11c27e93b9b15060cb310a3d6.tar.xz
linux-fe026a851b6bb9a11c27e93b9b15060cb310a3d6.zip
kbuild: thin archives for multi-y targets
THIN_ARCHIVES builds archives for built-in.o targets, have it build multi-y targets as archives as well. This saves another ~15% of the size of intermediate artifacts in the build tree. After this patch, the linker is only used in final link, and special cases like vdsos. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index de46ab03f063..9807a8115896 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -448,11 +448,18 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y))) \
$($(subst $(obj)/,,$(@:.o=-m)))), $^)
-quiet_cmd_link_multi-y = LD $@
-cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
+cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
+
+ifdef CONFIG_THIN_ARCHIVES
+ quiet_cmd_link_multi-y = AR $@
+ cmd_link_multi-y = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
+else
+ quiet_cmd_link_multi-y = LD $@
+ cmd_link_multi-y = $(cmd_link_multi-link)
+endif
quiet_cmd_link_multi-m = LD [M] $@
-cmd_link_multi-m = $(cmd_link_multi-y)
+cmd_link_multi-m = $(cmd_link_multi-link)
$(multi-used-y): FORCE
$(call if_changed,link_multi-y)