From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, luto@amacapital.net, hpa@zytor.com,
mingo@kernel.org, tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/urgent] x86/vdso: Remove some redundant in-memory section headers
Date: Fri, 20 Jun 2014 19:08:06 -0700 [thread overview]
Message-ID: <tip-0e3727a8839c988a3c56170bc8da76d55a16acad@git.kernel.org> (raw)
In-Reply-To: <2e96d0c49016ea6d026a614ae645e93edd325961.1403129369.git.luto@amacapital.net>
Commit-ID: 0e3727a8839c988a3c56170bc8da76d55a16acad
Gitweb: http://git.kernel.org/tip/0e3727a8839c988a3c56170bc8da76d55a16acad
Author: Andy Lutomirski <luto@amacapital.net>
AuthorDate: Wed, 18 Jun 2014 15:59:49 -0700
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 19 Jun 2014 15:45:26 -0700
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>
---
arch/x86/vdso/vdso-fakesections.c | 3 ---
arch/x86/vdso/vdso-layout.lds.S | 43 +++++++++++++++++++++------------------
arch/x86/vdso/vdso2c.h | 4 +++-
3 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/arch/x86/vdso/vdso-fakesections.c b/arch/x86/vdso/vdso-fakesections.c
index 56927a7..aa5fbfa 100644
--- a/arch/x86/vdso/vdso-fakesections.c
+++ b/arch/x86/vdso/vdso-fakesections.c
@@ -16,9 +16,6 @@ const char fake_shstrtab[] __attribute__((section(".fake_shstrtab"))) =
".rodata\0"
".fake_shstrtab\0" /* Yay, self-referential code. */
".note\0"
- ".data\0"
- ".altinstructions\0"
- ".altinstr_replacement\0"
".eh_frame_hdr\0"
".eh_frame\0"
".text";
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S
index e4cbc21..9197544 100644
--- a/arch/x86/vdso/vdso-layout.lds.S
+++ b/arch/x86/vdso/vdso-layout.lds.S
@@ -14,7 +14,7 @@
# error unknown VDSO target
#endif
-#define NUM_FAKE_SHDRS 16
+#define NUM_FAKE_SHDRS 13
SECTIONS
{
@@ -28,15 +28,17 @@ SECTIONS
.gnu.version_d : { *(.gnu.version_d) }
.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
.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
@@ -50,28 +52,29 @@ SECTIONS
.fake_shstrtab : { *(.fake_shstrtab) } :text
- .data : {
- *(.data*)
- *(.sdata*)
- *(.got.plt) *(.got)
- *(.gnu.linkonce.d.*)
- *(.bss*)
- *(.dynbss*)
- *(.gnu.linkonce.b.*)
- }
- .altinstructions : { *(.altinstructions) }
- .altinstr_replacement : { *(.altinstr_replacement) }
+ .note : { *(.note.*) } :text :note
+
+ .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.
- * This is the best thing for the I-cache.
+ * Text is well-separated from actual data: there's plenty of
+ * stuff that isn't used at runtime in between.
*/
- . = ALIGN(0x100);
.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
* shared between the kernel and userspace. It needs to be at the
* end so that it doesn't overlap the mapping of the actual
diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h
index f01ed4b..f42e2dd 100644
--- a/arch/x86/vdso/vdso2c.h
+++ b/arch/x86/vdso/vdso2c.h
@@ -92,7 +92,9 @@ static void BITSFUNC(copy_section)(struct BITSFUNC(fake_sections) *out,
{
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)
return;
next prev parent reply other threads:[~2014-06-21 2:08 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 22:59 [PATCH 0/5] x86,vdso: Restore a bunch of " Andy Lutomirski
2014-06-18 22:59 ` [PATCH 1/5] x86,vdso: Discard the __bug_table section Andy Lutomirski
2014-06-21 2:07 ` [tip:x86/urgent] x86/vdso: " tip-bot for Andy Lutomirski
2014-06-22 8:47 ` Ingo Molnar
2014-06-22 16:59 ` Andy Lutomirski
2014-06-24 18:19 ` Andy Lutomirski
2014-06-24 18:26 ` H. Peter Anvin
2014-06-24 18:37 ` Andy Lutomirski
2014-06-24 18:43 ` H. Peter Anvin
2014-06-24 19:40 ` Andy Lutomirski
2014-06-24 19:50 ` [PATCH 0/2] x86: Build fixes for tip/x86/urgent Andy Lutomirski
2014-06-24 19:50 ` [PATCH 1/2] x86,vdso: Move DISABLE_BRANCH_PROFILING into the vdso makefile Andy Lutomirski
2014-06-24 20:09 ` H. Peter Anvin
2014-06-24 19:50 ` [PATCH 2/2] x86,vdso2c: Error out if DT_RELA is present Andy Lutomirski
2014-06-24 20:46 ` [PATCH v2 0/2] x86: Build fixes for tip/x86/urgent Andy Lutomirski
2014-06-24 20:46 ` [PATCH v2 1/2] x86,vdso: Move DISABLE_BRANCH_PROFILING into the vdso makefile Andy Lutomirski
2014-06-24 22:16 ` [tip:x86/urgent] x86/vdso: " tip-bot for Andy Lutomirski
2014-06-24 20:46 ` [PATCH v2 2/2] x86,vdso2c: Error out if DT_RELA is present Andy Lutomirski
2014-06-24 22:16 ` [tip:x86/urgent] x86/vdso: Error out in vdso2c " tip-bot for Andy Lutomirski
2014-06-24 18:29 ` [tip:x86/urgent] x86/vdso: Discard the __bug_table section H. Peter Anvin
2014-06-24 18:47 ` H. Peter Anvin
2014-06-18 22:59 ` [PATCH 2/5] x86,vdso2c: Use better macros for ELF bitness Andy Lutomirski
2014-06-21 2:07 ` [tip:x86/urgent] x86/vdso2c: " tip-bot for Andy Lutomirski
2014-06-18 22:59 ` [PATCH 3/5] x86,vdso: Improve the fake section headers Andy Lutomirski
2014-06-21 2:07 ` [tip:x86/urgent] x86/vdso: " tip-bot for Andy Lutomirski
2014-06-18 22:59 ` [PATCH 4/5] x86,vdso: Remove some redundant in-memory " Andy Lutomirski
2014-06-21 2:08 ` tip-bot for Andy Lutomirski [this message]
2014-06-18 22:59 ` [PATCH 5/5] x86,vdso: Create .build-id links for unstripped vdso files Andy Lutomirski
2014-06-19 22:46 ` H. Peter Anvin
2014-06-19 23:59 ` Andy Lutomirski
2014-06-19 22:42 ` [PATCH 0/5] x86,vdso: Restore a bunch of section headers H. Peter Anvin
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=tip-0e3727a8839c988a3c56170bc8da76d55a16acad@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome