Skip to content

Commit

Permalink
add --with-asan option #40
Browse files Browse the repository at this point in the history
  • Loading branch information
gdraheim committed Mar 13, 2018
1 parent 19c9e4d commit ff71508
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 25 deletions.
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
Expand Down
2 changes: 2 additions & 0 deletions SDL/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
Expand Down
25 changes: 13 additions & 12 deletions bins/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign
AUTOTOOL_VERSION=autoconf-2.52 automake-1.5 libtool-1.4.2
DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir)
DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4
CFLAGS = @CFLAGS@ @ASAN_CFLAGS@

bin_PROGRAMS = zzcat zzdir zzxorcat zzxordir zzxorcopy \
unzzip unzzip-mix unzzip-mem unzzip-big unzip-mem
Expand All @@ -20,26 +21,26 @@ noinst_HEADERS = unzzipdir-zip.h unzzipcat-zip.h unzzip-states.h zzipmake-zip.h
EXTRA_DIST = $(aclocal_DATA) $(noinst_HEADERS)
CLEANFILES = $(WCC10_CLEAN)

zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@

zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzip_SOURCES = zzip.c zzipmake-zip.c

unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_SOURCES = unzzip.c unzzipcat-zip.c unzzipdir-zip.c
unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_mix_SOURCES = unzzip.c unzzipcat-mix.c unzzipdir-mix.c
unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz
unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_mem_SOURCES = unzzip.c unzzipcat-mem.c unzzipdir-mem.c
unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz
unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_big_SOURCES = unzzip.c unzzipcat-big.c unzzipdir-big.c

unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz
unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@

../zzip/libzzip.la : @top_srcdir@/zzip/*.c
(cd ../zzip && $(MAKE) `basename $@`)
28 changes: 15 additions & 13 deletions bins/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,15 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAGS = @CFLAGS@ @ASAN_CFLAGS@
CONFIG_FILES = @CONFIG_FILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
Expand Down Expand Up @@ -443,23 +445,23 @@ WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt
noinst_HEADERS = unzzipdir-zip.h unzzipcat-zip.h unzzip-states.h zzipmake-zip.h
EXTRA_DIST = $(aclocal_DATA) $(noinst_HEADERS)
CLEANFILES = $(WCC10_CLEAN)
zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
zzip_SOURCES = zzip.c zzipmake-zip.c
unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_SOURCES = unzzip.c unzzipcat-zip.c unzzipdir-zip.c
unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_mix_SOURCES = unzzip.c unzzipcat-mix.c unzzipdir-mix.c
unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz
unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_mem_SOURCES = unzzip.c unzzipcat-mem.c unzzipdir-mem.c
unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz
unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz @ASAN_LIBS@
unzzip_big_SOURCES = unzzip.c unzzipcat-big.c unzzipdir-big.c
unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz
unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@
all: all-am

.SUFFIXES:
Expand Down
32 changes: 32 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ PKG_CONFIG
RESOLVES
ZZIPLIB_LDFLAGS
ZIPTESTS
ASAN_CFLAGS
ASAN_LIBS
SDL_GENERATE
SDL
ZLIB_VERSION
Expand Down Expand Up @@ -811,6 +813,7 @@ with_debug
with_lowstk
enable_mmap
enable_sdl
with_asan
with_defines
enable_frame_pointer
enable_enable_default_pkgconfigdir
Expand Down Expand Up @@ -1493,6 +1496,8 @@ Optional Packages:

--with-lowstk limited thread stack

--with-asan compile with adress sanitizer

--with-defines easy,harden,allow_modulo_entries

Some influential environment variables:
Expand Down Expand Up @@ -15370,6 +15375,33 @@ $as_echo "enabled SDL generation of... $SDL_GENERATE" >&6; }
fi



# ----------------------------------------------------------------
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether using address sanitizer" >&5
$as_echo_n "checking whether using address sanitizer... " >&6; }

# Check whether --with-asan was given.
if test "${with_asan+set}" = set; then :
withval=$with_asan; case "${withval}" in
yes|no) with_asan="$withval" ;;
*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: oops" >&5
$as_echo "oops" >&6; }
as_fn_error $? "bad value ${withval} for --with-asan" "$LINENO" 5 ;;
esac
else
with_asan="no"
fi

ASAN_LIBS=""
ASAN_CFLAGS=""
if test ".$with_asan" = ".yes" ; then
ASAN_LIBS="-lasan"
ASAN_CFLAGS="-fsanitize=address"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_asan, $ASAN_CFLAGS" >&5
$as_echo "$with_asan, $ASAN_CFLAGS" >&6; }


# ---------------------------------------------------------------
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking running extra tests on make check" >&5
$as_echo_n "checking running extra tests on make check... " >&6; }
Expand Down
19 changes: 19 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,25 @@ else
fi
AC_SUBST([SDL])
AC_SUBST([SDL_GENERATE])

# ----------------------------------------------------------------
AC_MSG_CHECKING(whether using address sanitizer)
AC_ARG_WITH(asan, AC_HELP_STRING(
[--with-asan],[compile with adress sanitizer])
, [case "${withval}" in
yes|no) with_asan="$withval" ;;
*) AC_MSG_RESULT(oops)
AC_MSG_ERROR(bad value ${withval} for --with-asan) ;;
esac], [with_asan="no"])
ASAN_LIBS=""
ASAN_CFLAGS=""
if test ".$with_asan" = ".yes" ; then
ASAN_LIBS="-lasan"
ASAN_CFLAGS="-fsanitize=address"
fi
AC_MSG_RESULT([$with_asan, $ASAN_CFLAGS])
AC_SUBST([ASAN_LIBS])
AC_SUBST([ASAN_CFLAGS])
# ---------------------------------------------------------------
AC_MSG_CHECKING(running extra tests on make check)
if test "MKZIP" != ":" ; then
Expand Down
2 changes: 2 additions & 0 deletions docs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
Expand Down
2 changes: 2 additions & 0 deletions test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
Expand Down
2 changes: 2 additions & 0 deletions zzip/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
Expand Down
2 changes: 2 additions & 0 deletions zzipwrap/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASAN_CFLAGS = @ASAN_CFLAGS@
ASAN_LIBS = @ASAN_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
Expand Down

0 comments on commit ff71508

Please sign in to comment.