public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] build system: section garbage collection
Date: Sat, 24 Nov 2007 15:14:26 -0800	[thread overview]
Message-ID: <200711241514.26451.vda.linux@googlemail.com> (raw)
In-Reply-To: <20071118230057.GA6303@uranus.ravnborg.org>

Hi Sam,

On Sunday 18 November 2007 15:00, Sam Ravnborg wrote:
> On Tue, Sep 11, 2007 at 09:05:33PM +0100, Denys Vlasenko wrote:
> > Build system: section garbage collection for vmlinux
> >
> > Newer gcc and binutils can do dead code and data removal
> > at link time. It is achieved using combination of
> > -ffunction-sections -fdata-sections options for gcc and
> > --gc-sections for ld.
>
> ...
> Hi Denys.
>
> We are now well pass the merge window and I like this patchset to show up
> in -mm. But I'm lacking time myself and wondered if you can send an updated
> version based on the latest -git tree from Linus?

Got around to do this.

1.fixname:
    Rename all special sections with names like .text.xxxx, .data.xxxx and
    .rodata.xxxx to .xxxx.text/data/rodata. This makes it possible to
    not mix up these sections with gcc-generated ones
    when gcc -ffunction-sections -fdata-sections is used.
    .bss.xxxx cannot be treated this way, because for section names
    linke .xxxx.bss gcc won't create section with correct attribute.
    Thus .bss.xxxxx sections are renamed .bss.k.xxxxx.

2.modpost
    Update scripts/mod/* machinery to correctly handle the case
    when we have more than 64k sections.

3.gc
    The meat of the patchset is here.
    Introduce config option DISCARD_UNUSED_SECTIONS.
    If it is selected:
    Pass -ffunction-sections -fdata-sections to gcc and 
    --gc-sections --print-gc-sections to ld.
    Use arch/$(SRCARCH)/kernel/modules.lds.S linker script for linking *.ko
    files.
    Generate linker map files for vmlinux and modules.
    Add *(.text.*), *(.data.*) wildcards to linker scripts to accomodate
    new kinds of sections generated by gcc.
    Add KEEP(<sections>) directives to sections which must not be discarded.
    Fix arch/frv/Makefile to use DISCARD_UNUSED_SECTIONS instead
    of what seems to be a vestigial custom solution.

Patches are against yesterday's Linus git tree and should be applied in order.
They should not have any effect at all if DISCARD_UNUSED_SECTIONS is off.
DISCARD_UNUSED_SECTIONS is marked DANGEROUS for now.
It is likely to not work on arches other than x86 (modules.lds needs to be 
added for each arch).

Compile and run tested on 32-bit x86 (running this kernel now).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
--
vda

  parent reply	other threads:[~2007-11-24 23:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 20:05 [PATCH 0/4] build system: section garbage collection for vmlinux Denys Vlasenko
2007-09-11 20:07 ` [PATCH 1/4] " Denys Vlasenko
2007-09-11 20:10   ` [PATCH 2/4] " Denys Vlasenko
2007-09-11 20:11     ` [PATCH 3/4] " Denys Vlasenko
2007-09-11 20:22       ` [PATCH 4/4] " Denys Vlasenko
2007-09-11 21:47   ` [PATCH 1/4] " Daniel Walker
2007-09-12 20:18     ` Denys Vlasenko
2007-09-12 20:52       ` Daniel Walker
2007-09-11 21:03 ` [PATCH 0/4] " Andi Kleen
2007-09-12 20:19   ` Denys Vlasenko
2007-09-13 18:26 ` Abhishek Sagar
2007-09-13 18:35   ` Sam Ravnborg
2007-09-14 18:06     ` Abhishek Sagar
     [not found] ` <20071118230057.GA6303@uranus.ravnborg.org>
2007-11-24 23:14   ` Denys Vlasenko [this message]
2007-11-24 23:17     ` [PATCH 1/3] build system: section garbage collection - rename sections Denys Vlasenko
2008-06-24  7:29       ` Matthieu CASTET
2007-11-24 23:17     ` [PATCH 2/3] build system: section garbage collection - modpost fix Denys Vlasenko
2007-11-24 23:18     ` [PATCH 3/3] build system: section garbage collection - main part Denys Vlasenko

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=200711241514.26451.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.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