Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/conf Start using the kernel ld script.



details:   https://anonhg.NetBSD.org/src/rev/a7bf8ee44ad8
branches:  trunk
changeset: 992189:a7bf8ee44ad8
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Aug 17 20:16:07 2018 +0000

description:
Start using the kernel ld script.

There are still issues with the .init placement and ./build.sh creating bad
images.

diffstat:

 sys/arch/usermode/conf/Makefile.usermode |   6 ++--
 sys/arch/usermode/conf/kern.ldscript     |  37 +++++++++++++++++--------------
 2 files changed, 23 insertions(+), 20 deletions(-)

diffs (96 lines):

diff -r 4f82a36025c9 -r a7bf8ee44ad8 sys/arch/usermode/conf/Makefile.usermode
--- a/sys/arch/usermode/conf/Makefile.usermode  Fri Aug 17 16:04:39 2018 +0000
+++ b/sys/arch/usermode/conf/Makefile.usermode  Fri Aug 17 20:16:07 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.42 2018/06/01 07:22:33 reinoud Exp $
+# $NetBSD: Makefile.usermode,v 1.43 2018/08/17 20:16:07 reinoud Exp $
 
 MKCTF?=                                no
 USETOOLS?=                     no
@@ -74,9 +74,9 @@
 SYSTEM_LD=     @do_system_ld() { \
                ${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
                ${_MKSHECHO}\
-               ${CC} -static ${COPTS} -Wl,-Map,$${target}.map -o ${.TARGET} ${LINKFORMAT} -Ttext ${TEXTADDR} '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o ${USERMODE_LIBS} $$@; \
+               ${CC} -static ${COPTS} -Wl,-Map,$${target}.map -o ${.TARGET} ${LINKFORMAT} -Wl,-Ttext,${TEXTADDR} '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o netbsd.ldscript ${USERMODE_LIBS} $$@; \
                ${SYSTEM_LD_FIX} \
-               ${CC} -static ${COPTS} -Wl,-Map,$${target}.map -o ${.TARGET} ${LINKFORMAT} -Ttext ${TEXTADDR} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o ${USERMODE_LIBS} $$@; \
+               ${CC} -static ${COPTS} -Wl,-Map,$${target}.map -o ${.TARGET} ${LINKFORMAT} -Wl,-Ttext,${TEXTADDR} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o netbsd.ldscript ${USERMODE_LIBS} $$@; \
                }; \
                do_system_ld
 NVFLAGS=       -n
diff -r 4f82a36025c9 -r a7bf8ee44ad8 sys/arch/usermode/conf/kern.ldscript
--- a/sys/arch/usermode/conf/kern.ldscript      Fri Aug 17 16:04:39 2018 +0000
+++ b/sys/arch/usermode/conf/kern.ldscript      Fri Aug 17 20:16:07 2018 +0000
@@ -1,20 +1,28 @@
-/*     $NetBSD: kern.ldscript,v 1.1 2018/05/18 19:04:10 reinoud Exp $  */
+/*     $NetBSD: kern.ldscript,v 1.2 2018/08/17 20:16:07 reinoud Exp $  */
 
 #include "assym.h"
 
+__PAGE_SIZE = 0x1000 ;
+
 ENTRY(_start)
 SECTIONS
 {
        /* Read-only sections, merged into text segment: */
        .text :
        {
+               . = ALIGN(__PAGE_SIZE);
+               *(.text.user)
+               . = ALIGN(__PAGE_SIZE);
                *(.text)
                *(.text.*)
                *(.stub)
-       }
+               . = ALIGN(__PAGE_SIZE);
+       } =0xCC
+
        _etext = . ;
        PROVIDE (etext = .) ;
 
+       . = ALIGN(__PAGE_SIZE);
        .rodata :
        {
                *(.rodata)
@@ -25,7 +33,7 @@
         * 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);
        __data_start = . ;
        .data :
        {
@@ -52,22 +60,17 @@
                *(.bss)
                *(.bss.*)
                *(COMMON)
-               . = ALIGN(64 / 8);
        }
-       . = ALIGN(64 / 8);
+
+       . = ALIGN(__PAGE_SIZE);
        _end = . ;
        PROVIDE (end = .) ;
-       .note.netbsd.ident :
-       {
-               KEEP(*(.note.netbsd.ident));
-       }
+
+       /*
+        * .note.netbsd.ident :
+        * {
+        *      KEEP(*(.note.netbsd.ident));
+        * }
+        */
 }
 
-SECTIONS
-{
-       .text :
-       AT (ADDR(.text) & 0x0fffffff)
-       {
-               *(.text)
-       } = 0
-}



Home | Main Index | Thread Index | Old Index