linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Michal Marek <mmarek@suse.cz>, Sam Ravnborg <sam@ravnborg.org>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org, Bjorn Wesen <bjornw@axis.com>,
	Tim Bird <tim.bird@am.sony.com>, Tim Abbott <tabbott@ksplice.com>,
	Anders Kaseorg <andersk@ksplice.com>,
	Waseem Daher <wdaher@ksplice.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Andi Kleen <andi@firstfloor.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Denys Vlasenko <vda.linux@googlemail.com>
Subject: [PATCH 00/24] Rename kernel's magic sections for compatibility with -ffunction-sections -fdata-sections
Date: Sat, 20 Feb 2010 01:03:33 +0100	[thread overview]
Message-ID: <1266624237-22372-1-git-send-email-vda.linux@googlemail.com> (raw)

Hi Michal, Sam, folks,

Here is a new version of the -ffunction-sections -fdata-sections patch
series based on current Linus tree.

The last time a patch series for -ffunction-sections -fdata-sections
support was proposed for merge, Linus was concerned that the patch series
touched too much rapidly-changing code.  So it was decided that we should
first clean up the kernel's linker scripts to use macros when referring to
these sections, and then have a set of relatively small patches actually
renaming the sections in the macros.  The linker script cleanup work is
now done (the last bits were merged in the v2.6.33 merge window) and so
this is the patch series to actually rename the sections.  After this
patch series is merged, there will be a small set of patches needed to
actually enable -ffunction-sections -fdata-sections.

Support for building the kernel with -ffunction-sections -fdata-sections
has two applications:

(1) It is the prerequisite needed for section garbage collection
    (ld --gc-sections), which can shrink the kernel image by up to 10% on
    embedded kernels.
(2) It is the primary prerequisite change needed for the Ksplice
    rebootless update system.

The bulk of these patches replace section names like
.data.page_aligned to .data..page_aligned.

The problem is that with -ffunction-sections -fdata-sections gcc
creates sections like .text.head and .data.nosave
whenever someone has innocuous code like this:
    static void head(...) {...}
or this:
    static int nosave = 1;
somewhere in the kernel. Currently, kernel linker scripts
are confused by such names and put these sections in wrong places.

With these patches, and without adding -ffunction-sections
-fdata-section resulting kernel and modules do not materially
change. I checked it by examining ld -Map.

I run-tested these patches on x86-64, alone and with -ffunction-sections
-fdata-sections added to KBUILD_CFLAGS. In both cases kernel was booting
and working.

When these patches are applied, further plan is to modify linker scripts
so that they work correctly with gcc-generated .text.foo sections,
and they don't mix up gcc-generated .text.foo sections with special
.text..foo sections. Same applies for .data, .rodata, .bss.


avr32 specific question: Haavard, please take a look at patch #16.
It renames .text.reset to .text..reset in linker script.
However, I don't see where .text.reset section is generated.
Is the patch correct?


Please review, and if patches look okay, apply them.

Denys Vlasenko (19):
  Rename .bss.stack to .bss..stack.
  Rename .data.gate to .data..gate.
  Rename .data.init_irqstack to .data..init_irqstack.
  Rename .data..patch.XXX to .data..patch.XXX.
  Rename .data[.percpu][.XXX] to .data[..percpu][..XXX].
  Rename .data.read_mostly to .data..read_mostly.
  Rename .data.vmpages and .data.vm0.XXX to .data..vmpages and
    .data..vm0.XXX.
  Rename .rodata.compressed to .rodata..compressed.
  Rename .text.ivt to .text..ivt.
  Rename .text.lock to .text..lock.
  Rename .text.page_aligned to .text..page_aligned.
  Rename .text.reset to .text..reset.
  Rename .text.startup to .text..startup.
  Rename .data.nosave to .data..nosave.
  Rename .data.init to .data..init.
  Rename .data.initvect to .data..initvect.
  Rename .data.lock_aligned to .data..lock_aligned.
  Rename special text sections in arch/frv from .text.XXX to
    .text..XXX.
  Rename .text.start to .text..start.

Tim Abbott (5):
  Rename .data.cacheline_aligned to .data..cacheline_aligned.
  Rename .data.init_task to .data..init_task.
  powerpc: remove unused __page_aligned definition.
  Rename .data.page_aligned to .data..page_aligned.
  Rename .bss.page_aligned to .bss..page_aligned.

 Documentation/mutex-design.txt           |    4 +-
 arch/avr32/kernel/vmlinux.lds.S          |    2 +-
 arch/frv/kernel/break.S                  |    4 +-
 arch/frv/kernel/entry.S                  |    2 +-
 arch/frv/kernel/head.S                   |    2 +-
 arch/frv/kernel/vmlinux.lds.S            |   10 ++++----
 arch/frv/mm/tlb-miss.S                   |    2 +-
 arch/h8300/boot/compressed/head.S        |    2 +-
 arch/h8300/boot/compressed/vmlinux.lds   |    2 +-
 arch/ia64/include/asm/asmmacro.h         |   12 ++++----
 arch/ia64/include/asm/cache.h            |    2 +-
 arch/ia64/include/asm/percpu.h           |    2 +-
 arch/ia64/kernel/Makefile.gate           |    2 +-
 arch/ia64/kernel/gate-data.S             |    2 +-
 arch/ia64/kernel/gate.S                  |    8 +++---
 arch/ia64/kernel/gate.lds.S              |   10 ++++----
 arch/ia64/kernel/init_task.c             |    2 +-
 arch/ia64/kernel/ivt.S                   |    2 +-
 arch/ia64/kernel/minstate.h              |    4 +-
 arch/ia64/kernel/paravirtentry.S         |    2 +-
 arch/ia64/kernel/vmlinux.lds.S           |   28 +++++++++++-----------
 arch/ia64/kvm/vmm_ivt.S                  |    2 +-
 arch/ia64/xen/gate-data.S                |    2 +-
 arch/ia64/xen/xensetup.S                 |    2 +-
 arch/m68knommu/kernel/vmlinux.lds.S      |    4 +-
 arch/m68knommu/platform/68360/head-ram.S |    2 +-
 arch/m68knommu/platform/68360/head-rom.S |    2 +-
 arch/mips/lasat/image/head.S             |    2 +-
 arch/mips/lasat/image/romscript.normal   |    2 +-
 arch/parisc/include/asm/cache.h          |    2 +-
 arch/parisc/include/asm/system.h         |    2 +-
 arch/parisc/kernel/head.S                |    2 +-
 arch/parisc/kernel/init_task.c           |    6 ++--
 arch/parisc/kernel/vmlinux.lds.S         |   12 ++++----
 arch/powerpc/include/asm/cache.h         |    2 +-
 arch/powerpc/include/asm/page_64.h       |    8 ------
 arch/powerpc/kernel/vmlinux.lds.S        |   10 +++----
 arch/s390/include/asm/cache.h            |    2 +-
 arch/s390/kernel/swsusp_asm64.S          |    2 +-
 arch/sh/boot/compressed/vmlinux.scr      |    2 +-
 arch/sh/include/asm/cache.h              |    2 +-
 arch/sparc/boot/btfixupprep.c            |    2 +-
 arch/sparc/include/asm/cache.h           |    2 +-
 arch/um/kernel/dyn.lds.S                 |    2 +-
 arch/um/kernel/init_task.c               |    2 +-
 arch/um/kernel/uml.lds.S                 |    2 +-
 arch/x86/boot/compressed/mkpiggy.c       |    2 +-
 arch/x86/boot/compressed/vmlinux.lds.S   |    4 +-
 arch/x86/include/asm/cache.h             |    2 +-
 arch/x86/kernel/acpi/wakeup_32.S         |    2 +-
 arch/x86/kernel/init_task.c              |    2 +-
 arch/x86/kernel/setup_percpu.c           |    2 +-
 arch/x86/kernel/vmlinux.lds.S            |    4 +-
 include/asm-generic/percpu.h             |   10 ++++----
 include/asm-generic/vmlinux.lds.h        |   38 +++++++++++++++---------------
 include/linux/cache.h                    |    2 +-
 include/linux/init.h                     |    2 +-
 include/linux/init_task.h                |    2 +-
 include/linux/linkage.h                  |    8 +++---
 include/linux/percpu-defs.h              |    4 +-
 include/linux/spinlock.h                 |    2 +-
 kernel/module.c                          |    2 +-
 62 files changed, 132 insertions(+), 142 deletions(-)


             reply	other threads:[~2010-02-20  0:04 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-20  0:03 Denys Vlasenko [this message]
2010-02-20  0:03 ` [PATCH 01/24] Rename .data.cacheline_aligned to .data..cacheline_aligned Denys Vlasenko
2010-02-20  0:03 ` [PATCH 02/24] Rename .data.init_task to .data..init_task Denys Vlasenko
2010-02-20  0:03 ` [PATCH 03/24] powerpc: remove unused __page_aligned definition Denys Vlasenko
2010-02-20  0:03 ` [PATCH 04/24] Rename .data.page_aligned to .data..page_aligned Denys Vlasenko
2010-02-20  0:03 ` [PATCH 05/24] Rename .bss.page_aligned to .bss..page_aligned Denys Vlasenko
2010-02-20  0:03 ` [PATCH 06/24] Rename .bss.stack to .bss..stack Denys Vlasenko
2010-02-20  0:03 ` [PATCH 07/24] Rename .data.gate to .data..gate Denys Vlasenko
2010-02-20  0:03 ` [PATCH 08/24] Rename .data.init_irqstack to .data..init_irqstack Denys Vlasenko
2010-02-20  0:03 ` [PATCH 11/24] Rename .data.read_mostly to .data..read_mostly Denys Vlasenko
2010-02-20  0:03 ` [PATCH 13/24] Rename .rodata.compressed to .rodata..compressed Denys Vlasenko
2010-02-20  0:03 ` [PATCH 14/24] Rename .text.ivt to .text..ivt Denys Vlasenko
2010-02-20  0:03 ` [PATCH 15/24] Rename .text.lock to .text..lock Denys Vlasenko
2010-02-20  0:03 ` [PATCH 16/24] Rename .text.page_aligned to .text..page_aligned Denys Vlasenko
2010-02-20  0:03 ` [PATCH 17/24] Rename .text.reset to .text..reset Denys Vlasenko
2010-03-01  2:31   ` Tim Abbott
2010-03-01  4:37     ` Haavard Skinnemoen
2010-03-01  4:41   ` Haavard Skinnemoen
2010-02-20  0:03 ` [PATCH 18/24] Rename .text.startup to .text..startup Denys Vlasenko
2010-02-20  0:03 ` [PATCH 19/24] Rename .data.nosave to .data..nosave Denys Vlasenko
2010-02-20  0:03 ` [PATCH 20/24] Rename .data.init to .data..init Denys Vlasenko
2010-02-20  0:03 ` [PATCH 21/24] Rename .data.initvect to .data..initvect Denys Vlasenko
2010-02-20  0:03 ` [PATCH 22/24] Rename .data.lock_aligned to .data..lock_aligned Denys Vlasenko
2010-02-20  0:03 ` [PATCH 24/24] Rename .text.start to .text..start Denys Vlasenko
2010-02-20  0:37 ` [PATCH 09/24] Rename .data..patch.xxx to .data..patch.xxx Denys Vlasenko
2010-02-20  0:37 ` [PATCH 10/24] Rename .data[.percpu][.xxx] to .data[..percpu][..xxx] Denys Vlasenko
2010-02-20  0:37 ` [PATCH 12/24] Rename .data.vmpages and .data.vm0.xxx to .data..vmpages and .data..vm0.xxx Denys Vlasenko
2010-02-20  0:45 ` [PATCH 23/24] Rename special text sections in arch/frv from .text.xxx to .text..xxx Denys Vlasenko
2010-02-20  9:22 ` [PATCH 00/24] Rename kernel's magic sections for compatibility with -ffunction-sections -fdata-sections Andi Kleen
2010-02-20 21:58   ` Denys Vlasenko
2010-03-01  4:03 ` Tim Abbott
2010-03-03 10:23   ` Michal Marek
2010-03-09 15:56   ` Mike Frysinger
2010-03-11 15:04 ` David Howells

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=1266624237-22372-1-git-send-email-vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=andersk@ksplice.com \
    --cc=andi@firstfloor.org \
    --cc=bjornw@axis.com \
    --cc=dhowells@redhat.com \
    --cc=hpa@zytor.com \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tabbott@ksplice.com \
    --cc=tim.bird@am.sony.com \
    --cc=wdaher@ksplice.com \
    /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).