From patchwork Thu Aug 11 13:49:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101950 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp123776qga; Thu, 11 Aug 2016 06:57:21 -0700 (PDT) X-Received: by 10.98.130.137 with SMTP id w131mr17303191pfd.5.1470923415711; Thu, 11 Aug 2016 06:50:15 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si3369994pfw.47.2016.08.11.06.50.15; Thu, 11 Aug 2016 06:50:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbcHKNuN (ORCPT + 27 others); Thu, 11 Aug 2016 09:50:13 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:57230 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499AbcHKNuK (ORCPT ); Thu, 11 Aug 2016 09:50:10 -0400 Received: from wuerfel.localnet ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MRyX8-1bf6Pn00l8-00TFOm; Thu, 11 Aug 2016 15:49:09 +0200 From: Arnd Bergmann To: Nicholas Piggin Cc: linuxppc-dev@lists.ozlabs.org, Segher Boessenkool , Stephen Rothwell , "linux-kernel@vger.kernel.org" , "Luis R. Rodriguez" , linux-next@vger.kernel.org, Paul Mackerras , Fengguang Wu , Guenter Roeck , Alan Modra Subject: [TESTING] kbuild: link drivers subdirectories separately Date: Thu, 11 Aug 2016 15:49:03 +0200 Message-ID: <10934898.zRVpW5bs5f@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-31-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20160811231240.4ba73123@roar.ozlabs.ibm.com> References: <6327068.NbTmhQA6XD@wuerfel> <20160811231240.4ba73123@roar.ozlabs.ibm.com> MIME-Version: 1.0 X-Provags-ID: V03:K0:IbB3kaS4bIBs1WWIim+Dccl2LuLmGmG8lUStD0D7ERDUP17pvTc b+aRhgMByo1faLTbxrxKtr850jyDCu2ab4dIjIh09WimKIRiUiNuC+BAWw8uPp6tmTjtJJm K9W+1tAbLN3De6k9NQXboyVG/V9apmubl94KV0bCVrozWGvXIeI+NHBrLM6ALDBUp1Qb+NL +OrgHFosQBrKggt8ZYw9A== X-UI-Out-Filterresults: notjunk:1; V01:K0:DMyc/uBuoP8=:969tyEO9a2a1d+o9DTS8LY 7RuUOkfu+1H6BociHJrY+xMiFVkmopSzBHl337X+IwVxlCswpgHz/C2dv1FzUYUzZRAi/688J 6KPdoERVPr+cnsWb388EhGozgtV41g4+YfPzzTZRuJPCo6QsRv1PJIwQENSz3lJOyCqI1WCWj ree5YY/UwHNrl7vWE1h+uznz3WmwBdN7E6k783jG+YXlUGv3UXAC9fu50nuidaLmQzzMsBown kPUA/mJTRzwCFQ6pswQsVoRvdO5/TnwfUpTRsQHNBg8QN0z6lW5GvZD0mzAtrHY3fxlAA99pl dTh4zz0Sjf0gilkeQi0PVeT+dNDGWJidql73pK/aIJ7EhscjiAsCf4LohRRzfTIG6IAjEx1SC iFLu5zZRQ69K7Ui/tcIGsJ4hYrbgAgEgemenLMSsJBUxTJGFU83I20k2UQ0/J9H+CgAp4+0Y4 cOaU1hr6bxoKlCV4q2JkhLfXyROxvALdfB3sW4z25Mb4Nw+5D3gVhvyiJn9Zz207tAuW/6lPV EjrlJDjxJEv3DTR4t//QixcoCT4VTbajfdSHaqAUD4i/y314bH6WRvC5v8BdrwpdNBySLW2qc LUdgB9VFoeMe12eSV/zYtYW2A5hBPC0vOEA7yKOZXDM4jedet52Porcwsl4TyA1dYsvwzfJlQ bDZMrS/ImSa4toetlFDv0UfuGL7YeCPulDGWf6Nrvy2ASZsA1lC1lBAh/b0EMmsFJRPQ0S9YV JaCzAwc948BXxG2K Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On ARM, relative branches between functions can not span more than 32MB, which limits the size of an ELF section. In the final link, the linker will introduce trampolines that perform long calls to avoid the limit, and during a recursive link, trampolines are added within the section. However, this does not work for cross-section branches when the source section is already larger than 32MB because there is no longer space to put the trampoline. We are unable to build an allyesconfig kernel on ARM because the .text section in drivers/built-in.o has that problem. This patch avoids it by linking drivers/*/built-in.o directly into vmlinux.o, rather than first linking them into drivers/built-in.o. Signed-off-by: Arnd Bergmann --- This patch gets allyesconfig to work for me on ARM. We have previously decided that this is too ugly, but you can use it for comparing the link times. diff --git a/Makefile b/Makefile index 2eae4bab0d9b..091ca3a3015b 100644 --- a/Makefile +++ b/Makefile @@ -557,13 +557,6 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ asm-generic gcc-plugins $(Q)$(MAKE) $(build)=$(@) -# Objects we will link into vmlinux / subdirs we need to visit -init-y := init/ -drivers-y := drivers/ sound/ firmware/ -net-y := net/ -libs-y := lib/ -core-y := usr/ -virt-y := virt/ endif # KBUILD_EXTMOD ifeq ($(dot-config),1) @@ -584,6 +577,20 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # we execute the config step to be sure to catch updated Kconfig files include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig + +# Objects we will link into vmlinux / subdirs we need to visit +init-y := init/ +net-y := net/ +libs-y := lib/ +core-y := usr/ +virt-y := virt/ + +# split out objects from drivers to avoid recursively linking large .o files +include drivers/Makefile +drivers-y := $(addprefix drivers/,$(obj-y) $(obj-m)) +drivers-y += sound/ firmware/ +obj-y := + else # external modules needs include/generated/autoconf.h and include/config/auto.conf # but do not care if they are up-to-date. Use auto.conf to trigger the test diff --git a/drivers/Makefile b/drivers/Makefile index 9cfa547d67ce..38848742db1f 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -95,10 +95,7 @@ obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/ obj-$(CONFIG_PARIDE) += block/paride/ obj-$(CONFIG_TC) += tc/ obj-$(CONFIG_UWB) += uwb/ -obj-$(CONFIG_USB_PHY) += usb/ -obj-$(CONFIG_USB) += usb/ -obj-$(CONFIG_PCI) += usb/ -obj-$(CONFIG_USB_GADGET) += usb/ +obj-y += usb/ obj-$(CONFIG_SERIO) += input/serio/ obj-$(CONFIG_GAMEPORT) += input/gameport/ obj-$(CONFIG_INPUT) += input/ @@ -137,7 +134,8 @@ obj-$(CONFIG_PPC_PS3) += ps3/ obj-$(CONFIG_OF) += of/ obj-$(CONFIG_SSB) += ssb/ obj-$(CONFIG_BCMA) += bcma/ -obj-y += vhost/ +obj-$(CONFIG_VHOST_RING) += vhost/ +obj-$(CONFIG_VHOST) += vhost/ obj-$(CONFIG_VLYNQ) += vlynq/ obj-$(CONFIG_STAGING) += staging/ obj-y += platform/