From: Arnd Bergmann <arnd@arndb.de>
To: Alan Modra <amodra@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org,
Nicholas Piggin <npiggin@gmail.com>,
linux-arch@vger.kernel.org,
Stephen Rothwell <sfr@canb.auug.org.au>,
Nicolas Pitre <nico@linaro.org>,
linux-kbuild@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/5] kbuild: allow archs to select build for link dead code/data elimination
Date: Mon, 08 Aug 2016 17:14:27 +0200 [thread overview]
Message-ID: <1882847.dG563Vieov@wuerfel> (raw)
In-Reply-To: <20160807234947.GV20904@bubble.grove.modra.org>
On Monday, August 8, 2016 9:19:47 AM CEST Alan Modra wrote:
> On Sun, Aug 07, 2016 at 10:26:19PM +0200, Arnd Bergmann wrote:
> > On Sunday, August 7, 2016 7:27:39 PM CEST Alan Modra wrote:
> > >
> > > If it can, then Nicholas' patch should be:
> > >
> > > *(.text.hot .text.hot.*) *(.text.unlikely .text.unlikely.*) *(.text .text.*)
> > >
> > > If you can't put .text.fixup too far away then you may as well just use
> > >
> > > *(.text .text.*)
> >
> > I tried this version:
> >
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index b1f8828e9eac..fc210dacac9a 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -438,7 +438,9 @@
> > * during second ld run in second ld pass when generating System.map */
> > #define TEXT_TEXT \
> > ALIGN_FUNCTION(); \
> > - *(.text.hot .text .text.fixup .text.unlikely .text.*) \
> > + *(.text.hot .text.hot.*) \
> > + *(.text.unlikely .text.fixup .text.unlikely.*) \
> > + *(.text .text.*) \
> > *(.ref.text) \
> > MEM_KEEP(init.text) \
> > MEM_KEEP(exit.text) \
> >
> > but that failed to link an allyesconfig kernel because of references
> > from .fixup to .text.*. Trying your version now:
>
> Well then, that proves you can't put .text.fixup too far aways from
> the associated input section.
>
> > *(.text.hot .text.hot.*) *(.text.unlikely .text.unlikely.*) *(.text .text.*)
>
> Which means this is guaranteed to fail when you test it properly using
> gcc's profiling options, in order to generate .text.hot* and/or
> .text.unlikely* sections.
I've investigated further and it seems that "*(.text.fixup) *(.text .text.*)"
fails just because we list .text.fixup twice. The .text.fixup section
was originally[1] introduced to work around the same link error that
it is causing now: if we use recursive linking, merging .text and .text.fixup
helps avoid the problems of sections that are >32MB before the final
link.
I have reverted that patch now, so ARM uses ".fixup" again like every
other architecture does, and now "*(.fixup) *(.text .text.*)" works
correctly, while ""*(.fixup) *(.text .fixup .text.*)" also fails
the same way that I saw before:
drivers/scsi/sg.o:(.fixup+0x4): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0xc): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x14): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x1c): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x24): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x2c): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x34): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x3c): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
drivers/scsi/sg.o:(.fixup+0x44): relocation truncated to fit: R_ARM_THM_JUMP24 against `.text.sg_ioctl'
I don't understand what led Andi Kleen to also move .text.hot and
.text.unlikely together with .text [2], but this may have
been a related issue.
> It seems to me the right thing to do would be to change kernel asm to
> generate .text.foo.fixup for any .text.foo section. A gas feature
> available with binutils-2.26 enabled by --sectname-subst might help
> with implementing that.
I think this what Nico wanted to use anyway to eliminate more functions
from the output.
Arnd
[1] http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8321
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8322
[2] https://lkml.org/lkml/2015/7/19/377
next prev parent reply other threads:[~2016-08-08 15:14 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 [this message]
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
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=1882847.dG563Vieov@wuerfel \
--to=arnd@arndb.de \
--cc=ak@linux.intel.com \
--cc=amodra@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nico@linaro.org \
--cc=npiggin@gmail.com \
--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).