Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame^] | 3 | set -e |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 4 | |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame^] | 5 | # Wraps autotools.sh, but each binary crashes if it exhibits undefined behavior. |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 6 | # Set the undefined behavior flags. This crashes on all undefined behavior except for |
| 7 | # undefined casting, aka "vptr". |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 8 | # TODO: fix undefined vptr behavior and turn this option back on. |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame^] | 9 | |
| 10 | export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined -O0 -ggdb3 -fno-omit-frame-pointer" |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 11 | export CXXFLAGS="${CFLAGS}" |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame^] | 12 | export LDFLAGS="-lubsan" |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 13 | export UBSAN_OPTIONS=print_stacktrace=1 |
| 14 | |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame^] | 15 | # |
| 16 | # work around https://svn.boost.org/trac10/ticket/11632 if present |
| 17 | # |
| 18 | |
| 19 | sed -i 's/, stream_t(rdbuf()) /, stream_t(pbase_type::member.get())/g' /usr/include/boost/format/alt_sstream.hpp |
| 20 | |
| 21 | # llvm-symbolizer must be on PATH to get a stack trace on error |
| 22 | |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 23 | CLANG_PATH="$(mktemp -d)" |
| 24 | trap "rm -rf ${CLANG_PATH}" EXIT |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame^] | 25 | ln -s "$(whereis llvm-symbolizer-4.0 | rev | cut -d ' ' -f 1 | rev)" \ |
Jim Apple | 147c284 | 2017-03-18 12:56:50 -0700 | [diff] [blame] | 26 | "${CLANG_PATH}/llvm-symbolizer" |
| 27 | export PATH="${CLANG_PATH}:${PATH}" |
| 28 | llvm-symbolizer -version |
| 29 | |
| 30 | build/docker/scripts/autotools.sh $* |