Break loose from llvm-apps entirely
Change-Id: I532f5f44c785c1a72407b504568d54fc6cbabf8f
This commit is contained in:
parent
0acd3f1ae0
commit
949a3e52e5
7 changed files with 58 additions and 64 deletions
|
@ -13,7 +13,6 @@ set -o errexit
|
|||
MYPWD=`pwd`
|
||||
MINIX_ROOT=
|
||||
MINIX_LLVM_DIR=
|
||||
LLVMPASS=
|
||||
LLVMARGS=
|
||||
LLVMPASS_PATHS=
|
||||
TARGET_MODULES=
|
||||
|
@ -98,9 +97,7 @@ function check_args()
|
|||
#Make sure we are running from the root dir of the Minix sources
|
||||
check_current_dir
|
||||
|
||||
# set up the bridge to llvm-apps repository and initialize
|
||||
. ${MINIX_LLVM_DIR}/minix.inc
|
||||
[ ! -f ${ROOT}/apps/scripts/include/configure.llvm.inc ] || . ${ROOT}/apps/scripts/include/configure.llvm.inc
|
||||
|
||||
# Arguments check
|
||||
check_args "$@"
|
||||
|
@ -132,7 +129,7 @@ done
|
|||
|
||||
# Show info
|
||||
echo "Build.llvm: Executing with following parameters..."
|
||||
echo "LLVM pass : ${LLVMPASS}"
|
||||
echo "LLVM pass : $@"
|
||||
echo "LLVM pass arguments : ${LLVMARGS}"
|
||||
echo "Target Minix modules : ${MINIX_MODS}"
|
||||
echo "OPTFLAGS value : ${OPTFLAGS}"
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
##############################################################################
|
||||
# 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"
|
||||
|
|
@ -15,10 +15,10 @@
|
|||
set -o errexit
|
||||
|
||||
MYPWD="`pwd`"
|
||||
ARCH=i386
|
||||
MINIX_ROOT=
|
||||
MINIX_LLVM_DIR=
|
||||
GOLD_DEST_DIR=
|
||||
DEFAULT_LLVM_ROOT=
|
||||
EXITCODE=0
|
||||
|
||||
function check_current_dir()
|
||||
|
@ -38,48 +38,38 @@ function check_current_dir()
|
|||
|
||||
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
|
||||
GOLD_DEST_DIR="${MINIX_ROOT}/minix/llvm/bin"
|
||||
DEFAULT_LLVM_ROOT="${MINIX_ROOT}/../../llvm-apps"
|
||||
|
||||
MINIX_ROOT_1=`readlink -f ${MINIX_ROOT}`
|
||||
MINIX_DEST_DIR=`readlink -f ${MINIX_ROOT}/../obj.${ARCH}`
|
||||
MINIX_TOOLS_DIR="${MINIX_DEST_DIR}/tooldir.`uname -s`-`uname -r`-`uname -m`"
|
||||
}
|
||||
|
||||
# Make sure we are running from the right directory
|
||||
check_current_dir
|
||||
|
||||
# LLVM ROOT is the bridging connection from minix branch to the llvm-apps branch
|
||||
if [ "${ROOT}" == "" ]; then
|
||||
|
||||
echo "\${ROOT} is not set."
|
||||
echo "Please specify the path to the \"llvm-apps\" repository..."
|
||||
echo "Default value: ${DEFAULT_LLVM_ROOT} . "
|
||||
echo "If this is correct, press ENTER. Otherwise please enter the path."
|
||||
if [ "$INTERACTIVE" = "no" ]; then
|
||||
response=""
|
||||
else
|
||||
read response
|
||||
fi
|
||||
|
||||
if [ "" == "${response}" ]; then
|
||||
ROOT=${DEFAULT_LLVM_ROOT}
|
||||
else
|
||||
ROOT=${response}
|
||||
fi
|
||||
# Create common.inc
|
||||
if [ ! -f ${MINIX_LLVM_DIR}/common.inc ]; then
|
||||
echo "# This file was automatically generated by configure.llvm" > ${MINIX_LLVM_DIR}/common.inc
|
||||
echo "DESTDIR=\"${MINIX_DEST_DIR}\"" >> ${MINIX_LLVM_DIR}/common.inc
|
||||
echo "TOOLDIR=\"${MINIX_TOOLS_DIR}/bin\"" >> ${MINIX_LLVM_DIR}/common.inc
|
||||
fi
|
||||
|
||||
STATIC_DIR="${MINIX_LLVM_DIR}/static"
|
||||
|
||||
if [ ! -f ${STATIC_DIR}/Makefile.common.inc ]; then
|
||||
echo "# This file was automatically generated by configure.llvm" > ${STATIC_DIR}/Makefile.common.inc
|
||||
echo "_MINIX_ARCH=${ARCH}" >> ${STATIC_DIR}/Makefile.common.inc
|
||||
echo "_MINIX_ROOT=${MINIX_ROOT_1}" >> ${STATIC_DIR}/Makefile.common.inc
|
||||
echo "_MINIX_TOOLS_DIR=${MINIX_TOOLS_DIR}" >> ${STATIC_DIR}/Makefile.common.inc
|
||||
fi
|
||||
echo "LLVM root directory is set to :"
|
||||
echo " ${ROOT}"
|
||||
|
||||
# Persist the LLVM ROOT path information
|
||||
[ -f ${MINIX_LLVM_DIR}/common.inc ] || cp ${MINIX_LLVM_DIR}/common.inc.default ${MINIX_LLVM_DIR}/common.inc
|
||||
ROOT_1=`echo ${ROOT} | sed "s/\\\//\\\\\\\\\//g"`
|
||||
sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/common.inc
|
||||
. ${MINIX_LLVM_DIR}/minix.inc
|
||||
|
||||
if [ ! -d ${ROOT}/.tmp ]; then
|
||||
mkdir ${ROOT}/.tmp 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Set default values for essential variables
|
||||
: ${JOBS=1}
|
||||
: ${GEN_GOLD_PLUGIN="yes"}
|
||||
: ${REBUILD_MINIX="yes"}
|
||||
: ${GEN_STATIC_MAGIC="yes"}
|
||||
|
||||
########################
|
||||
# Generate Gold Plugin
|
||||
|
@ -120,6 +110,7 @@ if [ "${REBUILD_MINIX}" == "yes" ]; then
|
|||
cd ${MYPWD}
|
||||
if [ "$EXITCODE" != "0" ]; then
|
||||
echo "Error: Failed building Minix source code."
|
||||
exit $EXITCODE
|
||||
else
|
||||
echo "Completed building Minix source code."
|
||||
fi
|
||||
|
@ -127,10 +118,19 @@ else
|
|||
echo "Building Minix: NO"
|
||||
fi
|
||||
|
||||
# Configure llvm-apps
|
||||
cp ${ROOT}/conf/common.overrides.llvm-minix.inc ${ROOT}/common.overrides.llvm.inc
|
||||
MINIX_ROOT_1=`readlink -f ${MINIX_ROOT}`
|
||||
MINIX_TOOLS_DIR=$(readlink -f ${MINIX_ROOT}/../obj.i386/tooldir.*)
|
||||
echo "_MINIX_ROOT=\"${MINIX_ROOT_1}\"" > ${ROOT}/common.overrides.minix.inc
|
||||
echo "_MINIX_TOOLS_DIR=\"${MINIX_TOOLS_DIR}\"" >> ${ROOT}/common.overrides.minix.inc
|
||||
if [ "${GEN_STATIC_MAGIC}" == "yes" ]; then
|
||||
echo "Building static magic library..."
|
||||
cd ${STATIC_DIR}/magic
|
||||
make install || EXITCODE=1
|
||||
cd ${MYPWD}
|
||||
if [ "$EXITCODE" != "0" ]; then
|
||||
echo "Error: Failed building static magic library."
|
||||
exit $EXITCODE
|
||||
else
|
||||
echo "Completed building static magic library."
|
||||
fi
|
||||
else
|
||||
echo "Building static magic library: NO"
|
||||
fi
|
||||
|
||||
exit $EXITCODE
|
||||
|
|
|
@ -65,3 +65,9 @@ make install
|
|||
|
||||
cd ${NETBSDSRCDIR}/minix/llvm/passes/hello
|
||||
make install
|
||||
|
||||
cd ${NETBSDSRCDIR}/minix/llvm/passes/sectionify
|
||||
make install
|
||||
|
||||
cd ${NETBSDSRCDIR}/minix/llvm/passes/magic
|
||||
make install
|
||||
|
|
|
@ -50,6 +50,17 @@ function check_current_dir()
|
|||
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
|
||||
}
|
||||
|
||||
# Copied from configure.llvm.inc
|
||||
function build_llvm_libs()
|
||||
{
|
||||
local LIBS=""
|
||||
for a in $*
|
||||
do
|
||||
LIBS="$LIBS `find $INSTALL_DIR -maxdepth 1 -name ${a}\*.bcc | xargs`"
|
||||
done
|
||||
echo $LIBS
|
||||
}
|
||||
|
||||
function find_static_libs()
|
||||
{
|
||||
local stat_libs_llvmapps=
|
||||
|
@ -77,12 +88,8 @@ if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# set up the bridge to llvm-apps repository and initialize
|
||||
. ${MINIX_LLVM_DIR}/minix.inc
|
||||
. ${ROOT}/apps/scripts/include/configure.llvm.inc
|
||||
|
||||
echo "LLVM root directory is set to :"
|
||||
echo " ${ROOT}"
|
||||
echo ".so and .bcc binaries of LLVM passes set to be picked up from:"
|
||||
echo " ${INSTALL_DIR}"
|
||||
echo " and"
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
# THIS FILE IS AN EDITED VERSION OF A FILE GENERATED BY LLVM-APPS
|
||||
# XXX EDIT AT LEAST THIS PART
|
||||
_MINIX_ARCH=i386
|
||||
_MINIX_ROOT=/home/myname/path/to/minix
|
||||
_MINIX_TOOLS_DIR=/home/myname/path/to/obj.i386/tooldir.Linux-myversion
|
||||
|
||||
###########################################################
|
||||
# llvm-apps settings for Minix binary instrumentation
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
include ../Makefile.common.inc
|
||||
include ../Makefile.settings
|
||||
|
||||
MODULE_NAME=$(MODULE).bcc
|
||||
|
|
Loading…
Reference in a new issue