From 014530d317d1f27982ab99dfc3bc5d5fef3202d0 Mon Sep 17 00:00:00 2001 From: pgoodman <43664+pgoodman@users.noreply.github.com> Date: Mon, 25 Nov 2024 00:24:12 +0000 Subject: [PATCH 1/3] Bump Ghidra HEAD commit 2333ab611 Changed files: ``` M Ghidra/Features/Decompiler/src/decompile/cpp/constseq.cc M Ghidra/Features/Decompiler/src/decompile/cpp/constseq.hh M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/grammar.cc 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/marshal.hh M Ghidra/Features/Decompiler/src/decompile/cpp/modelrules.cc M Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.hh M Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc M Ghidra/Features/Decompiler/src/decompile/cpp/subflow.hh M Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.hh 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 M Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc M Ghidra/Features/Decompiler/src/decompile/cpp/variable.hh A Ghidra/Features/Decompiler/src/decompile/datatests/enum.xml M Ghidra/Features/Decompiler/src/decompile/datatests/heapstring.xml M Ghidra/Features/Decompiler/src/decompile/unittests/testtypes.cc M Ghidra/Processors/AARCH64/data/languages/AARCH64.opinion M Ghidra/Processors/TI_MSP430/data/languages/TI_MSP430.cspec ``` --- src/setup-ghidra-source.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-ghidra-source.cmake b/src/setup-ghidra-source.cmake index ae5e160..77cd320 100644 --- a/src/setup-ghidra-source.cmake +++ b/src/setup-ghidra-source.cmake @@ -52,7 +52,7 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD") # TODO: CMake only likes numeric characters in the version string.... set(ghidra_head_version "11.3") set(ghidra_version "${ghidra_head_version}") - set(ghidra_head_git_tag "30ef757d81c88c5fc413d9136127cfeb4c6fbf81") + set(ghidra_head_git_tag "2333ab6111a5fac503960bfddb069d6009ba21ad") set(ghidra_git_tag "${ghidra_head_git_tag}") set(ghidra_shallow FALSE) set(ghidra_patches From 35fbbf873ee8742cf8b58a3dad6d7ed5012f94cf Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Tue, 26 Nov 2024 18:01:19 -0500 Subject: [PATCH 2/3] Rework and regenerate patches Only modified ruleaction.cc in 0001-Fix-UBSAN-errors-in-decompiler.patch --- .../0001-Fix-UBSAN-errors-in-decompiler.patch | 31 ++++++------------- ...ead-of-stroul-to-parse-address-offse.patch | 4 +-- ...se-string-resize-instead-of-reserve.patch} | 4 +-- ...oint-test-due-to-compilation-differ.patch} | 4 +-- ...-negative-NAN-in-decompiler-floatin.patch} | 4 +-- src/setup-ghidra-source.cmake | 6 ++-- 6 files changed, 20 insertions(+), 33 deletions(-) rename src/patches/HEAD/{0004-Use-string-resize-instead-of-reserve.patch => 0003-Use-string-resize-instead-of-reserve.patch} (91%) rename src/patches/HEAD/{0005-Ignore-floating-point-test-due-to-compilation-differ.patch => 0004-Ignore-floating-point-test-due-to-compilation-differ.patch} (90%) rename src/patches/HEAD/{0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch => 0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch} (93%) diff --git a/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch b/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch index 3fa6611..c5e6dc1 100644 --- a/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch +++ b/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch @@ -1,7 +1,7 @@ -From 76289be82722d1a076bb9718507ce57748b40543 Mon Sep 17 00:00:00 2001 +From 5b07c4118a9c6fe8f9d240419aaf5b8ce49becdf Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Mon, 12 Aug 2024 12:02:35 -0400 -Subject: [PATCH 1/6] Fix UBSAN errors in decompiler +Subject: [PATCH 1/5] Fix UBSAN errors in decompiler Co-authored-by: Alex Cameron --- @@ -9,13 +9,13 @@ Co-authored-by: Alex Cameron .../Decompiler/src/decompile/cpp/op.cc | 6 +++++- .../Decompiler/src/decompile/cpp/opbehavior.cc | 8 +++++++- .../src/decompile/cpp/pcodecompile.cc | 18 +++++++++++------- - .../Decompiler/src/decompile/cpp/ruleaction.cc | 18 ++++++++++++++---- + .../Decompiler/src/decompile/cpp/ruleaction.cc | 12 +++++++++--- .../Decompiler/src/decompile/cpp/semantics.cc | 2 ++ .../Decompiler/src/decompile/cpp/semantics.hh | 2 +- .../src/decompile/cpp/slgh_compile.cc | 2 +- .../Decompiler/src/decompile/cpp/type.cc | 2 +- .../src/decompile/unittests/testfloatemu.cc | 2 +- - 10 files changed, 49 insertions(+), 19 deletions(-) + 10 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc index d78b78731c..caf4b24d15 100644 @@ -116,10 +116,10 @@ index ca9d71ab99..85d4dd281d 100644 return res; } diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc -index bfca3d6ee5..5819bcd732 100644 +index 009570af71..72b2a10503 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc -@@ -977,7 +977,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data) +@@ -976,7 +976,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data) Varnode *outvn = op->getOut(); if (outvn->isPrecisLo()||outvn->isPrecisHi()) return 0; // Don't pull apart double precision object @@ -133,7 +133,7 @@ index bfca3d6ee5..5819bcd732 100644 consume = ~consume; if ((consume & indir->getIn(0)->getConsume())!=0) return 0; -@@ -7028,8 +7033,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data) +@@ -7031,8 +7036,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data) Varnode *sb = op->getIn(0); Datatype *sbType = sb->getTypeReadFacing(op); if (sbType->getMetatype() != TYPE_PTR) return 0; @@ -145,19 +145,6 @@ index bfca3d6ee5..5819bcd732 100644 Varnode *vn1 = op->getIn(1); if (!vn1->isConstant()) return 0; Varnode *outvn = op->getOut(); -@@ -8833,7 +8839,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data) - Varnode *outvn = op->getOut(); - int4 flowsize = outvn->getSize(); - uintb mask = calc_mask( flowsize ); -- mask <<= 8*((int4)op->getIn(1)->getOffset()); -+ if (8*((int4)op->getIn(1)->getOffset()) < sizeof(mask)) { -+ mask <<= 8*((int4)op->getIn(1)->getOffset()); -+ } else { -+ mask = 0; -+ } - bool aggressive = outvn->isPtrFlow(); - if (!aggressive) { - if ((vn->getConsume() & mask) != vn->getConsume()) return 0; diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc index cd9b9835b1..8a4616c3b9 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc @@ -206,10 +193,10 @@ index 50d85e22ba..9f3b456229 100644 msg << " Label <" << sym->getName() << "> was placed but not used" << endl; else if (!sym->isPlaced()) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc -index 59dcc55949..5944db5905 100644 +index fd0ab26fb4..7f654c220b 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc -@@ -3658,8 +3658,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub) +@@ -3728,8 +3728,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub) top.submeta = sub; // Search on the incorrect submeta iter = tree.lower_bound(&top); while(iter != tree.end()) { diff --git a/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch b/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch index 77ff2df..afa6358 100644 --- a/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch +++ b/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch @@ -1,7 +1,7 @@ -From 2e4706231191395dac90b764ce29c55de29ca2ce Mon Sep 17 00:00:00 2001 +From 4da4a99471f73c3962b8c9d89d9a593896366a58 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Wed, 3 Aug 2022 20:01:18 +1000 -Subject: [PATCH 2/6] Use `stroull` instead of `stroul` to parse address +Subject: [PATCH 2/5] Use `stroull` instead of `stroul` to parse address offsets --- diff --git a/src/patches/HEAD/0004-Use-string-resize-instead-of-reserve.patch b/src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch similarity index 91% rename from src/patches/HEAD/0004-Use-string-resize-instead-of-reserve.patch rename to src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch index 847de00..bbc3023 100644 --- a/src/patches/HEAD/0004-Use-string-resize-instead-of-reserve.patch +++ b/src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch @@ -1,7 +1,7 @@ -From d7f7be313580a6e0eef101848a3c86e3a3db4029 Mon Sep 17 00:00:00 2001 +From d2b0eaec8477ddaf7a1a971e45a6ebf8dceb57da Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Tue, 29 Oct 2024 15:30:57 -0400 -Subject: [PATCH 4/6] Use string resize instead of reserve +Subject: [PATCH 3/5] Use string resize instead of reserve assign will fix up the size to hold all of what's copied --- diff --git a/src/patches/HEAD/0005-Ignore-floating-point-test-due-to-compilation-differ.patch b/src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch similarity index 90% rename from src/patches/HEAD/0005-Ignore-floating-point-test-due-to-compilation-differ.patch rename to src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch index 26f85fb..eac1e92 100644 --- a/src/patches/HEAD/0005-Ignore-floating-point-test-due-to-compilation-differ.patch +++ b/src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch @@ -1,7 +1,7 @@ -From a76b69021f34973973487362cb5f25f7644880b8 Mon Sep 17 00:00:00 2001 +From fc506c1da2adc3fb249d7721f3c4a16c3c319056 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Tue, 29 Oct 2024 17:51:09 -0400 -Subject: [PATCH 5/6] Ignore floating point test due to compilation differences +Subject: [PATCH 4/5] 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. diff --git a/src/patches/HEAD/0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch b/src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch similarity index 93% rename from src/patches/HEAD/0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch rename to src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch index 69ed14c..e02f1d7 100644 --- a/src/patches/HEAD/0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch +++ b/src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch @@ -1,7 +1,7 @@ -From ce0148e9dd6d4a9ba92ee44fb50be1f01b7a8858 Mon Sep 17 00:00:00 2001 +From 59254803a80df713860817b05fdc4c4487dd984f Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Wed, 30 Oct 2024 14:26:57 -0400 -Subject: [PATCH 6/6] Allow positive or negative NAN in decompiler floating +Subject: [PATCH 5/5] Allow positive or negative NAN in decompiler floating point test At least on Apple Silicon, this test reports positive NAN. diff --git a/src/setup-ghidra-source.cmake b/src/setup-ghidra-source.cmake index 77cd320..2669283 100644 --- a/src/setup-ghidra-source.cmake +++ b/src/setup-ghidra-source.cmake @@ -61,9 +61,9 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD") "${GIT_EXECUTABLE}" am --ignore-space-change --ignore-whitespace --no-gpg-sign "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch" "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch" - "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0004-Use-string-resize-instead-of-reserve.patch" - "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0005-Ignore-floating-point-test-due-to-compilation-differ.patch" - "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch" + "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch" + "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch" + "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch" ) string(SUBSTRING "${ghidra_git_tag}" 0 7 ghidra_short_commit) else() From ac55146b2c02054bce0cbf334d3e418aa1d7f3bf Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Sat, 8 Feb 2025 18:04:46 -0500 Subject: [PATCH 3/3] Fix Windows Debug build with patch for strict weak ordering --- .../0001-Fix-UBSAN-errors-in-decompiler.patch | 6 ++--- ...ead-of-stroul-to-parse-address-offse.patch | 6 ++--- ...Use-string-resize-instead-of-reserve.patch | 6 ++--- ...point-test-due-to-compilation-differ.patch | 6 ++--- ...r-negative-NAN-in-decompiler-floatin.patch | 6 ++--- ...strict-weak-ordering-TypePartialEnum.patch | 26 +++++++++++++++++++ src/setup-ghidra-source.cmake | 1 + 7 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 src/patches/HEAD/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch diff --git a/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch b/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch index c5e6dc1..a21024c 100644 --- a/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch +++ b/src/patches/HEAD/0001-Fix-UBSAN-errors-in-decompiler.patch @@ -1,7 +1,7 @@ -From 5b07c4118a9c6fe8f9d240419aaf5b8ce49becdf Mon Sep 17 00:00:00 2001 +From 7c6e51dd1234387b98e1ad61d3f88a0565364b28 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Mon, 12 Aug 2024 12:02:35 -0400 -Subject: [PATCH 1/5] Fix UBSAN errors in decompiler +Subject: [PATCH 1/6] Fix UBSAN errors in decompiler Co-authored-by: Alex Cameron --- @@ -220,5 +220,5 @@ index 2571f55f1a..fe40e22b1b 100644 uintb true_result = ((uintb)(int32_t)f) & 0xffffffff; uintb encoding = format.getEncoding(f); -- -2.47.0 +2.48.1 diff --git a/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch b/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch index afa6358..563f3f4 100644 --- a/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch +++ b/src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch @@ -1,7 +1,7 @@ -From 4da4a99471f73c3962b8c9d89d9a593896366a58 Mon Sep 17 00:00:00 2001 +From 5e37c51ebc8a3ae0f32a3cb0049aaebafec48d7d Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Wed, 3 Aug 2022 20:01:18 +1000 -Subject: [PATCH 2/5] Use `stroull` instead of `stroul` to parse address +Subject: [PATCH 2/6] 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.47.0 +2.48.1 diff --git a/src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch b/src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch index bbc3023..d90690d 100644 --- a/src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch +++ b/src/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch @@ -1,7 +1,7 @@ -From d2b0eaec8477ddaf7a1a971e45a6ebf8dceb57da Mon Sep 17 00:00:00 2001 +From 0feb881ef1cbc9aa4639e16914b7d9ed863baadf Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Tue, 29 Oct 2024 15:30:57 -0400 -Subject: [PATCH 3/5] Use string resize instead of reserve +Subject: [PATCH 3/6] Use string resize instead of reserve assign will fix up the size to hold all of what's copied --- @@ -32,5 +32,5 @@ index 5f5fa0c7b3..4cd77156f2 100644 } data.isTruncated = (numChars >= maximumChars); -- -2.47.0 +2.48.1 diff --git a/src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch b/src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch index eac1e92..f4bcbf2 100644 --- a/src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch +++ b/src/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch @@ -1,7 +1,7 @@ -From fc506c1da2adc3fb249d7721f3c4a16c3c319056 Mon Sep 17 00:00:00 2001 +From 2a8f30f31c24ecc7bd499648b97bb8b0c2705b78 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Tue, 29 Oct 2024 17:51:09 -0400 -Subject: [PATCH 4/5] Ignore floating point test due to compilation differences +Subject: [PATCH 4/6] 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.47.0 +2.48.1 diff --git a/src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch b/src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch index e02f1d7..58785b7 100644 --- a/src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch +++ b/src/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch @@ -1,7 +1,7 @@ -From 59254803a80df713860817b05fdc4c4487dd984f Mon Sep 17 00:00:00 2001 +From 04cca72897d9088713a6e2dadb2774ad20ae7703 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Wed, 30 Oct 2024 14:26:57 -0400 -Subject: [PATCH 5/5] Allow positive or negative NAN in decompiler floating +Subject: [PATCH 5/6] 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 double7 = 3.1415926535897933e-06; -- -2.47.0 +2.48.1 diff --git a/src/patches/HEAD/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch b/src/patches/HEAD/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch new file mode 100644 index 0000000..db58055 --- /dev/null +++ b/src/patches/HEAD/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch @@ -0,0 +1,26 @@ +From a7dee0fbb1838e4e22a1c970718b84976ffb2932 Mon Sep 17 00:00:00 2001 +From: Eric Kilmer +Date: Sat, 8 Feb 2025 17:59:57 -0500 +Subject: [PATCH 6/6] decompiler: Fix strict weak ordering TypePartialEnum + +This fixes Windows Debug error encountered in testing where it was +complaining about lack of strict weak ordering. +--- + Ghidra/Features/Decompiler/src/decompile/cpp/type.cc | 1 + + 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 7f654c220b..3f10c78c2f 100644 +--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc ++++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc +@@ -2300,6 +2300,7 @@ int4 TypePartialEnum::compareDependency(const Datatype &op) const + + { + if (submeta != op.getSubMeta()) return (submeta < op.getSubMeta()) ? -1 : 1; ++ if (parent == &op) return 1; // op is our TypeEnum + TypePartialEnum *tp = (TypePartialEnum *) &op; // Both must be partial + if (parent != tp->parent) return (parent < tp->parent) ? -1 : 1; // Compare absolute pointers + if (offset != tp->offset) return (offset < tp->offset) ? -1 : 1; +-- +2.48.1 + diff --git a/src/setup-ghidra-source.cmake b/src/setup-ghidra-source.cmake index 2669283..1f9030f 100644 --- a/src/setup-ghidra-source.cmake +++ b/src/setup-ghidra-source.cmake @@ -64,6 +64,7 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD") "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0003-Use-string-resize-instead-of-reserve.patch" "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0004-Ignore-floating-point-test-due-to-compilation-differ.patch" "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0005-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch" + "${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0006-decompiler-Fix-strict-weak-ordering-TypePartialEnum.patch" ) string(SUBSTRING "${ghidra_git_tag}" 0 7 ghidra_short_commit) else()