Skip to content

Commit eadedec

Browse files
authored
Ghidra 11.4 (#345)
* Backport patch to fix datatests/restruct.xml test
1 parent 7807d66 commit eadedec

8 files changed

Lines changed: 48 additions & 24 deletions

src/patches/stable/0001-Fix-UBSAN-errors-in-decompiler.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From b25de9d74c90bd1216e10b5697a27c3815641621 Mon Sep 17 00:00:00 2001
1+
From 54276cc9def6836b02a3f77471b84a7a096eb8ec Mon Sep 17 00:00:00 2001
22
From: Eric Kilmer <eric.d.kilmer@gmail.com>
33
Date: Mon, 12 Aug 2024 12:02:35 -0400
4-
Subject: [PATCH 1/6] Fix UBSAN errors in decompiler
4+
Subject: [PATCH 1/7] Fix UBSAN errors in decompiler
55

66
Co-authored-by: Alex Cameron <asc@tetsuo.sh>
77
---
@@ -18,10 +18,10 @@ Co-authored-by: Alex Cameron <asc@tetsuo.sh>
1818
10 files changed, 44 insertions(+), 18 deletions(-)
1919

2020
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
21-
index 3e9f310446..c903810382 100644
21+
index cafce3f7ba..b696fe6879 100644
2222
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
2323
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
24-
@@ -2868,8 +2868,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
24+
@@ -2893,8 +2893,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
2525
modellist.push_back(mymodel);
2626
}
2727
decoder.closeElement(elemId);
@@ -37,7 +37,7 @@ index 3e9f310446..c903810382 100644
3737

3838
void ParameterBasic::setTypeLock(bool val)
3939
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
40-
index e165951fe6..00169e22e5 100644
40+
index a62ee56fc3..66bcd48db0 100644
4141
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
4242
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
4343
@@ -666,7 +666,11 @@ uintb PcodeOp::getNZMaskLocal(bool cliploop) const
@@ -116,7 +116,7 @@ index ca9d71ab99..85d4dd281d 100644
116116
return res;
117117
}
118118
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
119-
index b7fda34cc9..a3d164aa2d 100644
119+
index 2b4a9474e5..aa86e740b2 100644
120120
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
121121
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
122122
@@ -976,7 +976,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data)
@@ -133,7 +133,7 @@ index b7fda34cc9..a3d164aa2d 100644
133133
consume = ~consume;
134134
if ((consume & indir->getIn(0)->getConsume())!=0) return 0;
135135

136-
@@ -7288,8 +7293,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
136+
@@ -7298,8 +7303,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
137137
Varnode *sb = op->getIn(0);
138138
Datatype *sbType = sb->getTypeReadFacing(op);
139139
if (sbType->getMetatype() != TYPE_PTR) return 0;
@@ -220,5 +220,5 @@ index 2571f55f1a..fe40e22b1b 100644
220220
uintb true_result = ((uintb)(int32_t)f) & 0xffffffff;
221221
uintb encoding = format.getEncoding(f);
222222
--
223-
2.49.0
223+
2.50.1
224224

src/patches/stable/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 1bd544111236b4b8f88429a074788e6616b05a38 Mon Sep 17 00:00:00 2001
1+
From 69272257372c594e866b34150c436962be1fa3a4 Mon Sep 17 00:00:00 2001
22
From: Alex Cameron <asc@tetsuo.sh>
33
Date: Wed, 3 Aug 2022 20:01:18 +1000
4-
Subject: [PATCH 2/6] Use `stroull` instead of `stroul` to parse address
4+
Subject: [PATCH 2/7] Use `stroull` instead of `stroul` to parse address
55
offsets
66

77
---
@@ -34,5 +34,5 @@ index dbaa2e775f..72927bf379 100644
3434
enddata = (const char *) tmpdata;
3535
if (enddata - s.c_str() == s.size()) { // If no size or offset override
3636
--
37-
2.49.0
37+
2.50.1
3838

src/patches/stable/0003-Use-string-resize-instead-of-reserve.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From f3b2fd0b950221005e02d294ef665e38d7f68b12 Mon Sep 17 00:00:00 2001
1+
From afef7a58fc2eb987fea303fc06c6d290fe3aa8a5 Mon Sep 17 00:00:00 2001
22
From: Eric Kilmer <eric.d.kilmer@gmail.com>
33
Date: Tue, 29 Oct 2024 15:30:57 -0400
4-
Subject: [PATCH 3/6] Use string resize instead of reserve
4+
Subject: [PATCH 3/7] Use string resize instead of reserve
55

66
assign will fix up the size to hold all of what's copied
77
---
@@ -32,5 +32,5 @@ index 5f5fa0c7b3..4cd77156f2 100644
3232
}
3333
data.isTruncated = (numChars >= maximumChars);
3434
--
35-
2.49.0
35+
2.50.1
3636

src/patches/stable/0004-Ignore-floating-point-test-due-to-compilation-differ.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 643f66ceb6add640d24a7c4b001e5236dfb8428f Mon Sep 17 00:00:00 2001
1+
From 84384e8d472511bb20cf3ebfa67415dc6293cb80 Mon Sep 17 00:00:00 2001
22
From: Eric Kilmer <eric.d.kilmer@gmail.com>
33
Date: Tue, 29 Oct 2024 17:51:09 -0400
4-
Subject: [PATCH 4/6] Ignore floating point test due to compilation differences
4+
Subject: [PATCH 4/7] Ignore floating point test due to compilation differences
55

66
This test fails on macOS and Windows. I'm unsure whether it's an OS or
77
compiler issue.
@@ -24,5 +24,5 @@ index fe40e22b1b..91440e2510 100644
2424
ASSERT_EQUALS(ff.printDecimal(f2, false), "0.33333334");
2525
double f3 = doubleFromRawBits(0x3fd0000000000000);
2626
--
27-
2.49.0
27+
2.50.1
2828

src/patches/stable/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 739a7cabff6e8718102b21bd4c639bb1d468794a Mon Sep 17 00:00:00 2001
1+
From c5524b18432739e441c4347f2d836d56faa74c77 Mon Sep 17 00:00:00 2001
22
From: Eric Kilmer <eric.d.kilmer@gmail.com>
33
Date: Wed, 30 Oct 2024 14:26:57 -0400
4-
Subject: [PATCH 5/6] Allow positive or negative NAN in decompiler floating
4+
Subject: [PATCH 5/7] Allow positive or negative NAN in decompiler floating
55
point test
66

77
At least on Apple Silicon, this test reports positive NAN.
@@ -33,5 +33,5 @@ index f8108d3d32..1060a3e193 100644
3333
<stringmatch name="Float print #14" min="1" max="1">double7 = 3.1415926535897933e-06;</stringmatch>
3434
</decompilertest>
3535
--
36-
2.49.0
36+
2.50.1
3737

src/patches/stable/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From d8ff76548dceea9e1a3a034dfd4967f246a7f716 Mon Sep 17 00:00:00 2001
1+
From 3330b9d1de3370d933bf7c3063fd4ca3744d1630 Mon Sep 17 00:00:00 2001
22
From: Eric Kilmer <eric.d.kilmer@gmail.com>
33
Date: Sat, 8 Feb 2025 17:59:57 -0500
4-
Subject: [PATCH 6/6] decompiler: Fix strict weak ordering TypePartialEnum
4+
Subject: [PATCH 6/7] decompiler: Fix strict weak ordering TypePartialEnum
55

66
This fixes Windows Debug error encountered in testing where it was
77
complaining about lack of strict weak ordering.
@@ -22,5 +22,5 @@ index f25b019a4f..2f1337a740 100644
2222
if (parent != tp->parent) return (parent < tp->parent) ? -1 : 1; // Compare absolute pointers
2323
if (offset != tp->offset) return (offset < tp->offset) ? -1 : 1;
2424
--
25-
2.49.0
25+
2.50.1
2626

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 4750c32e2390bdabdf77fca54b4c4f6a06585b02 Mon Sep 17 00:00:00 2001
2+
From: Eric Kilmer <eric.d.kilmer@gmail.com>
3+
Date: Fri, 18 Jul 2025 12:01:13 -0400
4+
Subject: [PATCH 7/7] Backport fix for datatests/retstruct.xml tests
5+
6+
---
7+
.../Features/Decompiler/src/decompile/datatests/retstruct.xml | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/Ghidra/Features/Decompiler/src/decompile/datatests/retstruct.xml b/Ghidra/Features/Decompiler/src/decompile/datatests/retstruct.xml
11+
index 4cc656af77..bbccfe65ee 100644
12+
--- a/Ghidra/Features/Decompiler/src/decompile/datatests/retstruct.xml
13+
+++ b/Ghidra/Features/Decompiler/src/decompile/datatests/retstruct.xml
14+
@@ -1,5 +1,5 @@
15+
<decompilertest>
16+
-<binaryimage arch="x86:LE:32:default:gcc">
17+
+<binaryimage arch="x86:LE:32:default:win">
18+
<!--
19+
Example function returning a structure stored across multiple registers
20+
-->
21+
--
22+
2.50.1
23+

src/setup-ghidra-source.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set_property(CACHE sleigh_RELEASE_TYPE PROPERTY STRINGS "stable" "HEAD")
2222
find_package(Git REQUIRED)
2323

2424
# Ghidra pinned stable version commit
25-
set(ghidra_version "11.3.2")
25+
set(ghidra_version "11.4")
2626
set(ghidra_git_tag "Ghidra_${ghidra_version}_build")
2727
set(ghidra_shallow TRUE)
2828

@@ -44,6 +44,7 @@ set(ghidra_patches
4444
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0004-Ignore-floating-point-test-due-to-compilation-differ.patch"
4545
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch"
4646
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch"
47+
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0007-Backport-fix-for-datatests-retstruct.xml-tests.patch"
4748
)
4849

4950
# Ghidra pinned commits used for pinning last known working HEAD commit

0 commit comments

Comments
 (0)