Update Ghidra HEAD to commit e3c1b6393 (#397)

* Bump Ghidra HEAD commit e3c1b6393

Changed files:

```
M	Ghidra/Features/Decompiler/src/decompile/cpp/Makefile
M	Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/address.hh
A	Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc
A	Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/block.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/constseq.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/dynamic.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/expression.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/expression.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_block.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/grammar.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/grammar.y
M	Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/marshal.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/opcodes.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/prettyprint.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/prettyprint.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/printjava.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/type.hh
M	Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
M	Ghidra/Features/Decompiler/src/decompile/cpp/typeop.hh
```

Commit details:

```
[Commit 1/2]
Hash: bf1f4288aa3b317e3c097773ba4b8e7b89ae09c7
Date: 2026-02-10 19:33:46 +0000
Message: GP-5922 Integer formatting for switch cases

Files changed:
  M	Ghidra/Features/Decompiler/src/decompile/cpp/block.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_block.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printjava.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hh

[Commit 2/2]
Hash: 402d10d6cc66e1fcf3d8f36bc851ef652773e018
Date: 2025-09-05 00:01:44 +0000
Message: GP-2493 Bitfield support in the Decompiler

Files changed:
  M	Ghidra/Features/Decompiler/src/decompile/cpp/Makefile
  M	Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/address.hh
  A	Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc
  A	Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/constseq.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/dynamic.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/expression.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/expression.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/grammar.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/grammar.y
  M	Ghidra/Features/Decompiler/src/decompile/cpp/marshal.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/opcodes.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/prettyprint.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/prettyprint.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/type.hh
  M	Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
  M	Ghidra/Features/Decompiler/src/decompile/cpp/typeop.hh
```

* Add new C++ files to CMake

* Fix more strict weak ordering issues

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eric Kilmer <eric.kilmer@trailofbits.com>
This commit is contained in:
auto-updater[bot]
2026-02-24 22:11:46 -05:00
committed by GitHub
parent 9daaa780c2
commit fbefd7d828
9 changed files with 96 additions and 34 deletions
+5 -4
View File
@@ -148,10 +148,11 @@ set(public_include_header_list
"${library_root}/constseq.hh"
"${library_root}/expression.hh"
)
#if(sleigh_RELEASE_IS_HEAD)
# list(APPEND public_include_header_list
# )
#endif()
if(sleigh_RELEASE_IS_HEAD)
list(APPEND public_include_header_list
"${library_root}/bitfield.hh"
)
endif()
# Create custom target so that IDEs know these files are part of the sources
add_custom_target(sleigh_all_headers SOURCES ${public_include_header_list})
set(public_headers_dir ${CMAKE_CURRENT_BINARY_DIR}/include)
@@ -1,7 +1,7 @@
From 9d1e7b00e8f5dca987038a78fbac400c835a78be Mon Sep 17 00:00:00 2001
From 98769d3cd2f417a52559bf68700e2f9f3e7a0e4f Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Mon, 12 Aug 2024 12:02:35 -0400
Subject: [PATCH 1/5] Fix UBSAN errors in decompiler
Subject: [PATCH 1/7] Fix UBSAN errors in decompiler
Co-authored-by: Alex Cameron <asc@tetsuo.sh>
---
@@ -13,10 +13,10 @@ Co-authored-by: Alex Cameron <asc@tetsuo.sh>
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc
index ca9d71ab99..85d4dd281d 100644
index a67a3de849..37ba4930e6 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc
@@ -621,8 +621,10 @@ vector<OpTpl *> *PcodeCompile::assignBitRange(VarnodeTpl *vn,uint4 bitoffset,uin
@@ -618,8 +618,10 @@ vector<OpTpl *> *PcodeCompile::assignBitRange(VarnodeTpl *vn,uint4 bitoffset,uin
uint4 smallsize = (numbits+7)/8; // Size of input (output of rhs)
bool shiftneeded = (bitoffset != 0);
bool zextneeded = true;
@@ -29,7 +29,7 @@ index ca9d71ab99..85d4dd281d 100644
if (vn->getSize().getType()==ConstTpl::real) {
// If we know the size of the bitranged varnode, we can
@@ -726,9 +728,6 @@ ExprTree *PcodeCompile::createBitRange(SpecificSymbol *sym,uint4 bitoffset,uint4
@@ -723,9 +725,6 @@ ExprTree *PcodeCompile::createBitRange(SpecificSymbol *sym,uint4 bitoffset,uint4
}
}
@@ -39,7 +39,7 @@ index ca9d71ab99..85d4dd281d 100644
if (truncneeded && ((bitoffset % 8)==0)) {
truncshift = bitoffset/8;
bitoffset = 0;
@@ -751,8 +750,13 @@ ExprTree *PcodeCompile::createBitRange(SpecificSymbol *sym,uint4 bitoffset,uint4
@@ -748,8 +747,13 @@ ExprTree *PcodeCompile::createBitRange(SpecificSymbol *sym,uint4 bitoffset,uint4
appendOp(CPUI_INT_RIGHT,res,bitoffset,4);
if (truncneeded)
appendOp(CPUI_SUBPIECE,res,truncshift,4);
@@ -56,7 +56,7 @@ index ca9d71ab99..85d4dd281d 100644
return res;
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc
index cd9b9835b1..8a4616c3b9 100644
index 18e2ff8ba1..3bfe29f2ef 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc
@@ -22,6 +22,7 @@ ConstTpl::ConstTpl(const_type tp)
@@ -76,7 +76,7 @@ index cd9b9835b1..8a4616c3b9 100644
bool ConstTpl::isConstSpace(void) const
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
index e0b069959d..9117a45c75 100644
index b53b18797d..b2f043e32d 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
@@ -47,7 +47,7 @@ class ConstTpl {
@@ -89,10 +89,10 @@ index e0b069959d..9117a45c75 100644
type=op2.type; value=op2.value; value_real=op2.value_real; select=op2.select; }
ConstTpl(const_type tp,uintb val);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
index 50d85e22ba..9f3b456229 100644
index 75bebffcb0..bf5e7ce681 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
@@ -2164,8 +2164,8 @@ string SleighCompile::checkSymbols(SymbolScope *scope)
@@ -2323,8 +2323,8 @@ string SleighCompile::checkSymbols(SymbolScope *scope)
ostringstream msg;
SymbolTree::const_iterator iter;
for(iter=scope->begin();iter!=scope->end();++iter) {
@@ -116,5 +116,5 @@ index 2571f55f1a..fe40e22b1b 100644
uintb true_result = ((uintb)(int32_t)f) & 0xffffffff;
uintb encoding = format.getEncoding(f);
--
2.50.1
2.51.1
@@ -1,7 +1,7 @@
From 729f72060849dc4f29e89b1c76a980563ffd3e2a Mon Sep 17 00:00:00 2001
From 4e6f277eae589c4f9bceb40337d43384248d272c Mon Sep 17 00:00:00 2001
From: Alex Cameron <asc@tetsuo.sh>
Date: Wed, 3 Aug 2022 20:01:18 +1000
Subject: [PATCH 2/5] Use `stroull` instead of `stroul` to parse address
Subject: [PATCH 2/7] Use `stroull` instead of `stroul` to parse address
offsets
---
@@ -34,5 +34,5 @@ index dbaa2e775f..72927bf379 100644
enddata = (const char *) tmpdata;
if (enddata - s.c_str() == s.size()) { // If no size or offset override
--
2.50.1
2.51.1
@@ -1,7 +1,7 @@
From 39cfff6f08dad8a85f992e09b3e26716c9173bf7 Mon Sep 17 00:00:00 2001
From 41eb6be342d29d6ff618d06b391bf33209fe8ade Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Tue, 29 Oct 2024 17:51:09 -0400
Subject: [PATCH 3/5] Ignore floating point test due to compilation differences
Subject: [PATCH 3/7] Ignore floating point test due to compilation differences
This test fails on macOS and Windows. I'm unsure whether it's an OS or
compiler issue.
@@ -24,5 +24,5 @@ index fe40e22b1b..91440e2510 100644
ASSERT_EQUALS(ff.printDecimal(f2, false), "0.33333334");
double f3 = doubleFromRawBits(0x3fd0000000000000);
--
2.50.1
2.51.1
@@ -1,7 +1,7 @@
From 2aa4395ef8874ee9890126f4bdad0d71adf9eacc Mon Sep 17 00:00:00 2001
From 8aa8bf7a146ab43f5b1b27386667af52269720fd Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Wed, 30 Oct 2024 14:26:57 -0400
Subject: [PATCH 4/5] Allow positive or negative NAN in decompiler floating
Subject: [PATCH 4/7] Allow positive or negative NAN in decompiler floating
point test
At least on Apple Silicon, this test reports positive NAN.
@@ -33,5 +33,5 @@ index f8108d3d32..1060a3e193 100644
<stringmatch name="Float print #14" min="1" max="1">double7 = 3.1415926535897933e-06;</stringmatch>
</decompilertest>
--
2.50.1
2.51.1
@@ -1,7 +1,7 @@
From 2a6bd0a0ad7797160db887bba7137b77aa148ba5 Mon Sep 17 00:00:00 2001
From d9242056b580cc994661c41344c9ad51b636b0e5 Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Sat, 8 Feb 2025 17:59:57 -0500
Subject: [PATCH 5/5] decompiler: Fix strict weak ordering TypePartialEnum
Subject: [PATCH 5/7] decompiler: Fix strict weak ordering TypePartialEnum
This fixes Windows Debug error encountered in testing where it was
complaining about lack of strict weak ordering.
@@ -10,10 +10,10 @@ complaining about lack of strict weak ordering.
1 file changed, 1 insertion(+)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
index 962c525b7f..7db5024b54 100644
index 2d48650e70..4a52633ebf 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
@@ -2303,6 +2303,7 @@ int4 TypePartialEnum::compareDependency(const Datatype &op) const
@@ -2703,6 +2703,7 @@ int4 TypePartialEnum::compareDependency(const Datatype &op) const
{
if (submeta != op.getSubMeta()) return (submeta < op.getSubMeta()) ? -1 : 1;
@@ -22,5 +22,5 @@ index 962c525b7f..7db5024b54 100644
if (parent != tp->parent) return (parent < tp->parent) ? -1 : 1; // Compare absolute pointers
if (offset != tp->offset) return (offset < tp->offset) ? -1 : 1;
--
2.50.1
2.51.1
@@ -0,0 +1,29 @@
From f2fdafbd981a441c35ab243bcb74872febd6bbd4 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 25 Feb 2026 02:29:10 +0000
Subject: [PATCH 6/7] decompiler: Fix strict weak ordering PullRecord
When both readOp pointers are null, PullRecord::operator< incorrectly
returns true, violating strict weak ordering (irreflexivity). This is
caught by libc++ debug mode hardening assertions at pullList.sort().
---
Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc
index add61c741b..3e01d2e045 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/bitfield.cc
@@ -1058,7 +1058,7 @@ bool BitFieldPullTransform::PullRecord::operator<(const PullRecord &op2) const
return (readOp->getSeqNum() < op2.readOp->getSeqNum());
}
else if (readOp == (PcodeOp *)0)
- return true;
+ return (op2.readOp != (PcodeOp *)0);
else if (op2.readOp == (PcodeOp *)0)
return false;
return false;
--
2.51.1
@@ -0,0 +1,29 @@
From a44beeb3a2569887c33d2dfd509c0d103bd6c447 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 25 Feb 2026 02:43:17 +0000
Subject: [PATCH 7/7] decompiler: Fix strict weak ordering compareFinalOrder
FlowBlock::compareFinalOrder returns true when both blocks have index 0,
violating strict weak ordering (irreflexivity). This is caught by libc++
debug mode hardening assertions during BlockGraph::orderBlocks sort.
---
Ghidra/Features/Decompiler/src/decompile/cpp/block.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
index bf7103d916..2e495d9c3f 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
@@ -709,7 +709,7 @@ string FlowBlock::typeToName(FlowBlock::block_type bt)
bool FlowBlock::compareFinalOrder(const FlowBlock *bl1,const FlowBlock *bl2)
{
- if (bl1->getIndex() == 0) return true; // Make sure the entry point comes first
+ if (bl1->getIndex() == 0) return (bl2->getIndex() != 0); // Make sure the entry point comes first
if (bl2->getIndex() == 0) return false;
PcodeOp *op1 = bl1->lastOp();
PcodeOp *op2 = bl2->lastOp();
--
2.51.1
+8 -5
View File
@@ -51,7 +51,7 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
# TODO: CMake only likes numeric characters in the version string....
set(ghidra_head_version "12.1")
set(ghidra_version "${ghidra_head_version}")
set(ghidra_head_git_tag "0ee235fba7645738ec34efa563dd5062ca13cd7d")
set(ghidra_head_git_tag "e3c1b6393becbddc4256f3d4b3cd566d3bd95903")
set(ghidra_git_tag "${ghidra_head_git_tag}")
set(ghidra_shallow FALSE)
set(ghidra_patches
@@ -63,6 +63,8 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0003-Ignore-floating-point-test-due-to-compilation-differ.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0004-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0005-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0006-decompiler-Fix-strict-weak-ordering-PullRecord.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0007-decompiler-Fix-strict-weak-ordering-compareFinalOrde.patch"
)
string(SUBSTRING "${ghidra_git_tag}" 0 7 ghidra_short_commit)
else()
@@ -174,10 +176,11 @@ set(sleigh_deccore_source_list
"${library_root}/constseq.cc"
"${library_root}/expression.cc"
)
#if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
# list(APPEND sleigh_deccore_source_list
# )
#endif()
if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
list(APPEND sleigh_deccore_source_list
"${library_root}/bitfield.cc"
)
endif()
set(sleigh_extra_source_list
"${library_root}/callgraph.cc"