Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ddisasm det fork #21

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion basil/planter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let
gts="''${args[4]}"

${gcc-aarch64.targetPrefix}"$compiler" ''${CFLAGS:-} "$in" -o "$out"
ddisasm-deterministic "$out" --ir "$gtirb"
ddisasm "$out" --ir "$gtirb"
proto-json.py "$gtirb" "$gtirb" -s8 --idem
gtirb-semantics "$gtirb" "$gts"
proto-json.py "$gts" "$gts" --idem
Expand Down
5 changes: 3 additions & 2 deletions gtirb/capstone-grammatech.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

capstone.overrideAttrs {
pname = "capstone-grammatech";
version = "5.0.1-unstable-2024-04-30";

src = fetchFromGitHub {
owner = "GrammaTech";
repo = "capstone";
rev = "a11159a0bbd680e134c53d6a16e304b53488824b";
hash = "sha256-0aCmlXsrdWYlxqzRlXj8TNkD0s8xHMTq0YlVJ+t1fD4=";
rev = "30a4ecf01b43abed8527d0d84c1ea182e6e3da8b";
hash = "sha256-JWw+S2IIBxTxDrdBlu3OqiMZ13y0T1bC2jpUDC3Mn5M=";
};

preConfigure = ''
Expand Down
33 changes: 15 additions & 18 deletions gtirb/ddisasm.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, cmake
, boost
Expand All @@ -10,41 +11,37 @@
, capstone-grammatech
, souffle
, ddisasm
, makeWrapper
, runCommand
, runCommandCC
, unrandom
, testers
, jq
}:

stdenv.mkDerivation {
pname = "ddisasm";
version = "unstable-2024-03-08";
version = "0-unstable-2024-10-31";

src = fetchFromGitHub {
owner = "GrammaTech";
repo = "ddisasm";
rev = "9edfe9fe86910ef946de1db7a7ac41ce86bc31d0";
hash = "sha256-xFW6J3jCCMtUqT25/zVfjjy5o3MoX1HXxIlRhjM6s8A=";
rev = "17396b59537aaff73e2c7657ccd3b3eb2c3b6a04";
hash = "sha256-yFZ0QR1upmTzEyATsTM5bGPr0EPWxkyXKbGa5nYSEIE=";
};

patches = [
(fetchurl {
url = "https://github.com/rina-forks/ddisasm/compare/main..determinism.patch";
hash = "sha256-xISyR7ptR2LfHZJAGUyXqANLIab9yZrQFh8wLbJLsx8=";
})
];

buildInputs = [ cmake boost lief gtirb gtirb-pprinter libehp ];
nativeBuildInputs = [ capstone-grammatech souffle ];

cmakeFlags = [ "-DDDISASM_ENABLE_TESTS=OFF" "-DDDISASM_GENERATE_MANY=ON" ];

CXXFLAGS = "-includeset";
CXXFLAGS = [ "-includeset" ];

passthru.deterministic =
runCommand
(ddisasm.name + "-deterministic")
{ nativeBuildInputs = [ makeWrapper ]; }
''
makeWrapper ${lib.getExe ddisasm} $out/bin/ddisasm-deterministic \
--inherit-argv0 \
--suffix LD_PRELOAD : ${lib.getLib unrandom}/lib/*.so
'';
passthru.deterministic = ddisasm;

passthru.tests.ddisasm = testers.testVersion {
package = ddisasm;
Expand All @@ -59,8 +56,8 @@ stdenv.mkDerivation {
mkdir -p $out && cd $out
echo 'int main(void) { return 0; }' > a.c
$CC a.c
ddisasm-deterministic a.out --json | jq -S > a1
ddisasm-deterministic a.out --json | jq -S > a2
ddisasm a.out --json | jq -S > a1
ddisasm a.out --json | jq -S > a2
diff -q a1 a2
'';

Expand Down
17 changes: 10 additions & 7 deletions gtirb/gtirb-pprinter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@

stdenv.mkDerivation {
pname = "gtirb-pprinter";
version = "2.1.0";
version = "2.2.0-unstable-2024-10-09";

src = fetchFromGitHub {
owner = "GrammaTech";
repo = "gtirb-pprinter";
rev = "v2.1.0";
hash = "sha256-zgYq6FKxaJ6vLzvOTCfOU4ZUyXvMuFc3abNrqg8NADc=";
rev = "762a287f3d12c6aac3d3d000cdc8bf20f5ee34f2";
hash = "sha256-9CZ+ndHX5f4rKbGXvCrqEg55Ep9JEkS/u//grdqTpTc=";
};

buildInputs = [ cmake python3 gtirb boost abseil-cpp gtest ];
nativeBuildInputs = [ capstone-grammatech ];

cmakeFlags = [ "-DGTIRB_PPRINTER_ENABLE_TESTS=OFF" ];

preConfigure = ''
export CXXFLAGS='-includecstdint -includeset -Wno-error=unused-result -Wno-error=deprecated-declarations -Wno-error=array-bounds'
'';
CXXFLAGS= [
"-includecstdint"
"-includeset"
"-Wno-error=unused-result"
"-Wno-error=deprecated-declarations"
"-Wno-error=array-bounds"
];

meta = {
homepage = "https://github.com/grammatech/gtirb-pprinter";
Expand Down
14 changes: 11 additions & 3 deletions gtirb/gtirb.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, cmake
, python3
Expand All @@ -10,15 +11,22 @@

stdenv.mkDerivation {
pname = "gtirb";
version = "2.0.0";
version = "2.2.0";

src = fetchFromGitHub {
owner = "GrammaTech";
repo = "gtirb";
rev = "v2.0.0";
hash = "sha256-ueoqxm6iXv4JgzR/xkImT+O8xx+7bA2upx1TJ828LLA=";
rev = "v2.2.0";
hash = "sha256-dzkVwQ7MvVm4KUX/Lo03yd1P9OHj+q1/kp4ZpdO8NDk=";
};

patches = [
(fetchurl {
url = "https://github.com/rina-forks/gtirb/compare/master..det.patch";
hash = "sha256-86cRmnV5CL5DjOzFj+cJYUYKQpHQ6DsqnZDaMGa/kog=";
})
];

nativeBuildInputs = [ ];
buildInputs = [ cmake python3 boost doxygen ];
propagatedBuildInputs = [ protobuf ];
Expand Down
Loading