diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-04-17 16:33:39 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-04-17 11:37:34 -0400 |
commit | c6df8cc4f7cdbff2bf86d40be3ee1e9daae6c9b6 (patch) | |
tree | eeabe1d673ede2b14bf0227578f73c2a3628f2d5 /tools/configure | |
parent | 6f5af8e53cd19bdc57481703179ebe498873e014 (diff) | |
download | rockbox-c6df8cc4f7cdbff2bf86d40be3ee1e9daae6c9b6.tar.gz rockbox-c6df8cc4f7cdbff2bf86d40be3ee1e9daae6c9b6.zip |
configure: Add support for compiling the simulator with UBSan
By passing --with-ubsan to tools/configure, you can now build the
simulator with UBSan to catch undefined behavior at runtime.
Change-Id: I054cd46ca59587dd544efbd7bdf6d27a040a4891
Diffstat (limited to 'tools/configure')
-rwxr-xr-x | tools/configure | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/configure b/tools/configure index ac657e38c9..12b45bf890 100755 --- a/tools/configure +++ b/tools/configure @@ -270,6 +270,12 @@ simcc () { LDOPTS="$LDOPTS -fsanitize=address -lasan" fi + if [ "$ARG_UBSAN" = "1" ] ; then + echo "Using UBSan" + GCCOPTS="$GCCOPTS -fsanitize=undefined -fPIC" + LDOPTS="$LDOPTS -fsanitize=undefined" + fi + # Some linux setups like to warn about unused results. They are correct, # but cleaning this up is a lot of work. GCCOPTS="$GCCOPTS -Wno-unused-result" @@ -479,6 +485,9 @@ EOF if [ "$ARG_ADDR_SAN" = "1" ] ; then ARG_THREAD_SUPPORT=1 fi + if [ "$ARG_UBSAN" = "1" ] ; then + ARG_THREAD_SUPPORT=1 + fi thread_support= if [ -z "$ARG_THREAD_SUPPORT" ] || [ "$ARG_THREAD_SUPPORT" = "0" ]; then @@ -1429,6 +1438,7 @@ ARG_PREFIX="$PREFIX" ARG_THREAD_SUPPORT= ARG_32BIT= ARG_ADDR_SAN= +ARG_UBSAN= err= for arg in "$@"; do case "$arg" in @@ -1452,6 +1462,7 @@ for arg in "$@"; do --no-sdl-threads) ARG_THREAD_SUPPORT=0;; --with-address-sanitizer) ARG_ADDR_SAN=1;; + --with-ubsan) ARG_UBSAN=1;; --prefix=*) ARG_PREFIX=`echo "$arg" | cut -d = -f 2`;; --compiler-prefix=*) ARG_COMPILER_PREFIX=`echo "$arg" | cut -d = -f 2`;; --help) help;; |