From: Nicholas Piggin <npiggin@gmail.com>
To: Christophe LEROY <christophe.leroy@c-s.fr>
Cc: Mathieu Malaterre <malat@debian.org>,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] powerpc: Allow selection of CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
Date: Thu, 19 Apr 2018 15:10:08 +1000 [thread overview]
Message-ID: <20180419150955.6c2ae486@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <b098dd58-d8d3-0d42-6947-ea476bd2719d@c-s.fr>
On Wed, 18 Apr 2018 15:11:24 +0200
Christophe LEROY <christophe.leroy@c-s.fr> wrote:
> Le 18/04/2018 à 10:36, Mathieu Malaterre a écrit :
> > Christophe,
> >
> > On Wed, Apr 18, 2018 at 8:34 AM, Christophe LEROY
> > <christophe.leroy@c-s.fr> wrote:
> >>
> >>
> >> Le 17/04/2018 à 19:10, Mathieu Malaterre a écrit :
> >>>
> >>> On Tue, Apr 17, 2018 at 6:49 PM, Christophe LEROY
> >>> <christophe.leroy@c-s.fr> wrote:
> >>>>
> >>>>
> >>>>
> >>>> Le 17/04/2018 à 18:45, Mathieu Malaterre a écrit :
> >>>>>
> >>>>>
> >>>>> On Tue, Apr 17, 2018 at 12:49 PM, Christophe Leroy
> >>>>> <christophe.leroy@c-s.fr> wrote:
> >>>>>>
> >>>>>>
> >>>>>> This option does dead code and data elimination with the linker by
> >>>>>> compiling with -ffunction-sections -fdata-sections and linking with
> >>>>>> --gc-sections.
> >>>>>>
> >>>>>> By selecting this option on mpc885_ads_defconfig,
> >>>>>> vmlinux LOAD segment size gets reduced by 10%
> >>>>>>
> >>>>>> Program Header before the patch:
> >>>>>> LOAD off 0x00010000 vaddr 0xc0000000 paddr 0x00000000 align
> >>>>>> 2**16
> >>>>>> filesz 0x0036eda4 memsz 0x0038de04 flags rwx
> >>>>>>
> >>>>>> Program Header after the patch:
> >>>>>> LOAD off 0x00010000 vaddr 0xc0000000 paddr 0x00000000 align
> >>>>>> 2**16
> >>>>>> filesz 0x00316da4 memsz 0x00334268 flags rwx
> >>>>>>
> >>>>>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> >>>>>> ---
> >>>>>> arch/powerpc/Kconfig | 8 ++++++++
> >>>>>> 1 file changed, 8 insertions(+)
> >>>>>>
> >>>>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> >>>>>> index 8fe4353be5e3..e1fac49cf465 100644
> >>>>>> --- a/arch/powerpc/Kconfig
> >>>>>> +++ b/arch/powerpc/Kconfig
> >>>>>> @@ -888,6 +888,14 @@ config PPC_MEM_KEYS
> >>>>>>
> >>>>>> If unsure, say y.
> >>>>>>
> >>>>>> +config PPC_UNUSED_ELIMINATION
> >>>>>> + bool "Eliminate unused functions and data from vmlinux"
> >>>>>> + default n
> >>>>>> + select LD_DEAD_CODE_DATA_ELIMINATION
> >>>>>> + help
> >>>>>> + Select this to do dead code and data elimination with the
> >>>>>> linker
> >>>>>> + by compiling with -ffunction-sections -fdata-sections and
> >>>>>> linking
> >>>>>> + with --gc-sections.
> >>>>>> endmenu
> >>>>>>
> >>>>>
> >>>>> Just for reference, I cannot boot my Mac Mini G4 anymore (yaboot). The
> >>>>> messages I can see (prom_init) are:
> >>>>
> >>>>
> >>>>
> >>>> Which version of GCC do you use ?
> >>>
> >>>
> >>> $ powerpc-linux-gnu-gcc --version
> >>> powerpc-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
> >>> Copyright (C) 2016 Free Software Foundation, Inc.
> >>> This is free software; see the source for copying conditions. There is NO
> >>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> >>> PURPOSE.
> >>>
> >>> this is simply coming from:
> >>>
> >>> $ apt-cache policy crossbuild-essential-powerpc
> >>> crossbuild-essential-powerpc:
> >>> Installed: 12.3
> >>> Candidate: 12.3
> >>> Version table:
> >>> *** 12.3 500
> >>> 500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages
> >>> 500 http://ftp.fr.debian.org/debian stretch/main i386 Packages
> >>> 100 /var/lib/dpkg/status
> >>>
> >>>
> >>>> Can you provide the generated System.map with and without that option
> >>>> active
> >>>> ?
> >>>
> >>>
> >>> $ du -sh g4/System.map.*
> >>> 1.7M g4/System.map.with
> >>> 1.8M g4/System.map.without
> >>
> >>
> >> Here below is the list of objects removed with the option selected. I can't
> >> see anything suspect at first.
> >
> > Does this help:
> >
> > $ grep orphan /tmp/g4.log|grep prom_init
> > powerpc-linux-gnu-ld: warning: orphan section `.sbss.of_workarounds'
> > from `arch/powerpc/kernel/prom_init.o' being placed in section
> > `.sbss.of_workarounds'.
> > powerpc-linux-gnu-ld: warning: orphan section `.sbss.of_workarounds'
> > from `arch/powerpc/kernel/prom_init.o' being placed in section
> > `.sbss.of_workarounds'.
> > powerpc-linux-gnu-ld: warning: orphan section `.sbss.of_workarounds'
> > from `arch/powerpc/kernel/prom_init.o' being placed in section
> > `.sbss.of_workarounds'.
>
> Well, in a way yes. I initially thought that all those warnings where
> normal, but indeed not. We were missing some things in powerpc linker
> script, and most likely some sections ended up in the wrong place.
>
> Last week I tested on an 8xx and it was booting without any issue.
> I tested today on an 83xx and it was not booting.
>
> I will soon send new patches with the fixes in the linker scripts.
Yeah there needs to be a bit more work for powerpc before we can enable
this. I have some old patches I will dust off and re-send. I never got
modules working properly, I'll see if I can figure it out.
Thanks,
Nick
next prev parent reply other threads:[~2018-04-19 5:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 10:49 [PATCH] powerpc: Allow selection of CONFIG_LD_DEAD_CODE_DATA_ELIMINATION Christophe Leroy
2018-04-17 16:45 ` Mathieu Malaterre
2018-04-17 16:49 ` Christophe LEROY
2018-04-17 17:10 ` Mathieu Malaterre
2018-04-18 6:34 ` Christophe LEROY
2018-04-18 8:36 ` Mathieu Malaterre
2018-04-18 13:11 ` Christophe LEROY
2018-04-19 5:10 ` Nicholas Piggin [this message]
2018-04-18 15:13 ` Michael Ellerman
2018-04-24 18:48 ` Mathieu Malaterre
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=20180419150955.6c2ae486@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=malat@debian.org \
--cc=paulus@samba.org \
/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