linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Nicolas Pitre <nico@linaro.org>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Alan Modra <amodra@gmail.com>
Subject: Re: [RFC][PATCH 0/5] kbuild changes, thin archives, --gc-sections
Date: Mon, 8 Aug 2016 13:53:51 +1000	[thread overview]
Message-ID: <20160808135351.19413e49@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <8649964.jra1Y5q7Kz@wuerfel>

On Sun, 07 Aug 2016 22:23:02 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday, August 5, 2016 10:11:58 PM CEST Nicholas Piggin wrote:
> > Hello,
> > 
> > I have 3 different things in this patchset. All arch specific, but all
> > involve kbuild changes, so I'd like to discuss them with kbuild
> > maintainers. The goal has been to improve long standing linking
> > difficulties with the powerpc kernel.
> > 
> > * First, building kernel using thin archives rather than incremental
> >   linking. This seems quite clean and is per-arch, so I hope it should
> >   not be too controversial.
> > 
> > * Second, building kernel using -ffunction-sections -fdata-sections,
> >   --gc-sections. Yes, I'm spinning the wheel again. It was motivated
> >   by tiny codesize regression in the first patch, but the results seem
> >   too good to ignore.
> > 
> > * Third, allowing architecture to run a tool over module after it has
> >   been linked. Powerpc wants to use it in order to relocate "alternate
> >   code" instructions that get don't get linked at their runtime
> >   address. No idea if this is the right approach wrt kbuild, but it
> >   seems to work.
> > 
> > I have included the powerpc code for the first two as a reference. The
> > third is much bigger and mostly uninteresting for this cc list, but it
> > can be found here:
> > 
> >  https://patchwork.ozlabs.org/patch/651006/
> > 
> > Comments appreciated.
> > 
> >   
> 
> I've started tested this a bit on ARM now. The first things I noticed
> are:
> 
> 1. /home/arnd/cross-gcc/bin/arm-linux-gnueabi-ld: warning: drivers/xen/efi.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
> 
> (actually this one has been present since the first version that
> stopped using recursive linking, I did 971a69db7dc0 ("Xen: don't
> warn about 2-byte wchar_t in efi") when I first saw the bug, but
> that fix no longer works and we have to do this differently
> 
> 2. big-endian builds on ARM stopped working, I now get
> 
> 22:53:02   CC      init/do_mounts_md.o
> 22:53:02   LD      init/mounts.o
> /home/arnd/cross-gcc/bin/arm-linux-gnueabi-ld: init/do_mounts.o: compiled for a big endian system and target is little endian
> /home/arnd/cross-gcc/bin/arm-linux-gnueabi-ld: failed to merge target specific data of file init/do_mounts.o
> 
> The problem seems to be that we don't pass the correct linker
> flags any more, it should be using --be8 from
> 
> arch/arm/Makefile:LDFLAGS_vmlinux       += --be8
> arch/arm/Makefile:LDFLAGS_MODULE        += --be8
> 
> but that somehow is lost.

These both seem like linker flags are being lost for some reason, but I
don't really know why. Maybe ARM's Makefile. I don't have an ARM build setup
but I'll try to help track it down when I get some time.


> 3. drivers/firmware/efi/libstub/lib.a: error adding symbols: Archive has no index; run ranlib to add one
> 
> haven't investigated at all, turned off EFI for now.

Okay this looks like a bug in patch 2 (caused by me, not Stephen!)

For thin archives, cmd_link_l_target should be:

cmd_link_l_target = rm -f $@; $(AR) rcT$(KBUILD_ARFLAGS) $@ $(lib-y)

(note no "S" option).

Thanks,
Nick

  reply	other threads:[~2016-08-08  3:53 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 12:11 [RFC][PATCH 0/5] kbuild changes, thin archives, --gc-sections Nicholas Piggin
2016-08-05 12:11 ` Nicholas Piggin
2016-08-05 12:11 ` [PATCH 1/5] kbuild: allow architectures to use thin archives instead of ld -r Nicholas Piggin
2016-08-06  3:50   ` kbuild test robot
2016-08-06  3:50     ` kbuild test robot
2016-08-06 20:10   ` Sam Ravnborg
2016-08-07  1:49     ` Stephen Rothwell
2016-08-07  1:49       ` Stephen Rothwell
2016-08-07  3:34       ` Alan Modra
2016-08-07  4:17       ` Nicolas Pitre
2016-08-07 14:40       ` Sam Ravnborg
2016-08-07 14:40         ` Sam Ravnborg
2016-08-08  3:19         ` Nicholas Piggin
2016-08-08  4:46           ` Sam Ravnborg
2016-08-08  4:46             ` Sam Ravnborg
2016-08-08  3:25     ` Nicholas Piggin
2016-08-08  9:18       ` Arnd Bergmann
2016-08-08  9:18         ` Arnd Bergmann
2016-08-05 12:12 ` [PATCH 2/5] kbuild: allow archs to select build for link dead code/data elimination Nicholas Piggin
2016-08-05 12:12   ` Nicholas Piggin
2016-08-06 20:14   ` Sam Ravnborg
2016-08-08  3:29     ` Nicholas Piggin
2016-08-08  4:49       ` Sam Ravnborg
2016-08-07  5:33   ` Nicolas Pitre
2016-08-08  3:42     ` Nicholas Piggin
2016-08-08  3:42       ` Nicholas Piggin
2016-08-08  4:12       ` Nicolas Pitre
2016-08-08  4:12         ` Nicolas Pitre
2016-08-08  4:27         ` Nicholas Piggin
2016-08-07  9:57   ` Alan Modra
2016-08-07  9:57     ` Alan Modra
2016-08-07 11:35     ` Andreas Schwab
2016-08-07 11:35       ` Andreas Schwab
2016-08-07 20:26     ` Arnd Bergmann
2016-08-07 23:49       ` Alan Modra
2016-08-07 23:49         ` Alan Modra
2016-08-08 15:14         ` Arnd Bergmann
2016-08-08 23:50           ` Alan Modra
2016-08-09 22:10             ` Arnd Bergmann
2016-08-09  3:16           ` Andi Kleen
2016-08-09  3:16             ` Andi Kleen
2016-08-09 22:29             ` Arnd Bergmann
2016-08-09 22:29               ` Arnd Bergmann
2016-08-09 23:08               ` Andi Kleen
2016-08-10  0:37               ` Andi Kleen
2016-08-10  0:37                 ` Andi Kleen
2016-08-05 12:12 ` [PATCH 3/5] kbuild: add arch specific post-module-link pass Nicholas Piggin
2016-08-05 12:12   ` Nicholas Piggin
2016-08-05 13:56   ` Nicholas Piggin
2016-08-06 20:16   ` Sam Ravnborg
2016-08-06 20:16     ` Sam Ravnborg
2016-08-08  3:30     ` Nicholas Piggin
2016-08-08  3:30       ` Nicholas Piggin
2016-08-05 12:12 ` [PATCH 4/5] powerpc: switch to using thin archives Nicholas Piggin
2016-08-05 12:12   ` Nicholas Piggin
2016-08-05 12:12 ` [PATCH 5/5] powerpc/64: use linker dce Nicholas Piggin
2016-08-05 13:32 ` [RFC][PATCH 0/5] kbuild changes, thin archives, --gc-sections Nicholas Piggin
2016-08-05 13:32   ` Nicholas Piggin
2016-08-07 20:23 ` Arnd Bergmann
2016-08-08  3:53   ` Nicholas Piggin [this message]
2016-08-08  3:53     ` Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160808135351.19413e49@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=amodra@gmail.com \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nico@linaro.org \
    --cc=segher@kernel.crashing.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).