From: Cristiano Giuffrida Date: Wed, 16 Jul 2014 12:14:05 +0000 (+0200) Subject: kernel: Add bitcode support. X-Git-Tag: v3.3.0~136 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/static/doc/zpipe.c?a=commitdiff_plain;h=8d9b87e36569eb54aafe7f76947f0b40c0c4e412;p=minix.git kernel: Add bitcode support. --- diff --git a/kernel/Makefile b/kernel/Makefile index aa9f066e2..546658b66 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -4,7 +4,6 @@ PROG= kernel BINDIR= /usr/sbin MAN= -USE_BITCODE= no .include "arch/${MACHINE_ARCH}/Makefile.inc" @@ -77,4 +76,16 @@ extracted-mtype.h: extract-mtype.sh ../include/minix/com.h ${_MKTARGET_CREATE} 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 diff --git a/kernel/arch/i386/Makefile.inc b/kernel/arch/i386/Makefile.inc index b9149f34b..2fc957a22 100644 --- a/kernel/arch/i386/Makefile.inc +++ b/kernel/arch/i386/Makefile.inc @@ -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 \ io_inb.o io_outb.o \ ${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} ${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj} $@ +.endif UNPAGED_OBJS += unpaged_${unpaged_obj} ORIG_UNPAGED_OBJS += ${unpaged_obj} .endfor @@ -104,7 +116,7 @@ PROCOFFSETSCF=procoffsets.cf procoffsets.h: ${PROCOFFSETSCF} kernel.h proc.h stackframe.h archtypes.h ${_MKTARGET_CREATE} ${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 $@ sconst.h: procoffsets.h