diff mbox

[4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected

Message ID CA+7wUsy1KaWc0LJNXieNTtQcfoQyg-kFp10nGoTzVe7CdXYOyg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mathieu Malaterre May 2, 2018, 9:17 a.m. UTC
Nick,

On Sat, Apr 21, 2018 at 4:48 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
> On Fri, 20 Apr 2018 22:08:27 +0200
> Mathieu Malaterre <malat@debian.org> wrote:
>
>> On Fri, Apr 20, 2018 at 12:41 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> > On Fri, 20 Apr 2018 12:00:49 +0200
>> > Mathieu Malaterre <malat@debian.org> wrote:
>> >
>> >> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> >> > This requires further changes to linker script to KEEP some tables
>> >> > and wildcard compiler generated sections into the right place. This
>> >> > includes pp32 modifications from Christophe Leroy.
>> >> >
>> >> > When compiling powernv_defconfig with this option:
>> >> >
>> >> > text       data      bss       dec        filename
>> >> > 11827621   4810490   1341080   17979191   vmlinux
>> >> > 11752437   4598858   1338776   17690071   vmlinux.dcde
>> >> >
>> >> > Resulting kernel is almost 400kB smaller (and still boots).
>> >> >
>> >> > [ppc32 numbers here]
>> >>
>> >> ^^^
>> >>
>> >> Do you want somebody else to provide those numbers ?
>> >
>> > If you have a booting kernel, yes some more numbers would be good.
>>
>> I've used /boot/config-4.15.0-2-powerpc from my current debian
>> package. Rebuild master with and without option, boot ok, load/unload
>> module ok.
>>
>> $ size nick/vmlinux.with*
>>    text    data     bss     dec     hex filename
>> 7386425 2364370 1425432 11176227 aa8923 nick/vmlinux.with
>> 7461457 2475122 1428064 11364643 ad6923 nick/vmlinux.without
>>
>> This is not clear why with option the size of kernel is slightly bigger:
>>
>> $ du -sk nick/vmlinux.with*
>> 124488 nick/vmlinux.with
>> 124004 nick/vmlinux.without
>
> Not sure. readelf -S vmlinux may show something.
>
> To really get lots of detail, you can add to the top level Makefile:
>
> LDFLAGS_vmlinux += -M

Here is what I did:

$ git diff

Then:

$ rm ppc32/arch/powerpc/kernel/vmlinux.lds
$ make O=ppc32 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- W=1 V=1

-> I did not see anything specific. I must be missing one step, but I
don't see which one.


> Then it will print the link map for you and other details. Actually
> it will output several times because we link vmlinux 2-3 times, so
> just take the last one. There is a lot of data there.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Nicholas Piggin May 2, 2018, 12:24 p.m. UTC | #1
On Wed, 2 May 2018 11:17:52 +0200
Mathieu Malaterre <malat@debian.org> wrote:

> Nick,
> 
> On Sat, Apr 21, 2018 at 4:48 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
> > On Fri, 20 Apr 2018 22:08:27 +0200
> > Mathieu Malaterre <malat@debian.org> wrote:
> >  
> >> On Fri, Apr 20, 2018 at 12:41 PM, Nicholas Piggin <npiggin@gmail.com> wrote:  
> >> > On Fri, 20 Apr 2018 12:00:49 +0200
> >> > Mathieu Malaterre <malat@debian.org> wrote:
> >> >  
> >> >> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:  
> >> >> > This requires further changes to linker script to KEEP some tables
> >> >> > and wildcard compiler generated sections into the right place. This
> >> >> > includes pp32 modifications from Christophe Leroy.
> >> >> >
> >> >> > When compiling powernv_defconfig with this option:
> >> >> >
> >> >> > text       data      bss       dec        filename
> >> >> > 11827621   4810490   1341080   17979191   vmlinux
> >> >> > 11752437   4598858   1338776   17690071   vmlinux.dcde
> >> >> >
> >> >> > Resulting kernel is almost 400kB smaller (and still boots).
> >> >> >
> >> >> > [ppc32 numbers here]  
> >> >>
> >> >> ^^^
> >> >>
> >> >> Do you want somebody else to provide those numbers ?  
> >> >
> >> > If you have a booting kernel, yes some more numbers would be good.  
> >>
> >> I've used /boot/config-4.15.0-2-powerpc from my current debian
> >> package. Rebuild master with and without option, boot ok, load/unload
> >> module ok.
> >>
> >> $ size nick/vmlinux.with*
> >>    text    data     bss     dec     hex filename
> >> 7386425 2364370 1425432 11176227 aa8923 nick/vmlinux.with
> >> 7461457 2475122 1428064 11364643 ad6923 nick/vmlinux.without
> >>
> >> This is not clear why with option the size of kernel is slightly bigger:
> >>
> >> $ du -sk nick/vmlinux.with*
> >> 124488 nick/vmlinux.with
> >> 124004 nick/vmlinux.without  
> >
> > Not sure. readelf -S vmlinux may show something.
> >
> > To really get lots of detail, you can add to the top level Makefile:
> >
> > LDFLAGS_vmlinux += -M  
> 
> Here is what I did:
> 
> $ git diff
> diff --git a/Makefile b/Makefile
> index 619a85ad716b..1a2e3d142a59 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -4,6 +4,7 @@ PATCHLEVEL = 17
>  SUBLEVEL = 0
>  EXTRAVERSION = -rc3
>  NAME = Fearless Coyote
> +LDFLAGS_vmlinux += -M

That'll get overwritten further down. Put it down with another line
that starts with LDFLAGS_vmlinux +=

Thanks,
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mathieu Malaterre May 14, 2018, 7:10 p.m. UTC | #2
On Wed, May 2, 2018 at 2:24 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> On Wed, 2 May 2018 11:17:52 +0200
> Mathieu Malaterre <malat@debian.org> wrote:
>
>> Nick,
>>
>> On Sat, Apr 21, 2018 at 4:48 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> > On Fri, 20 Apr 2018 22:08:27 +0200
>> > Mathieu Malaterre <malat@debian.org> wrote:
>> >
>> >> On Fri, Apr 20, 2018 at 12:41 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> >> > On Fri, 20 Apr 2018 12:00:49 +0200
>> >> > Mathieu Malaterre <malat@debian.org> wrote:
>> >> >
>> >> >> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> >> >> > This requires further changes to linker script to KEEP some tables
>> >> >> > and wildcard compiler generated sections into the right place. This
>> >> >> > includes pp32 modifications from Christophe Leroy.
>> >> >> >
>> >> >> > When compiling powernv_defconfig with this option:
>> >> >> >
>> >> >> > text       data      bss       dec        filename
>> >> >> > 11827621   4810490   1341080   17979191   vmlinux
>> >> >> > 11752437   4598858   1338776   17690071   vmlinux.dcde
>> >> >> >
>> >> >> > Resulting kernel is almost 400kB smaller (and still boots).
>> >> >> >
>> >> >> > [ppc32 numbers here]
>> >> >>
>> >> >> ^^^
>> >> >>
>> >> >> Do you want somebody else to provide those numbers ?
>> >> >
>> >> > If you have a booting kernel, yes some more numbers would be good.
>> >>
>> >> I've used /boot/config-4.15.0-2-powerpc from my current debian
>> >> package. Rebuild master with and without option, boot ok, load/unload
>> >> module ok.
>> >>
>> >> $ size nick/vmlinux.with*
>> >>    text    data     bss     dec     hex filename
>> >> 7386425 2364370 1425432 11176227 aa8923 nick/vmlinux.with
>> >> 7461457 2475122 1428064 11364643 ad6923 nick/vmlinux.without
>> >>
>> >> This is not clear why with option the size of kernel is slightly bigger:
>> >>
>> >> $ du -sk nick/vmlinux.with*
>> >> 124488 nick/vmlinux.with
>> >> 124004 nick/vmlinux.without
>> >
>> > Not sure. readelf -S vmlinux may show something.
>> >
>> > To really get lots of detail, you can add to the top level Makefile:
>> >
>> > LDFLAGS_vmlinux += -M
>>
>> Here is what I did:
>>
>> $ git diff
>> diff --git a/Makefile b/Makefile
>> index 619a85ad716b..1a2e3d142a59 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -4,6 +4,7 @@ PATCHLEVEL = 17
>>  SUBLEVEL = 0
>>  EXTRAVERSION = -rc3
>>  NAME = Fearless Coyote
>> +LDFLAGS_vmlinux += -M
>
> That'll get overwritten further down. Put it down with another line
> that starts with LDFLAGS_vmlinux +=

Sorry about that, I was not paying attention :(

Anyway I cannot make sense of the output with -M.

Here is a quick summary if needed (with option / without option).

$ ./scripts/bloat-o-meter nick/vmlinux.without nick/vmlinux.with | head
add/remove: 0/647 grow/shrink: 852/1846 up/down: 11276/-95033 (-83757)
Function                                     old     new   delta
SiSInitPtr                                  2212    2600    +388
xmon_core.isra                              7540    7900    +360
ata_attach_transport                         840    1032    +192
via_pmu_interrupt                           2828    3004    +176
matroxfb_init                               3000    3156    +156
fbcon_scroll                                3092    3248    +156
__do_adjtimex                               1716    1868    +152
fbcon_event_notify                          2044    2184    +140
$ ./scripts/bloat-o-meter nick/vmlinux.without nick/vmlinux.with | tail
aty_set_pll18818                             540       -    -540
sel_ib_pkey_sid                              556       -    -556
pci_dev_acs_enabled                          608       -    -608
aa_label_find_merge                          752       -    -752
drmem_update_dt                              796       -    -796
powerpc_macros                              1176       -   -1176
ima_restore_measurement_list                1224       -   -1224
rtas_os_term_buf                            2048       -   -2048
vle_opcodes                                 8200       -   -8200
Total: Before=9927171, After=9843414, chg -0.84%


> Thanks,
> Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 619a85ad716b..1a2e3d142a59 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@  PATCHLEVEL = 17
 SUBLEVEL = 0
 EXTRAVERSION = -rc3
 NAME = Fearless Coyote
+LDFLAGS_vmlinux += -M

 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"