blob: 650dba0a6671a8a5cc65e7421c7233f1375d77ad [file] [log] [blame]
Jim Apple147c2842017-03-18 12:56:50 -07001#!/bin/sh
2
James E. King, III0ad20bd2017-09-30 15:44:16 -07003set -e
Jim Apple147c2842017-03-18 12:56:50 -07004
James E. King, III0ad20bd2017-09-30 15:44:16 -07005# Wraps autotools.sh, but each binary crashes if it exhibits undefined behavior.
Jim Apple147c2842017-03-18 12:56:50 -07006# Set the undefined behavior flags. This crashes on all undefined behavior except for
7# undefined casting, aka "vptr".
Jim Apple147c2842017-03-18 12:56:50 -07008# TODO: fix undefined vptr behavior and turn this option back on.
James E. King, III0ad20bd2017-09-30 15:44:16 -07009
10export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined -O0 -ggdb3 -fno-omit-frame-pointer"
Jim Apple147c2842017-03-18 12:56:50 -070011export CXXFLAGS="${CFLAGS}"
James E. King, III0ad20bd2017-09-30 15:44:16 -070012export LDFLAGS="-lubsan"
Jim Apple147c2842017-03-18 12:56:50 -070013export UBSAN_OPTIONS=print_stacktrace=1
14
James E. King, III0ad20bd2017-09-30 15:44:16 -070015#
16# work around https://svn.boost.org/trac10/ticket/11632 if present
17#
18
19sed -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 Apple147c2842017-03-18 12:56:50 -070023CLANG_PATH="$(mktemp -d)"
24trap "rm -rf ${CLANG_PATH}" EXIT
James E. King, III0ad20bd2017-09-30 15:44:16 -070025ln -s "$(whereis llvm-symbolizer-4.0 | rev | cut -d ' ' -f 1 | rev)" \
Jim Apple147c2842017-03-18 12:56:50 -070026 "${CLANG_PATH}/llvm-symbolizer"
27export PATH="${CLANG_PATH}:${PATH}"
28llvm-symbolizer -version
29
30build/docker/scripts/autotools.sh $*