Integrate magic instrumentation into build system
Magic instrumentation is now performed on all system services if the system is built with MKMAGIC=yes, which implies MKBITCODE=yes. Change-Id: I9d1233650188b7532a9356b720fb68d5f8248939
This commit is contained in:
parent
b2ed49a5d8
commit
bcc17a8117
@ -100,4 +100,7 @@ kernel: kernel.bcl.o
|
||||
-Wl,--allow-multiple-definition
|
||||
.endif
|
||||
|
||||
# Disable magic and ASR passes for the kernel.
|
||||
USE_MAGIC=no
|
||||
|
||||
.include <minix.service.mk>
|
||||
|
@ -85,7 +85,7 @@ fi
|
||||
########################
|
||||
# Build Minix
|
||||
########################
|
||||
export BUILDVARS=$(echo "${BUILDVARS} -V MKBITCODE=yes"| sed -e 's,-V MKMAGIC=yes,-V MKMAGIC=yes -V DBG=-g -V STRIPFLAG=-s -V CPPFLAGS=-D_MINIX_MAGIC=1,')
|
||||
export BUILDVARS
|
||||
|
||||
if [ "${REBUILD_MINIX}" == "yes" ]; then
|
||||
|
||||
|
@ -23,11 +23,7 @@ CPPFLAGS+= -I${NETBSDSRCDIR}/minix
|
||||
# data. For VM, we need to do the exact opposite, since for VM, the malloc
|
||||
# state is transferred as is. Thus, if the magic pass is enabled, tell it
|
||||
# to skip the regular malloc instrumentation features.
|
||||
.if !empty(OPTFLAGS:M*-magic*)
|
||||
OPTFLAGS.vm?= ${OPTFLAGS} \
|
||||
-magic-disable-mem-functions \
|
||||
-magic-disable-malloc-skip
|
||||
.endif
|
||||
MAGICFLAGS= -magic-disable-mem-functions -magic-disable-malloc-skip
|
||||
|
||||
.include "arch/${MACHINE_ARCH}/Makefile.inc"
|
||||
.include <minix.service.mk>
|
||||
|
@ -37,4 +37,20 @@ LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:}
|
||||
# Get (more) internal minix definitions and declarations.
|
||||
CPPFLAGS += -D_MINIX_SYSTEM=1
|
||||
|
||||
# For MKMAGIC builds, link services against libmagicrt and run the magic pass
|
||||
# on them, unless they have specifically requested to be built without bitcode.
|
||||
.if ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes"
|
||||
LIBMAGICST?= ${DESTDIR}${LIBDIR}/libmagicrt.bcc
|
||||
MAGICPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/magic.so
|
||||
|
||||
DPADD+= ${LIBMAGICST} ${MAGICPASS}
|
||||
|
||||
.for _P in ${PROGS:U${PROG}}
|
||||
BITCODE_LD_FLAGS_1ST.${_P}?= ${LIBMAGICST}
|
||||
.endfor
|
||||
|
||||
MAGICFLAGS?=
|
||||
OPTFLAGS+= -load ${MAGICPASS} -magic ${MAGICFLAGS}
|
||||
.endif # ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes"
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -22,6 +22,12 @@ CPPFLAGS+= -DNDEBUG
|
||||
DBG= -Os
|
||||
.endif
|
||||
|
||||
.if ${MKMAGIC:Uno} == "yes"
|
||||
CPPFLAGS+= -D_MINIX_MAGIC=1
|
||||
STRIPFLAG= -s
|
||||
DBG=-g
|
||||
.endif
|
||||
|
||||
#LSC: Be a bit smarter about the default compiler
|
||||
.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang)
|
||||
CC?= clang
|
||||
|
Loading…
x
Reference in New Issue
Block a user