Source-Changes-HG archive

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

[src/trunk]: src/sys/conf If a kernel linker script is provided, preprocess i...



details:   https://anonhg.NetBSD.org/src/rev/92cbfe94d9d4
branches:  trunk
changeset: 340138:92cbfe94d9d4
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Mon Aug 24 15:50:47 2015 +0000

description:
If a kernel linker script is provided, preprocess it by cpp(1).

Thus some constants (PAGE_SIZE, COHERENCY_UNIT, ...) can be replaced in linker
scripts without setting unnecessary temporary symbols, or doing ugly sed(1)
hacks.  No headers are included yet.

diffstat:

 sys/conf/Makefile.kern.inc |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 7ff67a866141 -r 92cbfe94d9d4 sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc        Mon Aug 24 15:44:01 2015 +0000
+++ b/sys/conf/Makefile.kern.inc        Mon Aug 24 15:50:47 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.kern.inc,v 1.187 2015/08/24 15:44:01 uebayasi Exp $
+#      $NetBSD: Makefile.kern.inc,v 1.188 2015/08/24 15:50:47 uebayasi Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -230,8 +230,7 @@
 .endif
 SYSTEM_DEP+=   Makefile ${SYSTEM_OBJ} .gdbinit
 .if defined(KERNLDSCRIPT)
-SYSTEM_DEP+=   ${KERNLDSCRIPT}
-LINKSCRIPT=    -T ${KERNLDSCRIPT}
+SYSTEM_DEP+=   ${.TARGET}.ldscript
 .endif
 .if defined(CTFMERGE)
 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
@@ -251,6 +250,15 @@
 .endif
 .endif
 
+.if defined(KERNLDSCRIPT)
+.for k in ${KERNELS}
+EXTRA_CLEAN+=  ${k}.ldscript
+${k}.ldscript: ${KERNLDSCRIPT}
+       ${CPP} ${KERNLDSCRIPT} | grep -v '^#' >$@
+.endfor
+LINKSCRIPT=    -T ${.TARGET}.ldscript
+.endif
+
 TEXTADDR?=     ${LOADADDRESS}                  # backwards compatibility
 LINKTEXT?=     ${TEXTADDR:C/.+/-Ttext &/}
 LINKDATA?=     ${DATAADDR:C/.+/-Tdata &/}



Home | Main Index | Thread Index | Old Index