Rename kernel's magic sections for compatibility with -ffunction-sections -fdata-sections
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest24 patches 9 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/24 | Rename .data.cacheline_aligned to .data..cacheline_aligned.arch/ arch/ include/ +1 more | +4 | 0 replies | |
| 2/24 | Rename .data.init_task to .data..init_task.arch/ arch/ include/ +1 more | +5 | 0 replies | |
| 3/24 | powerpc: remove unused __page_aligned definition.arch/ | +0 | 0 replies | |
| 4/24 | Rename .data.page_aligned to .data..page_aligned.arch/ arch/ include/ +1 more | +5 | 0 replies | |
| 5/24 | Rename .bss.page_aligned to .bss..page_aligned.arch/ include/ include/ | +4 | 0 replies | |
| 6/24 | Rename .bss.stack to .bss..stack.arch/ arch/ | +2 | 0 replies | |
| 7/24 | Rename .data.gate to .data..gate.arch/ arch/ arch/ +1 more | +5 | 0 replies | |
| 8/24 | Rename .data.init_irqstack to .data..init_irqstack.arch/ arch/ arch/ | +3 | 0 replies | |
| 9/24 | Rename .data..patch.xxx to .data..patch.xxx.arch/ arch/ arch/ +2 more | +25 | 0 replies | |
| 10/24 | Rename .data[.percpu][.xxx] to .data[..percpu][..xxx].arch/ include/ include/ +2 more | +21 | 0 replies | |
| 11/24 | Rename .data.read_mostly to .data..read_mostly.arch/ arch/ arch/ +9 more | +12 | 0 replies | |
| 12/24 | Rename .data.vmpages and .data.vm0.xxx to .data..vmpages and .data..vm0.xxx.arch/ arch/ | +7 | 0 replies | |
| 13/24 | Rename .rodata.compressed to .rodata..compressed.arch/ arch/ arch/ | +4 | 0 replies | |
| 14/24 | Rename .text.ivt to .text..ivt.arch/ arch/ arch/ | +3 | 0 replies | |
| 15/24 | Rename .text.lock to .text..lock.Documentation/ arch/ arch/ +1 more | +6 | 0 replies | |
| 16/24 | Rename .text.page_aligned to .text..page_aligned.arch/ arch/ | +2 | 0 replies | |
| 17/24 | Rename .text.reset to .text..reset.arch/ | +1 | 3 replies | |
| 18/24 | Rename .text.startup to .text..startup.arch/ arch/ | +2 | 0 replies | |
| 19/24 | Rename .data.nosave to .data..nosave.arch/ include/ include/ | +3 | 0 replies | |
| 20/24 | Rename .data.init to .data..init.arch/ arch/ | +2 | 0 replies | |
| 21/24 | Rename .data.initvect to .data..initvect.arch/ arch/ arch/ | +3 | 0 replies | |
| 22/24 | Rename .data.lock_aligned to .data..lock_aligned.arch/ arch/ | +3 | 0 replies | |
| 23/24 | Rename special text sections in arch/frv from .text.xxx to .text..xxx.arch/ arch/ arch/ +2 more | +8 | 0 replies | |
| 24/24 | Rename .text.start to .text..start.arch/ arch/ | +2 | 0 replies |
Reviews trailers per patch
None of the 24 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Tim Abbott |
|---|---|
| Series | A-b |
| 1/24 | |
| 2/24 | |
| 3/24 | |
| 4/24 | |
| 5/24 | |
| 6/24 | |
| 7/24 | |
| 8/24 | |
| 9/24 | |
| 10/24 | |
| 11/24 | |
| 12/24 | |
| 13/24 | |
| 14/24 | |
| 15/24 | |
| 16/24 | |
| 17/24 | |
| 18/24 | |
| 19/24 | |
| 20/24 | |
| 21/24 | |
| 22/24 | |
| 23/24 | |
| 24/24 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 00/24] Rename kernel's magic sections for compatibility with -ffunction-sections -fdata-sections
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(-)