This replaces my earlier patch by the same title:
x86_64-vdso-linker-script-cleanup.patch


Thanks,
Roland

---

[PATCH] x86_64 vDSO linker script cleanup

This reorganizes the x86_64 vDSO layout to pack the contents better.
This yields a smaller image, while keeping code cache-aligned away
from data, and leaving more room to grow both in the .note section
(where --build-id can add some), and in the code (.text) section,
before the image grows past one 4kb page.

Signed-off-by: Roland McGrath <[EMAIL PROTECTED]>
Cc: Andi Kleen <[EMAIL PROTECTED]>
---
 arch/x86_64/vdso/vdso.lds.S |   47 +++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/arch/x86_64/vdso/vdso.lds.S b/arch/x86_64/vdso/vdso.lds.S
index b9a60e6..726bc6d 100644
--- a/arch/x86_64/vdso/vdso.lds.S
+++ b/arch/x86_64/vdso/vdso.lds.S
@@ -20,30 +20,47 @@ SECTIONS
   .gnu.version_d  : { *(.gnu.version_d) }
   .gnu.version_r  : { *(.gnu.version_r) }
 
+  /* The kernel does not need to know these addresses,
+     so they don't need to be before VDSO_TEXT_OFFSET.
+     Pack these in here to sop up the space used for the alignment.  */
+  .note                  : { *(.note.*) }              :text :note
+  .useless        : {
+       *(.got.plt) *(.got)
+       *(.gnu.linkonce.d.*)
+       *(.gnu.linkonce.b.*)
+  }                                            :text
+
   /* This linker script is used both with -r and with -shared.
      For the layouts to match, we need to skip more than enough
      space for the dynamic symbol table et al.  If this amount
-     is insufficient, ld -shared will barf.  Just increase it here.  */
+     is insufficient, ld -shared will barf.
+     Just increase VDSO_TEXT_OFFSET (in voffset.h).  */
   . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
 
-  .text           : { *(.text) }               :text
-  .text.ptr       : { *(.text.ptr) }           :text
-  . = VDSO_PRELINK + 0x900;
-  .data           : { *(.data) }               :text
-  .bss            : { *(.bss) }                        :text
+  .rodata         : { *(.rodata*) }            :text
+  .data                  : {
+       *(.data*)
+       *(.sdata*)
+       *(.bss*)
+       *(.dynbss*)
+  }                                            :text
 
-  .altinstructions : { *(.altinstructions) }                   :text
-  .altinstr_replacement  : { *(.altinstr_replacement) }        :text
+  .dynamic        : { *(.dynamic) }            :text :dynamic
 
-  .note                  : { *(.note.*) }              :text :note
   .eh_frame_hdr   : { *(.eh_frame_hdr) }       :text :eh_frame_hdr
   .eh_frame       : { KEEP (*(.eh_frame)) }    :text
-  .dynamic        : { *(.dynamic) }            :text :dynamic
-  .useless        : {
-       *(.got.plt) *(.got)
-       *(.gnu.linkonce.d.*)
-       *(.dynbss)
-       *(.gnu.linkonce.b.*)
+
+  .altinstructions : { *(.altinstructions) }           :text
+  .altinstr_replacement  : { *(.altinstr_replacement) }        :text
+
+  /* Separate actual executed code from other data for happy caches.  */
+  . = ALIGN(128);
+
+  .text           : {
+       FILL(0x90909090);
+       *(.text .stub .text.* .gnu.linkonce.t.*)
+       KEEP (*(.text.*personality*))
+       . = ALIGN(128);
   }                                            :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/

Reply via email to