Source-Changes-HG archive

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

[src/trunk]: src/share/mk Enable dynamic link script generation to handle __{...



details:   https://anonhg.NetBSD.org/src/rev/4c01b70d7a1d
branches:  trunk
changeset: 333637:4c01b70d7a1d
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 12 02:19:28 2014 +0000

description:
Enable dynamic link script generation to handle __{start,stop}_link_set_*
via a variable; perhaps delete the variable and always do it?

diffstat:

 share/mk/bsd.kmodule.mk |  23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diffs (66 lines):

diff -r e3c4e0bf8b05 -r 4c01b70d7a1d share/mk/bsd.kmodule.mk
--- a/share/mk/bsd.kmodule.mk   Wed Nov 12 02:15:58 2014 +0000
+++ b/share/mk/bsd.kmodule.mk   Wed Nov 12 02:19:28 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.kmodule.mk,v 1.46 2014/11/06 12:05:44 uebayasi Exp $
+#      $NetBSD: bsd.kmodule.mk,v 1.47 2014/11/12 02:19:28 christos Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -11,6 +11,7 @@
 realinstall:   kmodinstall
 
 KERN=          $S/kern
+MKLDSCRIPT?=   no
 
 CFLAGS+=       -ffreestanding ${COPTS}
 CPPFLAGS+=     -nostdinc -I. -I${.CURDIR} -isystem $S -isystem $S/arch
@@ -72,9 +73,14 @@
 CLEANFILES+=   ${_YKMSRCS}
 
 .if exists($S/../sys/modules/xldscripts/kmodule)
-KMODSCRIPT=    $S/../sys/modules/xldscripts/kmodule
+KMODSCRIPTSRC= $S/../sys/modules/xldscripts/kmodule
 .else
-KMODSCRIPT=    ${DESTDIR}/usr/libdata/ldscripts/kmodule
+KMODSCRIPTSRC= ${DESTDIR}/usr/libdata/ldscripts/kmodule
+.endif
+.if ${MKLDSCRIPT} == "yes"
+KMODSCRIPT=    kldscript
+.else
+KMODSCRIPT=    ${KMODSCRIPTSRC}
 .endif
 
 PROG?=         ${KMOD}.kmod
@@ -102,6 +108,9 @@
 
 ${PROG}: ${XOBJS} ${XSRCS} ${DPSRCS} ${DPADD}
        ${_MKTARGET_LINK}
+.if ${MKLDSCRIPT} == "yes"
+       $S/conf/mkldscript.sh ${KMODSCRIPTSRC} ${XOBJS} > ${KMODSCRIPT}
+.endif
        ${CC} ${LDFLAGS} -nostdlib -MD -combine -r -Wl,-T,${KMODSCRIPT},-d \
                -Wl,-Map=${.TARGET}.map \
                -o ${.TARGET} ${CFLAGS} ${CPPFLAGS} ${XOBJS} \
@@ -151,6 +160,11 @@
 .else
 ${PROG}: ${OBJS} ${DPADD}
        ${_MKTARGET_LINK}
+.if ${MKLDSCRIPT} == "yes"
+       @rm -f ${KMODSCRIPT}
+       @OBJDUMP=${OBJDUMP} $S/conf/mkldscript.sh ${KMODSCRIPTSRC} ${OBJS} \
+           > ${KMODSCRIPT}
+.endif
        ${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \
                -Wl,-Map=${.TARGET}.map \
                -o ${.TARGET} ${OBJS}
@@ -200,6 +214,9 @@
 ##### Clean rules
 CLEANFILES+= a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS}
 CLEANFILES+= ${PROG}.map
+.if ${MKLDSCRIPT} == "yes"
+CLEANFILES+= kldscript
+.endif
 
 ##### Custom rules
 lint: ${LOBJS}



Home | Main Index | Thread Index | Old Index