tests.cc-wrapper: verify building with sanitizers
This commit is contained in:
parent
16da44b5c1
commit
46eeef1898
@ -9,7 +9,7 @@
|
|||||||
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
||||||
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
|
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
|
||||||
, extraPackages ? [], extraBuildCommands ? ""
|
, extraPackages ? [], extraBuildCommands ? ""
|
||||||
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
|
, isGNU ? false, isClang ? cc.isClang or false, isCompilerRT ? false, gnugrep ? null
|
||||||
, buildPackages ? {}
|
, buildPackages ? {}
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ stdenv.mkDerivation {
|
|||||||
# Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
|
# Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
|
||||||
# unused middle-ground name that evokes both.
|
# unused middle-ground name that evokes both.
|
||||||
inherit bintools;
|
inherit bintools;
|
||||||
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile;
|
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang isCompilerRT default_cxx_stdlib_compile;
|
||||||
|
|
||||||
emacsBufferSetup = pkgs: ''
|
emacsBufferSetup = pkgs: ''
|
||||||
; We should handle propagation here too
|
; We should handle propagation here too
|
||||||
|
@ -53,6 +53,7 @@ let
|
|||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
isCompilerRT = true;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
rsrc="$out/resource-root"
|
rsrc="$out/resource-root"
|
||||||
mkdir "$rsrc"
|
mkdir "$rsrc"
|
||||||
|
@ -38,6 +38,11 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
|
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
|
||||||
./ldflags-check
|
./ldflags-check
|
||||||
|
'' + stdenv.lib.optionalString (stdenv.cc.isCompilerRT or false) ''
|
||||||
|
|
||||||
|
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
|
||||||
|
./sanitizers
|
||||||
|
'' + ''
|
||||||
|
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
|
8
pkgs/test/cc-wrapper/sanitizers.c
Normal file
8
pkgs/test/cc-wrapper/sanitizers.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include <sanitizer/asan_interface.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ok\n");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user