remove home-built sanitizer support, use boost-build features

This commit is contained in:
Arvid Norberg 2020-04-10 17:58:08 +02:00 committed by Arvid Norberg
parent 11b19ac813
commit 46a6b74ee0
3 changed files with 11 additions and 72 deletions

View File

@ -18,8 +18,8 @@ matrix:
apt:
packages:
- python3-pip
- env: variant=test_debug tests=1 toolset=gcc-sanitizer fuzzers=1
- env: variant=test_debug sim=1 crypto=openssl toolset=gcc-sanitizer
- env: variant=test_debug tests=1 toolset=gcc sanitizer=on fuzzers=1
- env: variant=test_debug sim=1 crypto=openssl toolset=gcc sanitizer=on
- env: variant=test_release coverage=1 tests=1 toolset=gcc-coverage
- env: autotools=1 toolset=gcc install_boost=1
- env: cmake=1 toolset=gcc install_boost=1
@ -88,6 +88,7 @@ before_install:
- cd $TRAVIS_BUILD_DIR
- git submodule update --init --recursive
- 'if [[ $crypto == "" ]]; then export crypto=built-in; fi'
- 'if [[ $sanitizer == "" ]]; then export sanitizer=off; fi'
- 'if [[ $TRAVIS_OS_NAME == "osx" ]]; then
travis_retry brew update > /dev/null && brew install ccache;
fi'
@ -133,17 +134,6 @@ install:
g++ --version;
echo "using gcc : : ccache g++ : <cxxflags>-std=c++11 ;" >> ~/user-config.jam;
fi'
- 'if [[ $toolset == "gcc-sanitizer" ]]; then
echo "using gcc : sanitizer : ccache g++ :
<cxxflags>-std=c++11
<compileflags>-fstack-protector-all
<compileflags>-fstack-check
<compileflags>-fsanitize=address,undefined
<compileflags>-fno-sanitize-recover=address,undefined
<linkflags>-fsanitize=address,undefined
<linkflags>-fno-sanitize-recover=address,undefined
<linkflags>-fuse-ld=gold ;" >> ~/user-config.jam;
fi'
- 'if [[ $toolset == "gcc-coverage" ]]; then
echo "using gcc : coverage : ccache g++ --coverage : <cxxflags>-std=c++11 <linkflags>--coverage ;" >> ~/user-config.jam;
fi'
@ -250,6 +240,9 @@ script:
# the common boost-build command line arguments. It's important they are all
# the same, in order for builds to be reused between invocations
- export B2_ARGS="crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant"
- 'if [[ $sanitizer == "on" ]]; then
export B2_ARGS="${B2_ARGS} address-sanitizer=norecover undefined-sanitizer=norecover";
fi'
- 'if [[ $TRAVIS_OS_NAME == "osx" && "$crypto" == "openssl" ]]; then
export B2_ARGS="${B2_ARGS} openssl-lib=/usr/local/opt/openssl@1.1/lib openssl-include=/usr/local/opt/openssl@1.1/include" ;
@ -278,7 +271,7 @@ script:
# rebuilding libtorrent itself.
- cd ../fuzzers
- 'if [ "$fuzzers" == "1" ]; then
${B2} -j2 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant sanitize=off fuzz=off link=shared stage;
${B2} -j2 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant fuzz=off link=shared stage;
fi'
- cd ../examples

55
Jamfile
View File

@ -379,63 +379,9 @@ rule openssl-include-path ( properties * )
return $(result) ;
}
path-constant blacklist-file : tools/sanitizer-blacklist.txt ;
rule sanitizer-options ( properties * )
{
local result ;
if <sanitize>on in $(properties)
{
local sanitizers ;
local extra ;
local flags ;
# sanitize is a clang and GCC feature
if <toolset>clang in $(properties)
{
local version = [ feature.get-values <toolset-clang:version> : $(properties) ] ;
# implicit-conversion sanitizer was added in clang-7
if $(version) >= 7.0 {
sanitizers += address,undefined,leak,implicit-conversion ;
}
else {
sanitizers += address,undefined,leak ;
}
extra = <cflags>-fsanitize-blacklist=$(blacklist-file) ;
flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ;
}
# sanitizers are not available on windows (mingw)
else if <toolset>gcc in $(properties) && ! <target-os>windows in $(properties)
{
local version = [ feature.get-values <toolset-gcc:version> : $(properties) ] ;
if $(version) >= 7.0 {
extra = <cflags>-fsanitize-address-use-after-scope ;
}
if $(version) >= 5.0 {
sanitizers = address,undefined,leak ;
flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ;
}
}
else if <toolset>darwin in $(properties)
{
# apple's compiler is typically an old version of clang
sanitizers = address,undefined ;
flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ;
}
result = <cflags>$(flags) <linkflags>$(flags) $(extra) ;
}
return $(result) ;
}
feature openssl-lib : : free path ;
feature openssl-include : : free path ;
feature sanitize : off rtc on : composite propagated link-incompatible ;
# RTC (runtime check) is an msvc feature
feature.compose <sanitize>rtc : <cflags>/RTCc <cflags>/RTCsu ;
feature test-coverage : off on : composite propagated link-incompatible ;
feature.compose <test-coverage>on : <cflags>--coverage <linkflags>--coverage ;
@ -791,7 +737,6 @@ local usage-requirements =
# make sure asio uses std::chrono
<define>BOOST_ASIO_HAS_STD_CHRONO
<conditional>@linking
<conditional>@sanitizer-options
# msvc optimizations
<toolset>msvc,<variant>release:<linkflags>"/OPT:ICF=5"
<toolset>msvc,<variant>release:<linkflags>"/OPT:REF"

View File

@ -12,9 +12,9 @@ feature fuzz : off external on : composite propagated link-incompatible ;
feature.compose <fuzz>on : <cflags>-fsanitize=fuzzer <linkflags>-fsanitize=fuzzer ;
# this is a build configuration that only does limited validation (i.e. no
# sanitizers, invariant-checks, asserts etc.). The purpose is to quickly iterate
# invariant-checks, asserts etc.). The purpose is to quickly iterate
# on inputs to build code coverage
variant build_coverage : release : <sanitize>off <debug-symbols>on <asserts>off <invariant-checks>off ;
variant build_coverage : release : <debug-symbols>on <asserts>off <invariant-checks>off ;
project fuzzers
: requirements
@ -28,7 +28,8 @@ project fuzzers
<library>/torrent//torrent/
: default-build
<fuzz>on
<sanitize>on
<address-sanitizer>norecover
<undefined-sanitizer>norecover
<link>static
<variant>release
<debug-symbols>on