Source-Changes-HG archive

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

[src/trunk]: src/sys/rump Make (no pun intended) it possible to perform compo...



details:   https://anonhg.NetBSD.org/src/rev/aa6cce1334b5
branches:  trunk
changeset: 751272:aa6cce1334b5
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Jan 31 00:38:36 2010 +0000

description:
Make (no pun intended) it possible to perform component symbol
protection from a shell prompt with the command line:

    make -f /sys/rump/Makefile RUMP_SYMREN=module.kobj

This is benefitial especially on i386, where rump ABI matches the
kernel ABI (sans the renaming isolation).  In the above example
module.kobj can then be loaded in a rump kernel either statically
at link-time simply by giving module.kobj as an object to the
linker, or dynamically at runtime by calling rump_sys_modctl(MODCTL_LOAD).

diffstat:

 sys/rump/Makefile.rump |  31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 748b0cd6468d -r aa6cce1334b5 sys/rump/Makefile.rump
--- a/sys/rump/Makefile.rump    Sat Jan 30 23:19:55 2010 +0000
+++ b/sys/rump/Makefile.rump    Sun Jan 31 00:38:36 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.rump,v 1.45 2009/12/12 17:10:19 pooka Exp $
+#      $NetBSD: Makefile.rump,v 1.46 2010/01/31 00:38:36 pooka Exp $
 #
 
 WARNS?=                3       # XXX: src/sys won't compile with -Wsign-compare yet
@@ -60,23 +60,46 @@
 # toolchain to toolchain.  The good news, however, is that this will
 # be detected by a compile-time failure, so we can fairly easily manage
 # a quirktable here.
+#
+# We also allow calling ourselves externally with e.g.:
+# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj
+#
 .if ${MACHINE_CPU} == "mips"
 _SYMQUIRK='|_gp_disp'
 .elif ${MACHINE_CPU} == "hppa"
 _SYMQUIRK='|\$$\$$'
 .endif
+
+rump_symren: __archivebuild
+.if !defined(RUMP_SYMREN)
+       @echo "Must supply RUMP_SYMREN for target rump_symren"
+       @false
+.endif
+
+# if we are called from lib build (RUMP_SYMREN is not specified),
+# build the arrrrchive.  otherwise just rename symbols.
 __archivebuild: .USE
+.if defined(RUMP_SYMREN) && defined(RUMPTOP)
+       @echo "ERROR: RUMP_SYMREN can only be used standalone"
+       @false
+.endif
+.if defined(RUMP_SYMREN)
+       ${_MKMSG} " symbol rename " ${RUMP_SYMREN}
+.else
        ${_MKTARGET_BUILD}
        rm -f ${.TARGET}
        ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
-       ${NM} -go ${.TARGET} | ${TOOL_AWK} '    \
+.endif
+       ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} '    \
            $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
              {printf "%s rumpns_%s\n", $$NF, $$NF}' \
            | sort | uniq  > renametab.${.TARGET}
        ${OBJCOPY} --preserve-dates --redefine-syms \
-           renametab.${.TARGET} ${.TARGET}
+           renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}}
        rm -f renametab.${.TARGET}
+.if !defined(RUMP_SYMREN)
        ${AR} ${_ARRANFL} ${.TARGET}
-
+.endif
+       
 .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
 .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"



Home | Main Index | Thread Index | Old Index