Bridging Minix & llvm-apps repos for instrumentating Minix

Allows instrumentation of Minix components using LLVM passes from
"llvm-apps" repository

In addition, the change does the following:
 1. Move releasetools/generate_gold_plugin.sh to minix/llvm
 2. Move external/bsd/llvm/passes to minix/llvm/passes
 3. libLTO.so, LLVMgold.so and WeakAliasModuleOverride.so files
    now get installed in minix/llvm/bin
This commit is contained in:
Koustubha Bhat 2014-05-06 10:43:42 +02:00 committed by Lionel Sambuc
parent 33c4e94990
commit 5ba302fdea
11 changed files with 566 additions and 16 deletions

View file

@ -137,7 +137,7 @@ _SRC_TOP_OBJ_=
# _SUBDIR is used to set SUBDIR, after removing directories that have # _SUBDIR is used to set SUBDIR, after removing directories that have
# BUILD_${dir}=no, or that have no ${dir}/Makefile. # BUILD_${dir}=no, or that have no ${dir}/Makefile.
# #
_SUBDIR= tools lib include gnu external crypto/external bin games _SUBDIR= tools lib include gnu external crypto/external minix bin games
.if defined(__MINIX) .if defined(__MINIX)
_SUBDIR+= commands man benchmarks test _SUBDIR+= commands man benchmarks test
_SUBDIR+= kernel servers drivers _SUBDIR+= kernel servers drivers

5
minix/Makefile Normal file
View file

@ -0,0 +1,5 @@
# $NetBSD: Makefile,v 1.18 2012/06/14 04:14:36 riz Exp $
SUBDIR+= llvm
.include <bsd.subdir.mk>

158
minix/llvm/build.llvm Executable file
View file

@ -0,0 +1,158 @@
#!/bin/bash
############################
#
# Author: Koustubha Bhat
# Date : 3-April-2014
# VU University, Amsterdam.
#
############################
set -o errexit
MYPWD=`pwd`
MINIX_ROOT=
MINIX_LLVM_DIR=
LLVMPASS=
LLVMARGS=
LLVMPASS_PATHS=
OPTFLAGS=" "
TARGET_MODULES=
MINIX_MODS=
# Set default values for essential variables
: ${GENERATE_MAP="no"}
: ${C="hello"}
function usage()
{
echo "C=<target Minix module(s)> $0 [<LLVM-pass name> ...]"
echo
echo "Examples:"
echo "C=pm,vfs ./$0 dummy"
echo "C=drivers ./$0 dummy"
echo
echo "Additional arguments to the passes may be passed through \${LLVM_PASS_ARGS}."
echo
}
function check_current_dir()
{
#Make sure we are running from the root dir of the Minix sources
if [ -d ./minix ] && [ -d ./drivers ] && [ -d ./servers ] ; then
MINIX_ROOT="${MYPWD}"
elif [ -d ../../minix ] && [ -d ../../drivers ] && [ -d ../../servers ]; then
MINIX_ROOT="${MYPWD}/../.."
else
echo "Please run the script from either of the following locations:"
echo "> Root of the Minix sources."
echo " OR"
echo "> minix/llvm directory of the Minix sources."
exit 1
fi
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
}
function check_args()
{
local llvmpass=
local llvmpass_path=
local exit_flag=0
if [ $# -ge 1 ]; then
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
usage
exit 1
fi
for p in "$@" ;
do
llvmpass=$p
# Default value for llvmargs not specified deliberately
if [ -f "${INSTALL_DIR}/${llvmpass}.so" ]; then
llvmpass_path="${INSTALL_DIR}/${llvmpass}.so"
elif [ -f "${MINIX_LLVM_BIN_DIR}/${llvmpass}.so" ]; then
llvmpass_path="${MINIX_LLVM_BIN_DIR}/${llvmpass}.so"
else
echo "The LLVM pass file ${llvmpass}.so doesn't exit."
exit_flag=1
fi
LLVMPASS_PATHS+=" -load=${llvmpass_path} -${llvmpass}"
done
if [ ${exit_flag} == 1 ]; then
echo "Searched in:"
echo " ${INSTALL_DIR}"
echo " and"
echo " ${MINIX_LLVM_BIN_DIR}."
exit 1
fi
LLVMARGS=" ${LLVM_PASS_ARGS}"
fi
}
#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
. ${ROOT}/apps/scripts/include/configure.llvm.inc
# Arguments check
check_args "$@"
if [ "$C" == "" ]; then
C="hello"
fi
if [ "${GENERATE_MAP}" != "" ] && [[ ${GENERATE_MAP} =~ [yY][eE][sS] ]]; then
generate_modules_map
fi
# If we are really instrumenting with some pass...
if [ "${LLVMPASS_PATHS}" != "" ]; then
OPTFLAGS=" -disable-opt ${LLVMPASS_PATHS} ${LLVMARGS}"
fi
TARGET_MODULES=`echo $C | sed -e "s/,/ /g"`
for m in ${TARGET_MODULES}
do
for p in `get_modules_path $m`
do
MINIX_MODS="${MINIX_MODS} $p"
done
done
# Show info
echo "Build.llvm: Executing with following parameters..."
echo "LLVM pass : ${LLVMPASS}"
echo "LLVM pass arguments : ${LLVMARGS}"
echo "Target Minix modules : ${MINIX_MODS}"
echo "OPTFLAGS value : ${OPTFLAGS}"
echo
cd ${MINIX_ROOT}
for m in ${MINIX_MODS}
do
echo "Instrumenting $m ..."
n=`get_module_name $m`
if [ "" == "$n" ]; then
echo "Error: Couldn't fetch the module name for $m"
continue
fi
clean_module $n $m
OPTFLAGS=`echo ${OPTFLAGS} | sed -e "s/\ /\\\ /g"`
OPTFLAGS_PLACEHOLDER="OPTFLAGS.$n=${OPTFLAGS}"
(env "`echo ${OPTFLAGS_PLACEHOLDER}`" MKBITCODE=yes SLOPPY_FLIST=yes \
${TOOLDIR}/nbmake-${ARCH} -C $m all install && echo "INFO: $m successfully instrumented." ) || echo "ERROR: Failed instrumenting $m"
echo
done
cd ${MYPWD}

133
minix/llvm/configure.llvm Executable file
View file

@ -0,0 +1,133 @@
#!/bin/bash
############################
#
# Author: Koustubha Bhat
# Date : 3-April-2014
# VU University, Amsterdam.
#
############################
##################
# Initialization
##################
set -o errexit
MYPWD="`pwd`"
MINIX_ROOT=
MINIX_LLVM_DIR=
GOLD_DEST_DIR=
DEFAULT_LLVM_ROOT=
EXITCODE=0
function check_current_dir()
{
#Make sure we are running from the root dir of the Minix sources
if [ -d ./minix ] && [ -d ./drivers ] && [ -d ./servers ] ; then
MINIX_ROOT="${MYPWD}"
elif [ -d ../../minix ] && [ -d ../../drivers ] && [ -d ../../servers ]; then
MINIX_ROOT="${MYPWD}/../.."
else
echo "Please run the script from either of the following locations:"
echo "> Root of the Minix sources."
echo " OR"
echo "> minix/llvm directory of the Minix sources."
exit 1
fi
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
GOLD_DEST_DIR="${MINIX_ROOT}/minix/llvm/bin"
DEFAULT_LLVM_ROOT="${MINIX_ROOT}/../../llvm-apps"
}
# 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."
read response
if [ "" == "${response}" ]; then
ROOT=${DEFAULT_LLVM_ROOT}
else
ROOT=${response}
fi
fi
echo "LLVM root directory is set to :"
echo " ${ROOT}"
# Persist the LLVM ROOT path information
ROOT_1=`echo ${ROOT} | sed "s/\\\//\\\\\\\\\//g"`
sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/minix.inc
if [ ! -d ${ROOT}/.tmp ]; then
mkdir ${ROOT}/.tmp 2>/dev/null || true
fi
# Load useful functions and environment variables from llvm-apps repo.
. ${ROOT}/apps/scripts/include/configure.llvm.inc
# Set default values for essential variables
: ${JOBS=1}
: ${GEN_GOLD_PLUGIN="yes"}
: ${REBUILD_MINIX="yes"}
########################
# Generate Gold Plugin
########################
if [ "${GEN_GOLD_PLUGIN}" == "yes" ] && [ -f "${MYPWD}/.gold_generated" ]; then
echo "It is found that Gold plugin has already been generated. Would you like to re-generate? [y | n]"
read response
if [ "y" == "$response" ] || [ "Y" == "$response" ]; then
echo "Gold shall be regenerated."
else
GEN_GOLD_PLUGIN="no"
fi
fi
if [ "${GEN_GOLD_PLUGIN}" == "yes" ]; then
echo LLVMPREFIX= ${LLVMPREFIX}
${MINIX_LLVM_DIR}/generate_gold_plugin.sh
if [ ! -f "${GOLD_DEST_DIR}/libLTO.so" ] || [ ! -f "${GOLD_DEST_DIR}/LLVMgold.so" ]; then
echo "Failure: generate_gold_plugin.sh"
exit 1
fi
echo "Finished generating gold plugin."
touch "${MYPWD}/.gold_generated"
else
echo "Gold plugin generation: NO"
fi
########################
# Build Minix
########################
if [ "${REBUILD_MINIX}" == "yes" ]; then
echo "Building Minix..."
echo "CC:$CC"
echo "CXX:$CXX"
echo "JOBS:$JOBS"
echo
cd ${MINIX_ROOT}
BUILDVARS="-V MKBITCODE=yes -V SLOPPY_FLIST=yes" ./releasetools/x86_hdimage.sh
EXITCODE=$?
cd ${MYPWD}
if [ "$EXITCODE" != "0" ]; then
echo "Error: Failed building Minix source code."
exit $EXITCODE
else
echo "Completed building Minix source code."
exit $EXITCODE
fi
else
echo "Building Minix: NO"
fi

View file

@ -2,7 +2,7 @@
cd $(dirname $0) cd $(dirname $0)
: ${NETBSDSRCDIR=${PWD}/..} : ${NETBSDSRCDIR=${PWD}/../..}
: ${LLVMSRCDIR=${NETBSDSRCDIR}/external/bsd/llvm/dist} : ${LLVMSRCDIR=${NETBSDSRCDIR}/external/bsd/llvm/dist}
: ${ARCH=i386} : ${ARCH=i386}
: ${JOBS=1} : ${JOBS=1}
@ -44,15 +44,14 @@ ${LLVMSRCDIR}/llvm/configure \
ac_cv_path_NEATO="echo neato" \ ac_cv_path_NEATO="echo neato" \
ac_cv_path_TWOPI="echo twopi" \ ac_cv_path_TWOPI="echo twopi" \
ac_cv_path_XDOT="echo xdot" \ ac_cv_path_XDOT="echo xdot" \
--enable-optimized \ --enable-optimized
CC=cc
make -j ${JOBS} make -j ${JOBS}
# Copy the gold plugin where the NetBSD build system expects it. # Copy the gold plugin where the NetBSD build system expects it.
mkdir -p ${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/ mkdir -p ${NETBSDSRCDIR}/minix/llvm/bin/
cp ${OBJ_LLVM}/./Release+Asserts/lib/libLTO.so ${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/ cp ${OBJ_LLVM}/./Release+Asserts/lib/libLTO.so ${NETBSDSRCDIR}/minix/llvm/bin/
cp ${OBJ_LLVM}/./Release+Asserts/lib/LLVMgold.so ${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/ cp ${OBJ_LLVM}/./Release+Asserts/lib/LLVMgold.so ${NETBSDSRCDIR}/minix/llvm/bin/
# Copy useful LLVM tools # Copy useful LLVM tools
mkdir -p ${CROSS_TOOLS} mkdir -p ${CROSS_TOOLS}
@ -61,6 +60,6 @@ cp ${OBJ_LLVM}/./Release+Asserts/bin/opt ${CROSS_TOOLS}
cp ${OBJ_LLVM}/./Release+Asserts/bin/llvm-* ${CROSS_TOOLS} cp ${OBJ_LLVM}/./Release+Asserts/bin/llvm-* ${CROSS_TOOLS}
# Generate and Install default MINIX passes # Generate and Install default MINIX passes
cd ${NETBSDSRCDIR}/external/bsd/llvm/passes/WeakAliasModuleOverride cd ${NETBSDSRCDIR}/minix/llvm/passes/WeakAliasModuleOverride
make LLVMPREFIX=${OBJ_LLVM}/./Release+Asserts/ install make LLVMPREFIX=${OBJ_LLVM}/./Release+Asserts/ install

96
minix/llvm/minix.inc Normal file
View file

@ -0,0 +1,96 @@
#!/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="/home/koustubha/systems_thesis.lnk/repositories/llvm-apps"

View file

@ -2,7 +2,7 @@ QUIET=@
ECHO=echo ECHO=echo
CP=cp CP=cp
PASSLIBNAME:= WeakAliasModuleOverride.so PASSLIBNAME:= weak-alias-module-override
LLVM_VERSION = $($LLVMPREFIX/bin/llvm-config --version | sed "s/[^0-9]//g") LLVM_VERSION = $($LLVMPREFIX/bin/llvm-config --version | sed "s/[^0-9]//g")
CFLAGS += -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -DHAVE_EXCEPTIONS=0 CFLAGS += -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -DHAVE_EXCEPTIONS=0
@ -19,8 +19,8 @@ $(PASSLIBNAME): $(OBJS)
$(QUIET) $(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $< $(QUIET) $(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $<
install: $(PASSLIBNAME) install: $(PASSLIBNAME)
$(QUIET) -mkdir -p ../lib $(QUIET) -mkdir -p ../../bin
$(QUIET) $(CP) $(PASSLIBNAME) ../lib/$(PASSLIBNAME) $(QUIET) $(CP) $(PASSLIBNAME) ../../bin/$(PASSLIBNAME)
clean: clean:
-rm -f *.o *.so -rm -f *.o *.so

156
minix/llvm/relink.llvm Executable file
View file

@ -0,0 +1,156 @@
#!/bin/bash
############################
#
# Author: Koustubha Bhat
# Date : 3-April-2014
# VU University, Amsterdam.
#
############################
set -o errexit
MYPWD=`pwd`
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"}
function usage()
{
echo "C=<target Minix module> $0 [<static library name>]"
echo
echo "Examples:"
echo "C=pm,vfs ./$0 dummy"
echo "C=drivers ./$0 dummy"
echo
}
function check_current_dir()
{
#Make sure we are running from the root dir of the Minix sources
if [ -d ./minix ] && [ -d ./drivers ] && [ -d ./servers ] ; then
MINIX_ROOT="${MYPWD}"
elif [ -d ../../minix ] && [ -d ../../drivers ] && [ -d ../../servers ]; then
MINIX_ROOT="${MYPWD}/../.."
else
echo "Please run the script from either of the following locations:"
echo "> Root of the Minix sources."
echo " OR"
echo "> minix/llvm directory of the Minix sources."
exit 1
fi
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
}
function find_static_libs()
{
local stat_libs_llvmapps=
local stat_libs_minix=
local install_dir_save=
stat_libs_llvmapps=`build_llvm_libs $*`
install_dir_save=${INSTALL_DIR}
INSTALL_DIR=${MINIX_LLVM_BIN_DIR}
stat_libs_minix=`build_llvm_libs $*`
INSTALL_DIR=${install_dir_save}
echo "${stat_libs_llvmapps} ${stat_libs_minix}"
}
#Make sure we are running from the right directory
check_current_dir
# Arguments check
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
usage
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"
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
generate_modules_map
fi
STATIC_LIBS=`find_static_libs $*`
TARGET_MODULES=`echo $C | sed -e "s/,/ /g"`
for m in ${TARGET_MODULES}
do
for p in `get_modules_path $m`
do
MINIX_MODS="${MINIX_MODS} $p"
done
done
# Show info
echo "relink.llvm: Executing with following parameters..."
echo "LIBRARIES : $*"
echo "Target Minix modules : ${MINIX_MODS}"
echo
cd ${MINIX_ROOT}
for m in ${MINIX_MODS}
do
echo "Relinking $m ..."
n=`get_module_name $m`
if [ "" == "$n" ]; then
echo "Error: Couldn't fetch the module name for $m"
continue
fi
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}\""
fi
env "`echo ${LDFLAGS_PLACEHOLDER}`" MKBITCODE=yes SLOPPY_FLIST=yes \
${TOOLDIR}/nbmake-${ARCH} -C $m
echo
done
cd ${MYPWD}

View file

@ -61,8 +61,8 @@ MKRUMP:= no
MKSKEY:= no MKSKEY:= no
MKYP:= no MKYP:= no
WEAKALIASOVERRIDEPASS?=${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/WeakAliasModuleOverride.so WEAKALIASOVERRIDEPASS?=${NETBSDSRCDIR}/minix/llvm/bin/weak-alias-module-override
GOLD_PLUGIN?=${NETBSDSRCDIR}/external/bsd/llvm/passes/lib/LLVMgold.so GOLD_PLUGIN?=${NETBSDSRCDIR}/minix/llvm/bin/LLVMgold.so
# By default when running LLVM passes: # By default when running LLVM passes:
# - do not run optimization while running LLVM passes # - do not run optimization while running LLVM passes

View file

@ -579,6 +579,9 @@ ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" .if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o
OPTFLAGS.${_P}?= ${OPTFLAGS}
BITCODE_LD_FLAGS.${_P}+= ${BITCODE_LD_FLAGS}
${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ ${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
${LIBCRTEND} ${_DPADD.${_P}} ${LIBCRTEND} ${_DPADD.${_P}}
${_MKTARGET_LINK} ${_MKTARGET_LINK}
@ -589,12 +592,12 @@ ${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \ ${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \
${_LDSTATIC.${_P}} ${_PROGLDOPTS} \ ${_LDSTATIC.${_P}} ${_PROGLDOPTS} \
-Wl,-r \ -Wl,-r \
${BITCODE_LD_FLAGS} \ ${BITCODE_LD_FLAGS.${_P}} \
-Wl,-plugin-opt=emit-llvm -Wl,-plugin-opt=emit-llvm
${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS} ${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS}
${_MKTARGET_LINK} ${_MKTARGET_LINK}
${OPT} ${OPTFLAGS} -o ${.TARGET} ${_P}.bcl ${OPT} ${OPTFLAGS.${_P}} -o ${.TARGET} ${_P}.bcl
${_P}.bcl.o: ${_P}.opt.bcl ${_P}.bcl.o: ${_P}.opt.bcl
${_MKTARGET_LINK} ${_MKTARGET_LINK}
@ -608,7 +611,7 @@ ${_P}: ${_P}.bcl.o
-L${DESTDIR}/usr/lib \ -L${DESTDIR}/usr/lib \
${_LDSTATIC.${_P}} -o ${.TARGET} \ ${_LDSTATIC.${_P}} -o ${.TARGET} \
${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \ ${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \
${BITCODE_LD_FLAGS} \ ${BITCODE_LD_FLAGS.${_P}} \
-Wl,--allow-multiple-definition -Wl,--allow-multiple-definition
.endif # !commands(${_P}) .endif # !commands(${_P})