Commit a55cb325 authored by Thomas Guillem's avatar Thomas Guillem

build: add asan support

parent f0f5e22a
...@@ -17,6 +17,7 @@ checkfail() ...@@ -17,6 +17,7 @@ checkfail()
############# #############
RELEASE=0 RELEASE=0
ASAN=0
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case $1 in case $1 in
help|--help) help|--help)
...@@ -31,6 +32,9 @@ while [ $# -gt 0 ]; do ...@@ -31,6 +32,9 @@ while [ $# -gt 0 ]; do
-c) -c)
CHROME_OS=1 CHROME_OS=1
;; ;;
--asan)
ASAN=1
;;
release|--release) release|--release)
RELEASE=1 RELEASE=1
;; ;;
...@@ -347,6 +351,7 @@ fi ...@@ -347,6 +351,7 @@ fi
########## ##########
# CFLAGS # # CFLAGS #
########## ##########
VLC_CFLAGS="-std=gnu11" VLC_CFLAGS="-std=gnu11"
VLC_CXXFLAGS="-std=gnu++11" VLC_CXXFLAGS="-std=gnu++11"
if [ "$NO_OPTIM" = "1" ]; if [ "$NO_OPTIM" = "1" ];
...@@ -418,6 +423,19 @@ else ...@@ -418,6 +423,19 @@ else
NDK_DEBUG=1 NDK_DEBUG=1
fi 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 "EXTRA_CFLAGS: ${EXTRA_CFLAGS}"
echo "VLC_CFLAGS: ${VLC_CFLAGS}" echo "VLC_CFLAGS: ${VLC_CFLAGS}"
...@@ -505,6 +523,9 @@ if [ "${CHROME_OS}" = "1" ];then ...@@ -505,6 +523,9 @@ if [ "${CHROME_OS}" = "1" ];then
else else
VLC_BUILD_DIR=build-android-${TARGET_TUPLE} VLC_BUILD_DIR=build-android-${TARGET_TUPLE}
fi fi
if [ "${ASAN}" = 1 ];then
VLC_BUILD_DIR=${VLC_BUILD_DIR}-asan
fi
mkdir -p $VLC_BUILD_DIR && cd $VLC_BUILD_DIR mkdir -p $VLC_BUILD_DIR && cd $VLC_BUILD_DIR
############# #############
......
...@@ -60,6 +60,9 @@ while [ $# -gt 0 ]; do ...@@ -60,6 +60,9 @@ while [ $# -gt 0 ]; do
run) run)
RUN=1 RUN=1
;; ;;
--asan)
ASAN=1
;;
*) *)
diagnostic "$0: Invalid option '$1'." diagnostic "$0: Invalid option '$1'."
diagnostic "$0: Try --help for more information." diagnostic "$0: Try --help for more information."
...@@ -218,6 +221,9 @@ fi ...@@ -218,6 +221,9 @@ fi
if [ "$CHROME_OS" = 1 ]; then if [ "$CHROME_OS" = 1 ]; then
OPTS="$OPTS -c" OPTS="$OPTS -c"
fi fi
if [ "$ASAN" = 1 ]; then
OPTS="$OPTS --asan"
fi
./compile-libvlc.sh $OPTS ./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