Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Align the segments properly, and split text+rodata ...



details:   https://anonhg.NetBSD.org/src/rev/ec8ab933d504
branches:  trunk
changeset: 346777:ec8ab933d504
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Aug 02 14:03:34 2016 +0000

description:
Align the segments properly, and split text+rodata in two separate segments
on Xen.

diffstat:

 sys/arch/amd64/conf/kern.ldscript.Xen |  25 ++++++++++++++++---------
 sys/arch/i386/conf/kern.ldscript.Xen  |  22 ++++++++++++----------
 2 files changed, 28 insertions(+), 19 deletions(-)

diffs (122 lines):

diff -r 3f008c992dbb -r ec8ab933d504 sys/arch/amd64/conf/kern.ldscript.Xen
--- a/sys/arch/amd64/conf/kern.ldscript.Xen     Tue Aug 02 13:53:44 2016 +0000
+++ b/sys/arch/amd64/conf/kern.ldscript.Xen     Tue Aug 02 14:03:34 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern.ldscript.Xen,v 1.12 2016/05/13 05:45:13 maxv Exp $        */
+/*     $NetBSD: kern.ldscript.Xen,v 1.13 2016/08/02 14:03:34 maxv Exp $        */
 
 #include "assym.h"
 
@@ -7,24 +7,26 @@
 ENTRY(_start)
 SECTIONS
 {
-       /* Read-only sections, merged into text segment: */
        .text :
        {
                *(.text)
                *(.text.*)
                *(.stub)
-               *(.rodata)
        }
        _etext = . ;
        PROVIDE (etext = .) ;
 
-       /*
-        * Adjust the address for the data segment.  We want to adjust up to
-        * the same address within the page on the next page up.
-        */
-       . = ALIGN(0x100000) + (. & (0x100000 - 1));
+       . = ALIGN(__PAGE_SIZE);
 
        __rodata_start = . ;
+       .rodata :
+       {
+               *(.rodata)
+               *(.rodata.*)
+       }
+
+       . = ALIGN(__PAGE_SIZE);
+
        __data_start = . ;
        .data :
        {
@@ -53,7 +55,12 @@
                *(COMMON)
                . = ALIGN(64 / 8);
        }
-       . = ALIGN(64 / 8);
+
+       . = ALIGN(__PAGE_SIZE);
+
+       /* End of the kernel image */
+       __kernel_end = . ;
+
        _end = . ;
        PROVIDE (end = .) ;
        .note.netbsd.ident :
diff -r 3f008c992dbb -r ec8ab933d504 sys/arch/i386/conf/kern.ldscript.Xen
--- a/sys/arch/i386/conf/kern.ldscript.Xen      Tue Aug 02 13:53:44 2016 +0000
+++ b/sys/arch/i386/conf/kern.ldscript.Xen      Tue Aug 02 14:03:34 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern.ldscript.Xen,v 1.12 2016/05/13 05:45:13 maxv Exp $        */
+/*     $NetBSD: kern.ldscript.Xen,v 1.13 2016/08/02 14:03:34 maxv Exp $        */
 
 #include "assym.h"
 
@@ -6,7 +6,6 @@
 
 SECTIONS
 {
-       /* Read-only sections, merged into text segment: */
        .text :
        {
                *(.text)
@@ -16,19 +15,17 @@
        _etext = . ;
        PROVIDE (etext = .) ;
 
+       . = ALIGN(__PAGE_SIZE);
+
+       __rodata_start = . ;
        .rodata :
        {
                *(.rodata)
                *(.rodata.*)
        }
 
-       /*
-        * Adjust the address for the data segment.  We want to adjust up to
-        * the same address within the page on the next page up.
-        */
-       . = ALIGN(0x1000) + (. & (0x1000 - 1));
+       . = ALIGN(__PAGE_SIZE);
 
-       __rodata_start = . ;
        __data_start = . ;
        .data :
        {
@@ -46,8 +43,8 @@
                *(.data.read_mostly)
        }
        . = ALIGN(COHERENCY_UNIT);
+
        _edata = . ;
-
        PROVIDE (edata = .) ;
        __bss_start = . ;
        .bss :
@@ -57,7 +54,12 @@
                *(COMMON)
                . = ALIGN(32 / 8);
        }
-       . = ALIGN(32 / 8);
+
+       . = ALIGN(__PAGE_SIZE);
+
+       /* End of the kernel image */
+       __kernel_end = . ;
+
        _end = . ;
        PROVIDE (end = .) ;
        .note.netbsd.ident :



Home | Main Index | Thread Index | Old Index