3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #42175 from obsidiansystems/gcc-darwin-sanitizer-still-fail

tests.cc-wrapper: Fix sanitizer condition
This commit is contained in:
John Ericson 2018-06-18 15:24:37 -04:00 committed by GitHub
commit 4627f0719d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,9 @@ with stdenv.lib;
let
# Sanitizers are not supported on Darwin.
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
sanitizersBroken = stdenv.cc.isClang && versionOlder (getVersion stdenv.cc.name) "6.0.0";
sanitizersWorking =
(stdenv.cc.isClang && versionAtLeast (getVersion stdenv.cc.name) "6.0.0")
|| (stdenv.cc.isGNU && stdenv.isLinux);
in stdenv.mkDerivation {
name = "cc-wrapper-test";
@ -43,7 +45,7 @@ in stdenv.mkDerivation {
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
./ldflags-check
${optionalString (!sanitizersBroken) ''
${optionalString sanitizersWorking ''
printf "checking whether sanitizers are fully functional... ">&2
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
./sanitizers