tsan: Compile with -fPIE and force clang-3.8

This fixes failures with TSAN builds like

    FATAL: ThreadSanitizer can not mmap the shadow memory (something is mapped at 0x55deea465000 < 0x7cf000000000)
    FATAL: Make sure to compile with -fPIE and to link with -pie.
This commit is contained in:
James McCoy 2016-11-11 14:18:54 -05:00
parent a46fc0d754
commit b6a090b4fd
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
2 changed files with 8 additions and 9 deletions

View File

@ -9,9 +9,7 @@ env:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
- MAKE_CMD="make -j2"
# Update PATH for pip.
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
# LLVM symbolizer path.
- LLVM_SYMBOLIZER="$(which llvm-symbolizer-3.4)"
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:/usr/lib/llvm-symbolizer-3.8/bin:$PATH"
# Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies.
@ -36,8 +34,7 @@ env:
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Environment variables for Clang sanitizers.
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
- ASAN_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER"
- TSAN_OPTIONS="external_symbolizer_path=$LLVM_SYMBOLIZER log_path=$LOG_DIR/tsan"
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
- UBSAN_OPTIONS="log_path=$LOG_DIR/ubsan"
# Environment variables for Valgrind.
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
@ -70,10 +67,10 @@ matrix:
compiler: gcc-5 -m32
env: BUILD_32BIT=ON
- os: linux
compiler: clang
compiler: clang-3.8
env: CLANG_SANITIZER=ASAN_UBSAN
- os: linux
compiler: clang
compiler: clang-3.8
env: CLANG_SANITIZER=TSAN
- os: osx
compiler: clang
@ -96,11 +93,12 @@ addons:
# TODO: Remove PPA when Travis gets Python >=3.3.
- deadsnakes
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- autoconf
- automake
- build-essential
- clang-3.4
- clang-3.8
- cmake
- g++-5-multilib
- g++-multilib
@ -109,7 +107,7 @@ addons:
- gdb
- libc6-dev-i386
- libtool
- llvm-3.4-dev
- llvm-3.8-dev
- pkg-config
- python3.3-dev
- unzip

View File

@ -326,6 +326,7 @@ elseif(CLANG_TSAN)
message(STATUS "Enabling Clang thread sanitizer for nvim.")
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ")
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fsanitize=thread ")
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fPIE ")
set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=thread ")
endif()