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`
|
MYPWD=`pwd`
|
||||||
MINIX_ROOT=
|
MINIX_ROOT=
|
||||||
MINIX_LLVM_DIR=
|
MINIX_LLVM_DIR=
|
||||||
LLVMPASS=
|
|
||||||
LLVMARGS=
|
LLVMARGS=
|
||||||
LLVMPASS_PATHS=
|
LLVMPASS_PATHS=
|
||||||
TARGET_MODULES=
|
TARGET_MODULES=
|
||||||
|
@ -98,9 +97,7 @@ function check_args()
|
||||||
#Make sure we are running from the root dir of the Minix sources
|
#Make sure we are running from the root dir of the Minix sources
|
||||||
check_current_dir
|
check_current_dir
|
||||||
|
|
||||||
# set up the bridge to llvm-apps repository and initialize
|
|
||||||
. ${MINIX_LLVM_DIR}/minix.inc
|
. ${MINIX_LLVM_DIR}/minix.inc
|
||||||
[ ! -f ${ROOT}/apps/scripts/include/configure.llvm.inc ] || . ${ROOT}/apps/scripts/include/configure.llvm.inc
|
|
||||||
|
|
||||||
# Arguments check
|
# Arguments check
|
||||||
check_args "$@"
|
check_args "$@"
|
||||||
|
@ -132,7 +129,7 @@ done
|
||||||
|
|
||||||
# Show info
|
# Show info
|
||||||
echo "Build.llvm: Executing with following parameters..."
|
echo "Build.llvm: Executing with following parameters..."
|
||||||
echo "LLVM pass : ${LLVMPASS}"
|
echo "LLVM pass : $@"
|
||||||
echo "LLVM pass arguments : ${LLVMARGS}"
|
echo "LLVM pass arguments : ${LLVMARGS}"
|
||||||
echo "Target Minix modules : ${MINIX_MODS}"
|
echo "Target Minix modules : ${MINIX_MODS}"
|
||||||
echo "OPTFLAGS value : ${OPTFLAGS}"
|
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
|
set -o errexit
|
||||||
|
|
||||||
MYPWD="`pwd`"
|
MYPWD="`pwd`"
|
||||||
|
ARCH=i386
|
||||||
MINIX_ROOT=
|
MINIX_ROOT=
|
||||||
MINIX_LLVM_DIR=
|
MINIX_LLVM_DIR=
|
||||||
GOLD_DEST_DIR=
|
GOLD_DEST_DIR=
|
||||||
DEFAULT_LLVM_ROOT=
|
|
||||||
EXITCODE=0
|
EXITCODE=0
|
||||||
|
|
||||||
function check_current_dir()
|
function check_current_dir()
|
||||||
|
@ -38,48 +38,38 @@ function check_current_dir()
|
||||||
|
|
||||||
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
|
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
|
||||||
GOLD_DEST_DIR="${MINIX_ROOT}/minix/llvm/bin"
|
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
|
# Make sure we are running from the right directory
|
||||||
check_current_dir
|
check_current_dir
|
||||||
|
|
||||||
# LLVM ROOT is the bridging connection from minix branch to the llvm-apps branch
|
# Create common.inc
|
||||||
if [ "${ROOT}" == "" ]; then
|
if [ ! -f ${MINIX_LLVM_DIR}/common.inc ]; then
|
||||||
|
echo "# This file was automatically generated by configure.llvm" > ${MINIX_LLVM_DIR}/common.inc
|
||||||
echo "\${ROOT} is not set."
|
echo "DESTDIR=\"${MINIX_DEST_DIR}\"" >> ${MINIX_LLVM_DIR}/common.inc
|
||||||
echo "Please specify the path to the \"llvm-apps\" repository..."
|
echo "TOOLDIR=\"${MINIX_TOOLS_DIR}/bin\"" >> ${MINIX_LLVM_DIR}/common.inc
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [ "" == "${response}" ]; then
|
STATIC_DIR="${MINIX_LLVM_DIR}/static"
|
||||||
ROOT=${DEFAULT_LLVM_ROOT}
|
|
||||||
else
|
if [ ! -f ${STATIC_DIR}/Makefile.common.inc ]; then
|
||||||
ROOT=${response}
|
echo "# This file was automatically generated by configure.llvm" > ${STATIC_DIR}/Makefile.common.inc
|
||||||
fi
|
echo "_MINIX_ARCH=${ARCH}" >> ${STATIC_DIR}/Makefile.common.inc
|
||||||
fi
|
echo "_MINIX_ROOT=${MINIX_ROOT_1}" >> ${STATIC_DIR}/Makefile.common.inc
|
||||||
echo "LLVM root directory is set to :"
|
echo "_MINIX_TOOLS_DIR=${MINIX_TOOLS_DIR}" >> ${STATIC_DIR}/Makefile.common.inc
|
||||||
echo " ${ROOT}"
|
fi
|
||||||
|
|
||||||
# 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
|
. ${MINIX_LLVM_DIR}/minix.inc
|
||||||
|
|
||||||
if [ ! -d ${ROOT}/.tmp ]; then
|
|
||||||
mkdir ${ROOT}/.tmp 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set default values for essential variables
|
# Set default values for essential variables
|
||||||
: ${JOBS=1}
|
: ${JOBS=1}
|
||||||
: ${GEN_GOLD_PLUGIN="yes"}
|
: ${GEN_GOLD_PLUGIN="yes"}
|
||||||
: ${REBUILD_MINIX="yes"}
|
: ${REBUILD_MINIX="yes"}
|
||||||
|
: ${GEN_STATIC_MAGIC="yes"}
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# Generate Gold Plugin
|
# Generate Gold Plugin
|
||||||
|
@ -120,6 +110,7 @@ if [ "${REBUILD_MINIX}" == "yes" ]; then
|
||||||
cd ${MYPWD}
|
cd ${MYPWD}
|
||||||
if [ "$EXITCODE" != "0" ]; then
|
if [ "$EXITCODE" != "0" ]; then
|
||||||
echo "Error: Failed building Minix source code."
|
echo "Error: Failed building Minix source code."
|
||||||
|
exit $EXITCODE
|
||||||
else
|
else
|
||||||
echo "Completed building Minix source code."
|
echo "Completed building Minix source code."
|
||||||
fi
|
fi
|
||||||
|
@ -127,10 +118,19 @@ else
|
||||||
echo "Building Minix: NO"
|
echo "Building Minix: NO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure llvm-apps
|
if [ "${GEN_STATIC_MAGIC}" == "yes" ]; then
|
||||||
cp ${ROOT}/conf/common.overrides.llvm-minix.inc ${ROOT}/common.overrides.llvm.inc
|
echo "Building static magic library..."
|
||||||
MINIX_ROOT_1=`readlink -f ${MINIX_ROOT}`
|
cd ${STATIC_DIR}/magic
|
||||||
MINIX_TOOLS_DIR=$(readlink -f ${MINIX_ROOT}/../obj.i386/tooldir.*)
|
make install || EXITCODE=1
|
||||||
echo "_MINIX_ROOT=\"${MINIX_ROOT_1}\"" > ${ROOT}/common.overrides.minix.inc
|
cd ${MYPWD}
|
||||||
echo "_MINIX_TOOLS_DIR=\"${MINIX_TOOLS_DIR}\"" >> ${ROOT}/common.overrides.minix.inc
|
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
|
exit $EXITCODE
|
||||||
|
|
|
@ -65,3 +65,9 @@ make install
|
||||||
|
|
||||||
cd ${NETBSDSRCDIR}/minix/llvm/passes/hello
|
cd ${NETBSDSRCDIR}/minix/llvm/passes/hello
|
||||||
make install
|
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"
|
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()
|
function find_static_libs()
|
||||||
{
|
{
|
||||||
local stat_libs_llvmapps=
|
local stat_libs_llvmapps=
|
||||||
|
@ -77,12 +88,8 @@ if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set up the bridge to llvm-apps repository and initialize
|
|
||||||
. ${MINIX_LLVM_DIR}/minix.inc
|
. ${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 ".so and .bcc binaries of LLVM passes set to be picked up from:"
|
||||||
echo " ${INSTALL_DIR}"
|
echo " ${INSTALL_DIR}"
|
||||||
echo " and"
|
echo " and"
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
# THIS FILE IS AN EDITED VERSION OF A FILE GENERATED BY LLVM-APPS
|
# 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
|
# llvm-apps settings for Minix binary instrumentation
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
include ../Makefile.common.inc
|
||||||
include ../Makefile.settings
|
include ../Makefile.settings
|
||||||
|
|
||||||
MODULE_NAME=$(MODULE).bcc
|
MODULE_NAME=$(MODULE).bcc
|
||||||
|
|
Loading…
Reference in a new issue