Commit 2c2eb4d0 authored by Thomas Guillem's avatar Thomas Guillem

configure: add --with-libfuzzer

DIR is the dir path of the libFuzzer.a static library.

When used, it forces a static build without vlc binary and enable sanitize
coverage.

How to fetch and build libFuzzer.a from llvm.org:
$ git clone https://git.llvm.org/git/compiler-rt
$ cd compiler-rt/lib/fuzzer

for gcc:
$ CXX=g++ ./build.sh

for clang:
$ ./build.sh

This a partial merge of the work done by Shaleen during GSOC 2017. See
https://code.videolan.org/GSoC2017/shalzz/vlc.git
parent 8dddfdca
......@@ -786,6 +786,17 @@ AS_IF([test "${SYS}" = "mingw32"], [
have_dynamic_objects="yes" #assume we can use shared objects
])
AC_ARG_WITH([libfuzzer],
[AS_HELP_STRING([--with-libfuzzer=DIR],
[use libFuzzer library from DIR and triggers sanitize coverage (default disabled)])],
[],
[with_libfuzzer=no])
AS_VAR_IF(with_libfuzzer, no, [], [
enable_shared=no
enable_static=yes
enable_vlc=no
])
AS_IF([test "${enable_shared}" = "no"], [
have_dynamic_objects=no
])
......@@ -4193,6 +4204,26 @@ AC_ARG_ENABLE(vlc,
[ --enable-vlc build the VLC media player (default enabled)])
AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
dnl
dnl Fuzzer (at the end in order to don't mess dependencies FLAGS)
dnl
AS_VAR_IF(with_libfuzzer, no, [], [
LIBS="-lstdc++ ${LIBM} ${LIBPTHREAD} -L${with_libfuzzer} -lFuzzer"
AX_CHECK_COMPILE_FLAG(-fsanitize-coverage=trace-pc-guard, [
AX_APPEND_FLAG([-fsanitize-coverage=trace-pc-guard])
AX_APPEND_FLAG([-fsanitize-coverage=trace-pc-guard], [CXXFLAGS])
AX_APPEND_COMPILE_FLAGS([-fsanitize-coverage=trace-cmp])
AX_APPEND_COMPILE_FLAGS([-fsanitize-coverage=trace-cmp], [CXXFLAGS])
], [
AX_CHECK_COMPILE_FLAG(-fsanitize-coverage=trace-pc, [
AX_APPEND_FLAG([-fsanitize-coverage=trace-pc])
AX_APPEND_FLAG([-fsanitize-coverage=trace-pc], [CXXFLAGS])
], [
AC_MSG_ERROR([Sanitizer coverage not supported by your compiler])
])
])
])
dnl
dnl Stuff used by the program
dnl
......
......@@ -204,5 +204,5 @@ vlc_demux_run_LDADD = libvlc_demux_run.la
EXTRA_PROGRAMS += vlc-demux-run
vlc_demux_libfuzzer_CPPFLAGS = $(vlc_static_CPPFLAGS)
vlc_demux_libfuzzer_LDADD = -lFuzzer libvlc_demux_run.la
vlc_demux_libfuzzer_LDADD = libvlc_demux_run.la
EXTRA_PROGRAMS += vlc-demux-libfuzzer
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