Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RCoeurjoly committed May 22, 2024
1 parent a81b03b commit 772e9bc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
inherit system;
};

commonAttrs = { doCheck ? false, sanitizer ? "" }: {
commonAttrs = { doCheck ? false, sanitizer ? "", sanitizerFlags ? "" }: {
src = ./.;
checkInputs = with pkgs; [ gtest ];
propagatedBuildInputs = [ abc-verifier ];
Expand Down Expand Up @@ -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 {
Expand All @@ -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"
'';
Expand Down

0 comments on commit 772e9bc

Please sign in to comment.