diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-28 17:52:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-28 17:52:01 +0200 |
| commit | 774a824a6c80b5af495f4fb99d98758e3b9f6b81 (patch) | |
| tree | 401d3230db843bb549608f30cee222d1d6a9a111 | |
| parent | 3429b552bc4367136f015c182f723ee977bb55a3 (diff) | |
| download | nissy-core-774a824a6c80b5af495f4fb99d98758e3b9f6b81.tar.gz nissy-core-774a824a6c80b5af495f4fb99d98758e3b9f6b81.zip | |
Use address and UB sanitizers by default, always
| -rwxr-xr-x | configure.sh | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/configure.sh b/configure.sh index e61a163..2b2f40b 100755 --- a/configure.sh +++ b/configure.sh | |||
| @@ -22,10 +22,10 @@ | |||
| 22 | # SANITIZE="option1,option2,..." | 22 | # SANITIZE="option1,option2,..." |
| 23 | # Add the options "-fsanitize=option1", "-fsanitize=option2", ... to the | 23 | # Add the options "-fsanitize=option1", "-fsanitize=option2", ... to the |
| 24 | # compilation command when compiling in debug mode. | 24 | # compilation command when compiling in debug mode. |
| 25 | # By default, "-fsanitize=address" and "-fsanitize=undefined" will be used, | 25 | # By default, "-fsanitize=address" and "-fsanitize=undefined" will be used. |
| 26 | # if available. If this variable is set, the default is overridden. | 26 | # If this variable is set, the default is overridden. No check is performed |
| 27 | # No check is performed on the given sanitizers, make sure that the ones you | 27 | # on the availability of any sanitizer used, make sure the ones you use are |
| 28 | # choose are available on your system and compatible with each other. | 28 | # available on your system. |
| 29 | # | 29 | # |
| 30 | # Examples | 30 | # Examples |
| 31 | # | 31 | # |
| @@ -39,10 +39,6 @@ greparch() { | |||
| 39 | $CC -march=native -dM -E - </dev/null 2>/dev/null | grep "$1" | 39 | $CC -march=native -dM -E - </dev/null 2>/dev/null | grep "$1" |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | grepsan() { | ||
| 43 | $CC -fsanitize="$1" -dM -E -x c - </dev/null 2>/dev/null | grep "SANITIZE" | ||
| 44 | } | ||
| 45 | |||
| 46 | detectthreads() { | 42 | detectthreads() { |
| 47 | echo 16 # TODO: choose based on system | 43 | echo 16 # TODO: choose based on system |
| 48 | } | 44 | } |
| @@ -100,10 +96,7 @@ if [ -n "$SANITIZE" ]; then | |||
| 100 | SAN="$SAN -fsanitize=$san" | 96 | SAN="$SAN -fsanitize=$san" |
| 101 | done | 97 | done |
| 102 | else | 98 | else |
| 103 | # No sanitizer specified, use "address" and "undefined" if present | 99 | SAN="-fsanitize=address -fsanitize=undefined" |
| 104 | [ -n "$(grepsan address)" ] && ADDR="-fsanitize=address" | ||
| 105 | [ -n "$(grepsan undefined)" ] && UNDEF="-fsanitize=undefined" | ||
| 106 | SAN="$ADDR $UNDEF" | ||
| 107 | fi | 100 | fi |
| 108 | LIBS="-lpthread" | 101 | LIBS="-lpthread" |
| 109 | 102 | ||
