kernel: Add bitcode support.

This commit is contained in:
Cristiano Giuffrida 2014-07-16 14:14:05 +02:00 committed by Lionel Sambuc
parent dea274570b
commit 8d9b87e365
2 changed files with 25 additions and 2 deletions

View file

@ -4,7 +4,6 @@
PROG= kernel PROG= kernel
BINDIR= /usr/sbin BINDIR= /usr/sbin
MAN= MAN=
USE_BITCODE= no
.include "arch/${MACHINE_ARCH}/Makefile.inc" .include "arch/${MACHINE_ARCH}/Makefile.inc"
@ -77,4 +76,16 @@ extracted-mtype.h: extract-mtype.sh ../include/minix/com.h
${_MKTARGET_CREATE} ${_MKTARGET_CREATE}
cd ${.CURDIR} ; ${HOST_SH} extract-mtype.sh > ${.OBJDIR}/extracted-mtype.h cd ${.CURDIR} ; ${HOST_SH} extract-mtype.sh > ${.OBJDIR}/extracted-mtype.h
.if ${USE_BITCODE:Uno} == "yes"
kernel: kernel.bcl.o
${_MKTARGET_LINK}
${_CCLINK.kernel} \
${_LDFLAGS.kernel} \
-L${DESTDIR}/usr/lib \
${_LDSTATIC.kernel} -o ${.TARGET} \
${.TARGET}.bcl.o ${OBJS} ${_PROGLDOPTS} ${_LDADD.kernel} \
${BITCODE_LD_FLAGS_2ND.kernel} \
-Wl,--allow-multiple-definition
.endif
.include <minix.service.mk> .include <minix.service.mk>

View file

@ -52,8 +52,20 @@ CPPFLAGS.subr_prf.c+= -DLIBSA_PRINTF_LONGLONG_SUPPORT -DLIBSA_PRINTF_WIDTH_SUPPO
pg_utils.o klib.o utility.o arch_reset.o \ pg_utils.o klib.o utility.o arch_reset.o \
io_inb.o io_outb.o \ io_inb.o io_outb.o \
${MINLIB_OBJS_UNPAGED} ${MINC_OBJS_UNPAGED} ${SYS_OBJS_UNPAGED} ${MINLIB_OBJS_UNPAGED} ${MINC_OBJS_UNPAGED} ${SYS_OBJS_UNPAGED}
CLEANFILES+=${unpaged_obj}.bin
.if ${USE_BITCODE:Uno} == "yes"
unpaged_${unpaged_obj}: ${unpaged_obj}
if file -b ${.OBJDIR}/${unpaged_obj} | grep -q '^LLVM'; then \
${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.OBJDIR}/${unpaged_obj}.bin ${.OBJDIR}/${unpaged_obj}; \
else \
cp ${.OBJDIR}/${unpaged_obj} ${.OBJDIR}/${unpaged_obj}.bin; \
fi
${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj}.bin $@
.else
unpaged_${unpaged_obj}: ${unpaged_obj} unpaged_${unpaged_obj}: ${unpaged_obj}
${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj} $@ ${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj} $@
.endif
UNPAGED_OBJS += unpaged_${unpaged_obj} UNPAGED_OBJS += unpaged_${unpaged_obj}
ORIG_UNPAGED_OBJS += ${unpaged_obj} ORIG_UNPAGED_OBJS += ${unpaged_obj}
.endfor .endfor
@ -104,7 +116,7 @@ PROCOFFSETSCF=procoffsets.cf
procoffsets.h: ${PROCOFFSETSCF} kernel.h proc.h stackframe.h archtypes.h procoffsets.h: ${PROCOFFSETSCF} kernel.h proc.h stackframe.h archtypes.h
${_MKTARGET_CREATE} ${_MKTARGET_CREATE}
${TOOL_CAT} ${HERE}/${PROCOFFSETSCF} | \ ${TOOL_CAT} ${HERE}/${PROCOFFSETSCF} | \
${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} >$@.tmp && \ ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${${USE_BITCODE:Uno} == "yes":? -fno-lto:} >$@.tmp && \
mv -f $@.tmp $@ mv -f $@.tmp $@
sconst.h: procoffsets.h sconst.h: procoffsets.h