From c2a6ec682421ff7b0ee6d1ca65f21c4bce569527 Mon Sep 17 00:00:00 2001 From: Cristiano Giuffrida Date: Sun, 15 Jun 2014 01:33:17 +0200 Subject: [PATCH] llvm: A few bitcode-related fixes. --- minix/llvm/build.llvm | 3 +- minix/llvm/common.inc.default | 13 +++++ minix/llvm/configure.llvm | 12 ++++- minix/llvm/minix.inc.default | 96 ----------------------------------- minix/llvm/relink.llvm | 22 +------- 5 files changed, 26 insertions(+), 120 deletions(-) create mode 100644 minix/llvm/common.inc.default delete mode 100644 minix/llvm/minix.inc.default diff --git a/minix/llvm/build.llvm b/minix/llvm/build.llvm index 760957b93..2dd0f0568 100755 --- a/minix/llvm/build.llvm +++ b/minix/llvm/build.llvm @@ -22,7 +22,7 @@ MINIX_MODS= # Set default values for essential variables : ${GENERATE_MAP="no"} -: ${C="hello"} +: ${C="servers,drivers"} function usage() { @@ -99,7 +99,6 @@ function check_args() check_current_dir # set up the bridge to llvm-apps repository and initialize -[ -f ${MINIX_LLVM_DIR}/minix.inc ] || cp ${MINIX_LLVM_DIR}/minix.inc.default ${MINIX_LLVM_DIR}/minix.inc . ${MINIX_LLVM_DIR}/minix.inc . ${ROOT}/apps/scripts/include/configure.llvm.inc diff --git a/minix/llvm/common.inc.default b/minix/llvm/common.inc.default new file mode 100644 index 000000000..155649f4b --- /dev/null +++ b/minix/llvm/common.inc.default @@ -0,0 +1,13 @@ +############################################################################## +# COMMON MINIX SPECIFIC VARIABLES +############################################################################## +DESTDIR=${MINIX_ROOT}/../obj.${ARCH} +TOOLDIR=${DESTDIR}/tooldir.`uname -s`-`uname -r`-`uname -m`/bin + +############################################################################## +# configure.llvm would add an entry for ROOT which points to the llvm-apps +# repository +# +############################################################################## +ROOT="/nonexistent" + diff --git a/minix/llvm/configure.llvm b/minix/llvm/configure.llvm index 5ca79f1c3..5dc67809e 100755 --- a/minix/llvm/configure.llvm +++ b/minix/llvm/configure.llvm @@ -63,9 +63,13 @@ echo "LLVM root directory is set to :" echo " ${ROOT}" # Persist the LLVM ROOT path information -[ -f ${MINIX_LLVM_DIR}/minix.inc ] || cp ${MINIX_LLVM_DIR}/minix.inc.default ${MINIX_LLVM_DIR}/minix.inc +. ${MINIX_LLVM_DIR}/minix.inc ROOT_1=`echo ${ROOT} | sed "s/\\\//\\\\\\\\\//g"` -sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/minix.inc +sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/common.inc + +# Configure llvm-apps +cp ${ROOT}/conf/common.minix.overrides.inc ${ROOT}/common.minix.overrides.inc +sed -i "s/MINIX_ROOT=.*$/MINIX_ROOT=\"${MINIX_ROOT}\"/g" ${ROOT}/common.minix.overrides.inc if [ ! -d ${ROOT}/.tmp ]; then mkdir ${ROOT}/.tmp 2>/dev/null || true @@ -132,3 +136,7 @@ if [ "${REBUILD_MINIX}" == "yes" ]; then else echo "Building Minix: NO" fi + +# Reconfigure llvm-apps +MINIX_TOOLS_DIR=$(readlink -f ${MINIX_ROOT}/obj.386/tooldir.*) +sed -i "s/MINIX_TOOLS_DIR=.*$/MINIX_TOOLS_DIR=\"${MINIX_TOOLS_DIR}\"/g" ${ROOT}/common.minix.overrides.inc diff --git a/minix/llvm/minix.inc.default b/minix/llvm/minix.inc.default deleted file mode 100644 index 1d29b5efa..000000000 --- a/minix/llvm/minix.inc.default +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -ARCH=i386 -MINIX_MODULES_MAPFILE=${MINIX_ROOT}/minix.mods.map -MINIX_LLVM_BIN_DIR=${MINIX_LLVM_DIR}/bin - -# generate_modules_map() -# -# Generates the ${MINIX_MODULES_MAPFILE} file - -function generate_modules_map() -{ - local TMPFILE="/tmp/.modules.map.tmp" - local OUTFILE="${MINIX_MODULES_MAPFILE}" - local currdir=`pwd` - - echo "Generating Minix modules map..." 1>&2 - cd ${MINIX_ROOT} - grep -r "^PROG=" . --include=Makefile | sed -e "s/\s*//g" | sed -e "s/PROG=//g" > ${TMPFILE} - - cat ${TMPFILE} | sed -e "s/\.\///g" > ${TMPFILE}.1 - - for l in `cat ${TMPFILE}.1`; do echo "`echo $l | cut -d: -f2`=`echo $l | cut -d: -f1`" | sed -e "s/\/Makefile//g"; done > ${OUTFILE} - - rm -rf ${TMPFILE} ${TMPFILE}.1 - - cd ${currdir} -} - -# get_modules_path -# -# Searches through the modules map and gets all the locations -# pertaining to the module(s) being searched. - -function get_modules_path() -{ - local MODULE_NAME=$1 - if [ ! -f "${MINIX_MODULES_MAPFILE}" ]; then - generate_modules_map - fi - - echo `grep "${MODULE_NAME}" ${MINIX_MODULES_MAPFILE} | cut -d= -f2` -} - -# get_module_name -# -# Given a module path, it gives its corresponding module name - -function get_module_name() -{ - local MODULE_PATH=$1 - if [ ! -f "${MINIX_MODULES_MAPFILE}" ]; then - generate_modules_map - fi - - echo `grep "${MODULE_PATH}$" ${MINIX_MODULES_MAPFILE} | cut -d= -f1` -} - -# clean_module() -# -# Cleans up the DESTDIR directory for the specified module - -function clean_module() -{ - local MODULE_NAME=$1 - local MODULE_PATH=$2 - local MODE=$3 # MODE can either be "relink" or "build" - local currdir=`pwd` - - # By default, clean only the potentially instrumented files - local TARGETS="${MODULE_NAME} *.opt.bcl *.bcl.o" - - if [ "${MODE}" == "relink" ]; then - TARGETS="${MODULE_NAME} *.o *.bcl" - fi - - if [ -d ${DESTDIR}/${MODULE_PATH} ]; then - cd ${DESTDIR}/${MODULE_PATH} - rm -rf ${TARGETS} 2> /dev/null || true - fi - - cd ${currdir} -} - -############################################################################## -# OTHER MINIX SPECIFIC VARIABLES -############################################################################## -DESTDIR=${MINIX_ROOT}/../obj.${ARCH} -TOOLDIR=${DESTDIR}/tooldir.`uname -s`-`uname -r`-`uname -m`/bin - -############################################################################## -# configure.llvm would add an entry for ROOT which points to the llvm-apps -# repository -# -############################################################################## -ROOT="/nonexistent" diff --git a/minix/llvm/relink.llvm b/minix/llvm/relink.llvm index cedcfe9bd..060c9941d 100755 --- a/minix/llvm/relink.llvm +++ b/minix/llvm/relink.llvm @@ -15,13 +15,12 @@ MINIX_ROOT= MINIX_LLVM_DIR= TARGET_MODULES= MINIX_MODS= -LIBNAMES= STATIC_LIBS= LDFLAGS_PLACEHOLDER=" " # Set default values to essential variables. : ${GENERATE_MAP="no"} -: ${C="hello"} +: ${C="servers,drivers"} function usage() { @@ -79,7 +78,6 @@ if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then fi # set up the bridge to llvm-apps repository and initialize -[ -f ${MINIX_LLVM_DIR}/minix.inc ] || cp ${MINIX_LLVM_DIR}/minix.inc.default ${MINIX_LLVM_DIR}/minix.inc . ${MINIX_LLVM_DIR}/minix.inc . ${ROOT}/apps/scripts/include/configure.llvm.inc @@ -91,22 +89,6 @@ echo " and" echo " ${MINIX_LLVM_BIN_DIR}" echo -LIBNAMES="$*" - -EXIT_FLAG=no -for l in ${LIBNAMES}; -do - if [ ! -f "${INSTALL_DIR}/$l.bcc" ] && [ ! -f "${MINIX_LLVM_BIN_DIR}/$l.bcc" ]; then - echo "ERROR: The LLVM pass file \"$l.bcc\" doesn't exit." - echo "Searched in: ${INSTALL_DIR} and ${MINIX_LLVM_BIN_DIR}." - EXIT_FLAG=yes - fi -done - -if [ "${EXIT_FLAG}" == "yes" ]; then - exit 2 -fi - # Picking up the selected modules if [ "${GENERATE_MAP}" != "" ] && [[ ${GENERATE_MAP} =~ [yY][eE][sS] ]]; then @@ -144,7 +126,7 @@ do clean_module $n $m "relink" if [ "${STATIC_LIBS}"!="" ]; then STATIC_LIBS=`echo ${STATIC_LIBS} | sed -e "s/\ /\\\ /g"` - LDFLAGS_PLACEHOLDER="BITCODE_LD_FLAGS.$n=\"${STATIC_LIBS}\"" + LDFLAGS_PLACEHOLDER="BITCODE_LD_FLAGS.$n=${STATIC_LIBS}" fi env "`echo ${LDFLAGS_PLACEHOLDER}`" MKBITCODE=yes \ -- 2.44.0