mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
x86/vdso: Remove some redundant in-memory section headers
.data doesn't need to be separate from .rodata: they're both readonly. .altinstructions and .altinstr_replacement aren't needed by anything except vdso2c; strip them from the final image. While we're at it, rather than aligning the actual executable text, just shove some unused-at-runtime data in between real data and text. My vdso image is still above 4k, but I'm disinclined to try to trim it harder for 3.16. For future trimming, I suspect that these sections could be moved to later in the file and dropped from the in-memory image: .gnu.version and .gnu.version_d (this may lose versions in gdb) .eh_frame (should be harmless) .eh_frame_hdr (I'm not really sure) .hash (AFAIK nothing needs this section header) Signed-off-by: Andy Lutomirski <luto@amacapital.net> Link: http://lkml.kernel.org/r/2e96d0c49016ea6d026a614ae645e93edd325961.1403129369.git.luto@amacapital.net Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
bfad381c0d
commit
0e3727a883
@ -16,9 +16,6 @@ const char fake_shstrtab[] __attribute__((section(".fake_shstrtab"))) =
|
|||||||
".rodata\0"
|
".rodata\0"
|
||||||
".fake_shstrtab\0" /* Yay, self-referential code. */
|
".fake_shstrtab\0" /* Yay, self-referential code. */
|
||||||
".note\0"
|
".note\0"
|
||||||
".data\0"
|
|
||||||
".altinstructions\0"
|
|
||||||
".altinstr_replacement\0"
|
|
||||||
".eh_frame_hdr\0"
|
".eh_frame_hdr\0"
|
||||||
".eh_frame\0"
|
".eh_frame\0"
|
||||||
".text";
|
".text";
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# error unknown VDSO target
|
# error unknown VDSO target
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_FAKE_SHDRS 16
|
#define NUM_FAKE_SHDRS 13
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
@ -28,15 +28,17 @@ SECTIONS
|
|||||||
.gnu.version_d : { *(.gnu.version_d) }
|
.gnu.version_d : { *(.gnu.version_d) }
|
||||||
.gnu.version_r : { *(.gnu.version_r) }
|
.gnu.version_r : { *(.gnu.version_r) }
|
||||||
|
|
||||||
.note : { *(.note.*) } :text :note
|
|
||||||
|
|
||||||
.eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
|
|
||||||
.eh_frame : { KEEP (*(.eh_frame)) } :text
|
|
||||||
|
|
||||||
.dynamic : { *(.dynamic) } :text :dynamic
|
.dynamic : { *(.dynamic) } :text :dynamic
|
||||||
|
|
||||||
.rodata : {
|
.rodata : {
|
||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
|
*(.data*)
|
||||||
|
*(.sdata*)
|
||||||
|
*(.got.plt) *(.got)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
*(.bss*)
|
||||||
|
*(.dynbss*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ideally this would live in a C file, but that won't
|
* Ideally this would live in a C file, but that won't
|
||||||
@ -50,27 +52,28 @@ SECTIONS
|
|||||||
|
|
||||||
.fake_shstrtab : { *(.fake_shstrtab) } :text
|
.fake_shstrtab : { *(.fake_shstrtab) } :text
|
||||||
|
|
||||||
.data : {
|
|
||||||
*(.data*)
|
|
||||||
*(.sdata*)
|
|
||||||
*(.got.plt) *(.got)
|
|
||||||
*(.gnu.linkonce.d.*)
|
|
||||||
*(.bss*)
|
|
||||||
*(.dynbss*)
|
|
||||||
*(.gnu.linkonce.b.*)
|
|
||||||
}
|
|
||||||
|
|
||||||
.altinstructions : { *(.altinstructions) }
|
.note : { *(.note.*) } :text :note
|
||||||
.altinstr_replacement : { *(.altinstr_replacement) }
|
|
||||||
|
.eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
|
||||||
|
.eh_frame : { KEEP (*(.eh_frame)) } :text
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Align the actual code well away from the non-instruction data.
|
* Text is well-separated from actual data: there's plenty of
|
||||||
* This is the best thing for the I-cache.
|
* stuff that isn't used at runtime in between.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(0x100);
|
|
||||||
|
|
||||||
.text : { *(.text*) } :text =0x90909090,
|
.text : { *(.text*) } :text =0x90909090,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* At the end so that eu-elflint stays happy when vdso2c strips
|
||||||
|
* these. A better implementation would avoid allocating space
|
||||||
|
* for these.
|
||||||
|
*/
|
||||||
|
.altinstructions : { *(.altinstructions) } :text
|
||||||
|
.altinstr_replacement : { *(.altinstr_replacement) } :text
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The remainder of the vDSO consists of special pages that are
|
* The remainder of the vDSO consists of special pages that are
|
||||||
* shared between the kernel and userspace. It needs to be at the
|
* shared between the kernel and userspace. It needs to be at the
|
||||||
|
@ -92,7 +92,9 @@ static void BITSFUNC(copy_section)(struct BITSFUNC(fake_sections) *out,
|
|||||||
{
|
{
|
||||||
uint64_t flags = GET_LE(&in->sh_flags);
|
uint64_t flags = GET_LE(&in->sh_flags);
|
||||||
|
|
||||||
bool copy = flags & SHF_ALLOC;
|
bool copy = flags & SHF_ALLOC &&
|
||||||
|
strcmp(name, ".altinstructions") &&
|
||||||
|
strcmp(name, ".altinstr_replacement");
|
||||||
|
|
||||||
if (!copy)
|
if (!copy)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user