Skip to content

Commit 64b94eb

Browse files
committed
[sanitizer][symbolizer] Checkout zlib
And make build script incremental. We will eventually convert the script into ExternalProject_Add. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D158044
1 parent de72243 commit 64b94eb

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Run as: CLANG=bin/clang ZLIB_SRC=src/zlib \
4-
# build_symbolizer.sh runtime_build/lib/clang/4.0.0/lib/linux/
3+
# Run as: CLANG=bin/clang build_symbolizer.sh out.o
54
# zlib can be downloaded from http://www.zlib.net.
65
#
76
# Script compiles self-contained object file with symbolization code and injects
@@ -36,22 +35,9 @@ COMPILER_RT_SRC=$(readlink -f ${SCRIPT_DIR}/../../../..)
3635
LLVM_SRC=${LLVM_SRC:-${COMPILER_RT_SRC}/../llvm}
3736
LLVM_SRC=$(readlink -f $LLVM_SRC)
3837

39-
if [[ "$ZLIB_SRC" == "" ||
40-
! -x "${ZLIB_SRC}/configure" ||
41-
! -f "${ZLIB_SRC}/zlib.h" ]]; then
42-
echo "Missing or incomplete ZLIB_SRC"
43-
exit 1
44-
fi
45-
ZLIB_SRC=$(readlink -f $ZLIB_SRC)
46-
4738
CLANG="${CLANG:-`which clang`}"
4839
CLANG_DIR=$(readlink -f $(dirname "$CLANG"))
4940

50-
rm -rf symbolizer
51-
BUILD_DIR=$(readlink -f ./symbolizer)
52-
mkdir -p $BUILD_DIR
53-
cd $BUILD_DIR
54-
5541
CC=$CLANG_DIR/clang
5642
CXX=$CLANG_DIR/clang++
5743
TBLGEN=$CLANG_DIR/llvm-tblgen
@@ -66,6 +52,10 @@ for F in $CC $CXX $TBLGEN $LINK $OPT $AR; do
6652
fi
6753
done
6854

55+
BUILD_DIR=${PWD}/symbolizer
56+
mkdir -p $BUILD_DIR
57+
cd $BUILD_DIR
58+
6959
ZLIB_BUILD=${BUILD_DIR}/zlib
7060
LIBCXX_BUILD=${BUILD_DIR}/libcxx
7161
LLVM_BUILD=${BUILD_DIR}/llvm
@@ -83,9 +73,8 @@ FLAGS+=" -include ${SRC_DIR}/../sanitizer_redefine_builtins.h -DSANITIZER_COMMON
8373
LINKFLAGS="-fuse-ld=lld -target $TARGET_TRIPLE"
8474

8575
# Build zlib.
86-
mkdir -p ${ZLIB_BUILD}
76+
[[ -d ${ZLIB_BUILD} ]] || git clone https://github.com/madler/zlib ${ZLIB_BUILD}
8777
cd ${ZLIB_BUILD}
88-
cp -r ${ZLIB_SRC}/* .
8978
AR="${AR}" CC="${CC}" CFLAGS="$FLAGS -Wno-deprecated-non-prototype" RANLIB=/bin/true ./configure --static
9079
make -j libz.a
9180

0 commit comments

Comments
 (0)