Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Sync the ld scripts:



details:   https://anonhg.NetBSD.org/src/rev/8cdbeeb66bde
branches:  trunk
changeset: 323651:8cdbeeb66bde
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jun 24 18:24:53 2018 +0000

description:
Sync the ld scripts:

 * Force a PAGE_SIZE alignment of .bss on i386. Normally that's not
   required since the bootloader ensures page alignment, but let's be
   safe. Same on Xen-i386.

 * Fill the .text section padding with int3 instructions on Xen kernels,
   to prevent FALLTHROUGHs if a pointer goes crazy, same as native.

diffstat:

 sys/arch/amd64/conf/kern.ldscript.Xen |  15 ++++-----------
 sys/arch/i386/conf/kern.ldscript      |   4 ++--
 sys/arch/i386/conf/kern.ldscript.Xen  |  22 +++++++---------------
 3 files changed, 13 insertions(+), 28 deletions(-)

diffs (112 lines):

diff -r 8ded7d1412e3 -r 8cdbeeb66bde sys/arch/amd64/conf/kern.ldscript.Xen
--- a/sys/arch/amd64/conf/kern.ldscript.Xen     Sun Jun 24 17:11:57 2018 +0000
+++ b/sys/arch/amd64/conf/kern.ldscript.Xen     Sun Jun 24 18:24:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern.ldscript.Xen,v 1.15 2018/06/24 17:11:57 jdolecek Exp $    */
+/*     $NetBSD: kern.ldscript.Xen,v 1.16 2018/06/24 18:24:53 maxv Exp $        */
 
 #include "assym.h"
 
@@ -7,12 +7,13 @@
 ENTRY(_start)
 SECTIONS
 {
-       .text :
+       .text : AT (ADDR(.text))
        {
                *(.text)
                *(.text.*)
                *(.stub)
-       }
+               . = ALIGN(__PAGE_SIZE);
+       } =0xCC
        _etext = . ;
        PROVIDE (etext = .) ;
 
@@ -77,11 +78,3 @@
        }
 }
 
-SECTIONS
-{
-       .text :
-       AT (ADDR(.text))
-       {
-               *(.text)
-       } = 0
-}
diff -r 8ded7d1412e3 -r 8cdbeeb66bde sys/arch/i386/conf/kern.ldscript
--- a/sys/arch/i386/conf/kern.ldscript  Sun Jun 24 17:11:57 2018 +0000
+++ b/sys/arch/i386/conf/kern.ldscript  Sun Jun 24 18:24:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern.ldscript,v 1.21 2018/01/07 12:42:47 maxv Exp $    */
+/*     $NetBSD: kern.ldscript,v 1.22 2018/06/24 18:24:53 maxv Exp $    */
 
 #include "assym.h"
 
@@ -62,7 +62,7 @@
                *(.bss)
                *(.bss.*)
                *(COMMON)
-               . = ALIGN(32 / 8);
+               . = ALIGN(__PAGE_SIZE);
        }
 
        . = ALIGN(__PAGE_SIZE);
diff -r 8ded7d1412e3 -r 8cdbeeb66bde sys/arch/i386/conf/kern.ldscript.Xen
--- a/sys/arch/i386/conf/kern.ldscript.Xen      Sun Jun 24 17:11:57 2018 +0000
+++ b/sys/arch/i386/conf/kern.ldscript.Xen      Sun Jun 24 18:24:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern.ldscript.Xen,v 1.15 2018/01/07 12:42:47 maxv Exp $        */
+/*     $NetBSD: kern.ldscript.Xen,v 1.16 2018/06/24 18:24:53 maxv Exp $        */
 
 #include "assym.h"
 
@@ -6,12 +6,13 @@
 
 SECTIONS
 {
-       .text :
+       .text : AT (ADDR(.text))
        {
                *(.text)
                *(.text.*)
                *(.stub)
-       }
+               . = ALIGN(__PAGE_SIZE);
+       } =0xCC
        _etext = . ;
        PROVIDE (etext = .) ;
 
@@ -60,28 +61,19 @@
                *(.bss)
                *(.bss.*)
                *(COMMON)
-               . = ALIGN(32 / 8);
+               . = ALIGN(__PAGE_SIZE);
        }
-       . = ALIGN(32 / 8);
-       _end = . ;
-       PROVIDE (end = .) ;
 
        . = ALIGN(__PAGE_SIZE);
 
        /* End of the kernel image */
        __kernel_end = . ;
 
+       _end = . ;
+       PROVIDE (end = .) ;
        .note.netbsd.ident :
        {
                KEEP(*(.note.netbsd.ident));
        }
 }
 
-SECTIONS
-{
-       .text :
-       AT (ADDR(.text))
-       {
-               *(.text)
-       } = 0
-}



Home | Main Index | Thread Index | Old Index