From 772e9bc233f471f3fb10c3d7d1e7c5da1287978c Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Wed, 22 May 2024 15:18:11 +0200 Subject: [PATCH] WIP --- flake.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index fa48ae86f81..342abe8c6c4 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ inherit system; }; - commonAttrs = { doCheck ? false, sanitizer ? "" }: { + commonAttrs = { doCheck ? false, sanitizer ? "", sanitizerFlags ? "" }: { src = ./.; checkInputs = with pkgs; [ gtest ]; propagatedBuildInputs = [ abc-verifier ]; @@ -62,22 +62,22 @@ yosysWithSanitizers = sanitizer: pkgs.clangStdenv.mkDerivation (commonAttrs { doCheck = true; sanitizer = sanitizer; + sanitizerFlags = sanitizer == "memory" ? "-fsanitize-memory-track-origins=2" : ""; } // { name = "yosys-with-${sanitizer}"; buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream gcc ]; preConfigure = "make config-clang"; checkTarget = "test"; buildPhase = '' - export CXXFLAGS="$CXXFLAGS -g" # Enable debug symbols + export CXXFLAGS="$CXXFLAGS -g -fsanitize=${sanitizer} ${sanitizerFlags}" # Enable debug symbols and sanitizer flags export LDFLAGS="-L${pkgs.gcc.libc}/lib" make -j$(nproc) ABCEXTERNAL=yosys-abc SANITIZER=${sanitizer} ''; checkPhase = '' - export CXXFLAGS="$CXXFLAGS -g" # Enable debug symbols + export CXXFLAGS="$CXXFLAGS -g -fsanitize=${sanitizer} ${sanitizerFlags}" # Enable debug symbols and sanitizer flags export LDFLAGS="-L${pkgs.gcc.libc}/lib" make test SANITIZER=${sanitizer} ''; - doCheck = false; }); yosysWithMultipleSanitizers = pkgs.clangStdenv.mkDerivation (commonAttrs { @@ -88,12 +88,12 @@ preConfigure = "make config-clang"; checkTarget = "test"; buildPhase = '' - export CXXFLAGS="$CXXFLAGS -g" # Enable debug symbols + export CXXFLAGS="$CXXFLAGS -g -fsanitize=address,undefined" # Enable debug symbols and multiple sanitizers export LDFLAGS="-L${pkgs.gcc.libc}/lib" make -j$(nproc) ABCEXTERNAL=yosys-abc SANITIZER="address,undefined" ''; checkPhase = '' - export CXXFLAGS="$CXXFLAGS -g" # Enable debug symbols + export CXXFLAGS="$CXXFLAGS -g -fsanitize=address,undefined" # Enable debug symbols and multiple sanitizers export LDFLAGS="-L${pkgs.gcc.libc}/lib" make test SANITIZER="address,undefined" '';