i386 : Make arch/x86/kernel/acpi/wakeup_32.S use a separate text section
Subsystems (3)
PATCH 1/1 i386 : Make arch/x86/kernel/acpi/wakeup_32.S use a separate text section
While examining vmlinux namelist on i386 (nm -v vmlinux) I noticed :
c01021d0 t es7000_rename_gsic010221a T es7000_start_cpu
<Big Hole>c0103000 T thread_saved_pc
and
c0113218 T acpi_restore_state_memc0113219 T acpi_save_state_mem
<Big Hole>c0114000 t wakeup_code
This is because arch/x86/kernel/acpi/wakeup_32.S forces a .text alignment of 4096 bytes. (I have no idea if it is really needed, since arch/x86/kernel/acpi/wakeup_64.S uses a 16 bytes alignment *only*)
So arch/x86/kernel/built-in.o also has this alignment
arch/x86/kernel/built-in.o: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn 0 .text 00018c94 00000000 00000000 00001000 2**12
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
But as arch/x86/kernel/acpi/wakeup_32.o is not the first object linked into arch/x86/kernel/built-in.o, linker had to build several holes to meet alignement requirements, because of .o nestings in the kbuild process.
This can be solved by using a special section, .text.page_aligned, so that no holes are needed.
# size vmlinux.before vmlinux.after text data bss dec hex filename 4619942 422838 458752 5501532 53f25c vmlinux.before 4610534 422838 458752 5492124 53cd9c vmlinux.after
This saves 9408 bytes
arch/x86/kernel/acpi/wakeup_32.S +1 -1
@@ -1,4 +1,4 @@ -.text + .section .text.page_aligned #include <linux/linkage.h> #include <asm/segment.h> #include <asm/page.h>
arch/x86/kernel/vmlinux_32.lds.S +2 -0
@@ -44,6 +44,8 @@ SECTIONS /* read-only */ .text : AT(ADDR(.text) - LOAD_OFFSET) { + . = ALIGN(4096); /* not really needed, already page aligned */ + *(.text.page_aligned) TEXT_TEXT SCHED_TEXT LOCK_TEXT
Quoted 6 lines · Eric Dumazet
# size vmlinux.before vmlinux.after text data bss dec hex filename 4619942 422838 458752 5501532 53f25c vmlinux.before 4610534 422838 458752 5492124 53cd9c vmlinux.afterThis saves 9408 bytes
that's nice! Applied it to x86.git. I'm wondering, do we have other such cases? page alignment requirements are quite often for various CPU data structures.
Ingo
Quoted 7 lines · Ingo Molnar
Quoted 5 lines · Eric Dumazet
# size vmlinux.before vmlinux.after text data bss dec hex filename 4619942 422838 458752 5501532 53f25c vmlinux.before 4610534 422838 458752 5492124 53cd9c vmlinux.after
Quoted 5 lines
Quoted 1 line
This saves 9408 bytes
that's nice! Applied it to x86.git. I'm wondering, do we have other such cases? page alignment requirements are quite often for various CPU data structures.
They slip in from time to time, it would be nice to automate checking for them.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Quoted 35 lines · Eric Dumazet
While examining vmlinux namelist on i386 (nm -v vmlinux) I noticed :
c01021d0tes7000_rename_gsic010221aTes7000_start_cpu
<Big Hole>c0103000Tthread_saved_pcand
c0113218Tacpi_restore_state_memc0113219Tacpi_save_state_mem
<Big Hole>c0114000twakeup_codeThis is because
arch/x86/kernel/acpi/wakeup_32.Sforces a .text alignment of 4096 bytes. (I have no idea if it is really needed, sincearch/x86/kernel/acpi/wakeup_64.Suses a 16 bytes alignment *only*)So
arch/x86/kernel/built-in.oalso has this alignment
arch/x86/kernel/built-in.o: file format elf32-i386Sections:
Idx Name Size VMA LMA File off Algn 0 .text 00018c94 00000000 00000000 00001000 2**12CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
But as
arch/x86/kernel/acpi/wakeup_32.ois not the first object linked intoarch/x86/kernel/built-in.o, linker had to build several holes to meet alignement requirements, because of .o nestings in the kbuild process.This can be solved by using a special section, .text.page_aligned, so that no holes are needed.
Quoted 8 lines
# size vmlinux.before vmlinux.after text data bss dec hex filename 4619942 422838 458752 5501532 53f25c vmlinux.before 4610534 422838 458752 5492124 53cd9c vmlinux.afterThis saves 9408 bytes
Signed-off-by Eric Dumazet <[email protected]>
Seems okay to me, but I did not test it.
Quoted 29 lines
arch/x86/kernel/acpi/wakeup_32.S +1
-1@@ -1,4 +1,4 @@ -.text + .section .text.page_aligned #include <linux/linkage.h> #include <asm/segment.h> #include <asm/page.h>arch/x86/kernel/vmlinux_32.lds.S +2
-1@@ -44,6 +44,8 @@ SECTIONS /* read-only */ .text : AT(ADDR(.text) - LOAD_OFFSET) { + . = ALIGN(4096); /* not really needed, already page aligned */ + *(.text.page_aligned) TEXT_TEXT SCHED_TEXT LOCK_TEXT --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html