diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2023-08-12 11:03:46 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2023-08-12 11:03:46 -0700 |
commit | 1411ccafc0f50997b56135c3ee542fdfe9d7f34c (patch) | |
tree | 21b2b47d2f549d25facfa0ec60a5184a5c20eddc | |
parent | 7dd6aa72455ef1f2aacdc28a00d1eaf632d59593 (diff) | |
download | zlib-1411ccafc0f50997b56135c3ee542fdfe9d7f34c.tar.gz zlib-1411ccafc0f50997b56135c3ee542fdfe9d7f34c.tar.bz2 zlib-1411ccafc0f50997b56135c3ee542fdfe9d7f34c.zip |
Add memory sanitizer to configure (--memory).
This also adds --address for the address sanitizer, in addition to
the existing --sanitizer. -fno-omit-frame-pointer has been added
for both sanitizers to improve the error reporting.
-rwxr-xr-x | configure | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -90,7 +90,8 @@ build64=0 | |||
90 | gcc=0 | 90 | gcc=0 |
91 | warn=0 | 91 | warn=0 |
92 | debug=0 | 92 | debug=0 |
93 | sanitize=0 | 93 | address=0 |
94 | memory=0 | ||
94 | old_cc="$CC" | 95 | old_cc="$CC" |
95 | old_cflags="$CFLAGS" | 96 | old_cflags="$CFLAGS" |
96 | OBJC='$(OBJZ) $(OBJG)' | 97 | OBJC='$(OBJZ) $(OBJG)' |
@@ -102,7 +103,7 @@ leave() | |||
102 | if test "$*" != "0"; then | 103 | if test "$*" != "0"; then |
103 | echo "** $0 aborting." | tee -a configure.log | 104 | echo "** $0 aborting." | tee -a configure.log |
104 | fi | 105 | fi |
105 | rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version | 106 | rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version |
106 | echo -------------------- >> configure.log | 107 | echo -------------------- >> configure.log |
107 | echo >> configure.log | 108 | echo >> configure.log |
108 | echo >> configure.log | 109 | echo >> configure.log |
@@ -141,7 +142,9 @@ case "$1" in | |||
141 | -c* | --const) zconst=1; shift ;; | 142 | -c* | --const) zconst=1; shift ;; |
142 | -w* | --warn) warn=1; shift ;; | 143 | -w* | --warn) warn=1; shift ;; |
143 | -d* | --debug) debug=1; shift ;; | 144 | -d* | --debug) debug=1; shift ;; |
144 | --sanitize) sanitize=1; shift ;; | 145 | --sanitize) address=1; shift ;; |
146 | --address) address=1; shift ;; | ||
147 | --memory) memory=1; shift ;; | ||
145 | *) | 148 | *) |
146 | echo "unknown option: $1" | tee -a configure.log | 149 | echo "unknown option: $1" | tee -a configure.log |
147 | echo "$0 --help for help" | tee -a configure.log | 150 | echo "$0 --help for help" | tee -a configure.log |
@@ -211,8 +214,11 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then | |||
211 | CFLAGS="${CFLAGS} -Wall -Wextra" | 214 | CFLAGS="${CFLAGS} -Wall -Wextra" |
212 | fi | 215 | fi |
213 | fi | 216 | fi |
214 | if test $sanitize -eq 1; then | 217 | if test $address -eq 1; then |
215 | CFLAGS="${CFLAGS} -g -fsanitize=address" | 218 | CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer" |
219 | fi | ||
220 | if test $memory -eq 1; then | ||
221 | CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer" | ||
216 | fi | 222 | fi |
217 | if test $debug -eq 1; then | 223 | if test $debug -eq 1; then |
218 | CFLAGS="${CFLAGS} -DZLIB_DEBUG" | 224 | CFLAGS="${CFLAGS} -DZLIB_DEBUG" |