From patchwork Wed Aug 3 15:37:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 655489 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s4HL116fKz9sxR for ; Thu, 4 Aug 2016 01:39:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=zDuyZsIe; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3s4HL1049dzDqTt for ; Thu, 4 Aug 2016 01:39:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=zDuyZsIe; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3s4HJR3lc5zDqQn for ; Thu, 4 Aug 2016 01:37:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=zDuyZsIe; dkim-atps=neutral Received: by mail-pf0-x243.google.com with SMTP id y134so14855840pfg.3 for ; Wed, 03 Aug 2016 08:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=5Jl+SbYIJa+8ZZda7VC3wptmqn4CRjDs+NZrdsOS9OI=; b=zDuyZsIeZ1ZWmwJ15M+o9Q46Opr02Sss1YUh21rFMRj2/mZnHpXG2Gle4BxuWGPzdw ni5ppf6lXnm3mPMFFJGJO6eUp/Ze2Zebi+yVVNVZ/jNipn4fOLmIp7vdUPd8Q8apQUU8 9lzJAowzav1sFYEYPXuYTIVy2CWgXTqfZGZXE/ADaDKs8z9i0tnKQ8qN7s6BNyDvXJSG MD0yioQm/N/yATtBfiWmWh9xze0CJA9Wyr5fgEqyl9DZ/H19IBRDWqNu8z7a/dkJGvVi rG7EZlBC2jzWgii1awSd6D+ElXCfKHodppBqzk2ujUywGxMZTlvqzkus7d8DxxmyeIIm nMwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=5Jl+SbYIJa+8ZZda7VC3wptmqn4CRjDs+NZrdsOS9OI=; b=WRa7lyfaJSb1Wf47Y/j31g6cweMbpV9+XZzysjxYdqpyDLflqmPz/xKdee71pHc/C4 1LWb3hF+vYgtQpvB20REJ/iBrauPedznyN0dSbx5YIK/Zr658WxCa3aozGhADMG6EB3Y jKpNhjoQxiKKrfU06ZCL9V6cAS39+5goxduVxy3HrazJzidL8U8bpCzT9aAvw7UbGnXz p9DfEd8XyW8PC+NhugUl3TS3GWiIJ75TI/U7E/mhOoOghsaiTNGneVOlushaE+mefudh 0IS1mOYlTdxPfbk9THeLf2t4njGLStkn2VOE7Z3nGOP2sklyMEmHDADfmWwVJ0bN+wsu 5rGA== X-Gm-Message-State: AEkooutKMqX21pAL+RkViNZZZLG8UgPuPd9hnLiXwo0ldOUA+XW0Egx7aF5AisOGSWjaZA== X-Received: by 10.98.63.1 with SMTP id m1mr116978995pfa.14.1470238660160; Wed, 03 Aug 2016 08:37:40 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id y6sm13696789pav.1.2016.08.03.08.37.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Aug 2016 08:37:39 -0700 (PDT) Date: Thu, 4 Aug 2016 01:37:29 +1000 From: Nicholas Piggin To: Arnd Bergmann Subject: Re: powerpc allyesconfig / allmodconfig linux-next next-20160729 - next-20160729 build failures Message-ID: <20160804013729.7fffa45a@roar.ozlabs.ibm.com> In-Reply-To: <5216072.9VpDc0iy8Q@wuerfel> References: <1944325.MtNrGQyQle@wuerfel> <20160803221911.2f76ccad@canb.auug.org.au> <5216072.9VpDc0iy8Q@wuerfel> Organization: IBM X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Rothwell , "linux-kernel@vger.kernel.org" , "Luis R. Rodriguez" , linux-next@vger.kernel.org, Paul Mackerras , Fengguang Wu , linuxppc-dev@lists.ozlabs.org, Guenter Roeck Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 03 Aug 2016 14:29:13 +0200 Arnd Bergmann wrote: > On Wednesday, August 3, 2016 10:19:11 PM CEST Stephen Rothwell wrote: > > Hi Arnd, > > > > On Wed, 03 Aug 2016 09:52:23 +0200 Arnd Bergmann wrote: > > > > > > Using a different way to link the kernel would also help us with > > > the remaining allyesconfig problem on ARM, as the problem is only in > > > 'ld -r' not producing trampolines for symbols that later cannot get > > > them any more. It would probably also help building with ld.gold, > > > which is currently not working. > > > > > > What is your suggested alternative? > > > > I have a patch that make the built-in.o files into thin archives (same > > as archives, but the actual objects are replaced with the name of the > > original object file). That way the final link has all the original > > objects. I haven't checked to see what the overheads of doing it this > > way is. > > > > Nick Piggin has just today taken my old patch (it was last rebased to > > v4.4-rc1) and tried it on a recent kernel and it still seems to mostly > > work. It probably needs some tidying up, but you are welcome to test > > it if you want to. > > Sure, I'll certainly give it a try on ARM when you send me a copy. I've attached what I'm using, which builds and runs for me without any work. Your arch obviously has to select the option to use it. text data bss dec hex filename 11196784 1185024 1923820 14305628 da495c vmlinuxppc64.before 11187536 1181848 1923176 14292560 da1650 vmlinuxppc64.after ~9K text saving, ~3K data saving. I assume this comes from fewer branch trampolines and toc entries, but haven't verified exactly. commit 8bc3ca4798c215e9a9107b6d44408f0af259f84f Author: Stephen Rothwell Date: Tue Oct 30 12:14:18 2012 +1100 kbuild: allow architectures to use thin archives instead of ld -r Alan Modra has been trying to convince the kernel developers that ld -r is "evil" for many years. This is an alternative and means that the linker has much more information available to it when it links the kernel. Signed-off-by: Stephen Rothwell diff --git a/arch/Kconfig b/arch/Kconfig index d794384..1330bf4 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -424,6 +424,12 @@ config CC_STACKPROTECTOR_STRONG endchoice +config THIN_ARCHIVES + bool + help + Select this if the architecture wants to use thin archives + instead of ld -r to create the built-in.o files. + config HAVE_CONTEXT_TRACKING bool help diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0d1ca5b..bbf60b3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -358,10 +358,15 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; # Rule to compile a set of .o files into one .o file # ifdef builtin-target +ifdef CONFIG_THIN_ARCHIVES + cmd_make_builtin = rm -f $@; $(AR) rcsT$(KBUILD_ARFLAGS) +else + cmd_make_builtin = $(LD) $(ld_flags) -r -o +endif quiet_cmd_link_o_target = LD $@ # If the list of objects to link is empty, just create an empty built-in.o cmd_link_o_target = $(if $(strip $(obj-y)),\ - $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \ + $(cmd_make_builtin) $@ $(filter $(obj-y), $^) \ $(cmd_secanalysis),\ rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index f0f6d9d..ef4658f 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -41,8 +41,14 @@ info() # ${1} output file modpost_link() { - ${LD} ${LDFLAGS} -r -o ${1} ${KBUILD_VMLINUX_INIT} \ - --start-group ${KBUILD_VMLINUX_MAIN} --end-group + local objects + + if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then + objects="--whole-archive ${KBUILD_VMLINUX_INIT} ${KBUILD_VMLINUX_MAIN} --no-whole-archive" + else + objects="${KBUILD_VMLINUX_INIT} --start-group ${KBUILD_VMLINUX_MAIN} --end-group" + fi + ${LD} ${LDFLAGS} -r -o ${1} ${objects} } # Link of vmlinux @@ -51,11 +57,16 @@ modpost_link() vmlinux_link() { local lds="${objtree}/${KBUILD_LDS}" + local objects if [ "${SRCARCH}" != "um" ]; then + if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then + objects="--whole-archive ${KBUILD_VMLINUX_INIT} ${KBUILD_VMLINUX_MAIN} --no-whole-archive" + else + objects="${KBUILD_VMLINUX_INIT} --start-group ${KBUILD_VMLINUX_MAIN} --end-group" + fi ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ - -T ${lds} ${KBUILD_VMLINUX_INIT} \ - --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} + -T ${lds} ${objects} ${1} else ${CC} ${CFLAGS_vmlinux} -o ${2} \ -Wl,-T,${lds} ${KBUILD_VMLINUX_INIT} \