Commit a55cb325 authored by Thomas Guillem's avatar Thomas Guillem

build: add asan support

parent f0f5e22a
......@@ -17,6 +17,7 @@ checkfail()
#############
RELEASE=0
ASAN=0
while [ $# -gt 0 ]; do
case $1 in
help|--help)
......@@ -31,6 +32,9 @@ while [ $# -gt 0 ]; do
-c)
CHROME_OS=1
;;
--asan)
ASAN=1
;;
release|--release)
RELEASE=1
;;
......@@ -347,6 +351,7 @@ fi
##########
# CFLAGS #
##########
VLC_CFLAGS="-std=gnu11"
VLC_CXXFLAGS="-std=gnu++11"
if [ "$NO_OPTIM" = "1" ];
......@@ -418,6 +423,19 @@ else
NDK_DEBUG=1
fi
if [ "${ASAN}" = 1 ];then
VLC_CFLAGS="${VLC_CFLAGS} -O0 -fno-omit-frame-pointer -fsanitize=address"
VLC_CXXFLAGS="${VLC_CXXLAGS} -O0 -fno-omit-frame-pointer -fsanitize=address"
VLC_LDFLAGS="${VLC_LDFLAGS} -ldl -fsanitize=address"
# ugly, sorry
if [ "${ANDROID_API}" = "9" ];then
cp ${ANDROID_NDK}/platforms/android-9/arch-${PLATFORM_SHORT_ARCH}/usr/include/stdlib.h \
${NDK_TOOLCHAIN_DIR}/sysroot/usr/include
echo "extern int posix_memalign(void **memptr, size_t alignment, size_t size);" \
>> ${NDK_TOOLCHAIN_DIR}/sysroot/usr/include/stdlib.h
fi
fi
echo "EXTRA_CFLAGS: ${EXTRA_CFLAGS}"
echo "VLC_CFLAGS: ${VLC_CFLAGS}"
......@@ -505,6 +523,9 @@ if [ "${CHROME_OS}" = "1" ];then
else
VLC_BUILD_DIR=build-android-${TARGET_TUPLE}
fi
if [ "${ASAN}" = 1 ];then
VLC_BUILD_DIR=${VLC_BUILD_DIR}-asan
fi
mkdir -p $VLC_BUILD_DIR && cd $VLC_BUILD_DIR
#############
......
......@@ -60,6 +60,9 @@ while [ $# -gt 0 ]; do
run)
RUN=1
;;
--asan)
ASAN=1
;;
*)
diagnostic "$0: Invalid option '$1'."
diagnostic "$0: Try --help for more information."
......@@ -218,6 +221,9 @@ fi
if [ "$CHROME_OS" = 1 ]; then
OPTS="$OPTS -c"
fi
if [ "$ASAN" = 1 ]; then
OPTS="$OPTS --asan"
fi
./compile-libvlc.sh $OPTS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment