Fix windows builds

This commit is contained in:
Adam Satko authored and GitHub committed 2025-08-01 16:23:04 +02:00
1 parent f28454da13
commit 5a04b1bc0e
18 files changed
+107 -40

No files matched your search

+1 -1
View File
@@ -183,7 +183,6 @@ jobs:
path: dist/macos/r2ghidra-${{ env.R2V }}-macos-${{ env.ARCH }}.zip
w64:
if: ${{ false }} # disable for now
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
@@ -204,6 +203,7 @@ jobs:
python -m wget https://github.com/radareorg/radare2/releases/download/${{env.R2V}}/radare2-${{env.R2V}}-w64.zip -o r2.zip
python3 -m zipfile -e r2.zip .
mv radare2-${{env.R2V}}-w64 radare2
cp -f radare2/include/libr/r_util/r_event.h radare2/include/libr/r_event.h
pwd
- name: batmake
shell: cmd
+6 -6
View File
@@ -13,19 +13,19 @@ pugixml_sources = [
]
r2ghidra_sources = [
'src/ArchMap.cpp',
'src/CodeXMLParse.cpp',
'src/R2Architecture.cpp',
'src/R2CommentDatabase.cpp',
'src/PcodeFixupPreprocessor.cpp',
'src/R2LoadImage.cpp',
'src/R2PrintC.cpp',
'src/R2Scope.cpp',
'src/R2TypeFactory.cpp',
'src/R2CommentDatabase.cpp',
'src/CodeXMLParse.cpp',
'src/ArchMap.cpp',
'src/R2PrintC.cpp',
'src/RCoreMutex.cpp',
'src/SleighAnalValue.cpp',
'src/SleighAsm.cpp',
'src/SleighInstruction.cpp',
'src/PcodeFixupPreprocessor.cpp',
]
incdirs = [
@@ -121,8 +121,8 @@ sleighc_sources = [
r2ghidra_core_plugin = shared_library('core_r2ghidra',
r2ghidra_core_sources,
dependencies: [r_core, zlib],
link_with: libdecomp_static,
dependencies: [r_core, zlib],
override_options : ['c_std=c11', 'cpp_std=c++14'],
include_directories: [ghidra_incs, r2ghidra_incdirs],
install: true,
+4 -3
View File
@@ -1,20 +1,21 @@
/* r2ghidra - LGPL - Copyright 2025 - pancake */
#include "R2LoadImage.h"
#include "PcodeFixupPreprocessor.h"
#include "R2LoadImage.h"
#include <funcdata.hh>
#include <r_core.h>
#include <flow.hh>
#include <override.hh>
#include <database.hh>
#include <r_core.h>
#include <r_anal.h>
#include <r_core.h>
#include <r_bin.h>
#include <map>
#include <string>
#include <vector>
#include <strings.h> // For strcasecmp function
using namespace ghidra;
+1 -1
View File
@@ -1,8 +1,8 @@
/* r2ghidra - LGPL - Copyright 2019-2022 - thestr4ng3r, pancake */
#include "R2Architecture.h"
#include "R2LoadImage.h"
#include "R2Scope.h"
#include "R2Architecture.h"
#include "R2TypeFactory.h"
#include "R2CommentDatabase.h"
#include "R2Utils.h"
+1 -1
View File
@@ -3,8 +3,8 @@
#ifndef R2GHIDRA_R2ARCHITECTURE_H
#define R2GHIDRA_R2ARCHITECTURE_H
#include "architecture.hh"
#include "sleigh_arch.hh"
#include "architecture.hh"
#include "RCoreMutex.h"
+3 -2
View File
@@ -1,8 +1,9 @@
/* r2ghidra - LGPL - Copyright 2019-2022 - pancake, thestr4ng3r */
#include "R2LoadImage.h"
#include "R2Utils.h"
#include "R2Architecture.h"
#include "R2LoadImage.h"
#include "R2Utils.h"
R2LoadImage::R2LoadImage(RCoreMutex *coreMutex, AddrSpaceManager *addr_space_manager) : LoadImage("radare2_program"),
coreMutex(coreMutex),
+3 -3
View File
@@ -3,15 +3,15 @@
#ifndef R2GHIDRA_R2LOADIMAGE_H
#define R2GHIDRA_R2LOADIMAGE_H
#include "loadimage.hh"
#include <r_core.h>
// Windows defines LoadImage to LoadImageA
#include <r_core.h>
#ifdef LoadImage
#undef LoadImage
#endif
#include "loadimage.hh"
using namespace ghidra;
class RCoreMutex;
+3 -2
View File
@@ -1,10 +1,11 @@
/* r2ghidra - LGPL - Copyright 2019-2025 - thestr4ng3r, pancake */
#include <architecture.hh>
#include <varnode.hh>
#include "R2PrintC.h"
#include "RCoreMutex.h"
#include <varnode.hh>
#include <architecture.hh>
using namespace ghidra;
+1 -1
View File
@@ -1,8 +1,8 @@
/* r2ghidra- LGPL - Copyright 2019-2023 - thestr4ng3r, pancake */
#include "R2Scope.h"
#include "R2Architecture.h"
#include "R2TypeFactory.h"
#include "R2Scope.h"
#include <funcdata.hh>
+1 -1
View File
@@ -1,7 +1,7 @@
/* r2ghidra - LGPL - Copyright 2020-2023 - FXTi, pancake */
#include "SleighAsm.h"
#include "ArchMap.h"
#include "SleighAsm.h"
// define it here because sleighc needs to compile without anal_ghidra.cpp
extern "C" {
+7 -4
View File
@@ -3,14 +3,17 @@
#ifndef R2GHIDRA_SLEIGHASM_H
#define R2GHIDRA_SLEIGHASM_H
#include <string>
#include <vector>
#include <r_core.h>
#include <unordered_map>
#include "architecture.hh"
#include "sleigh_arch.hh"
#include "SleighInstruction.h"
#include <r_core.h>
#include <string>
#include <vector>
#include <unordered_map>
class AsmLoadImage : public LoadImage {
private:
RIO *io = nullptr;
+6 -3
View File
@@ -3,12 +3,15 @@
#ifndef R2GHIDRA_SLEIGHINSTRUCTION_H
#define R2GHIDRA_SLEIGHINSTRUCTION_H
#include <vector>
#include <unordered_set>
#include "R2LoadImage.h"
#include "architecture.hh"
#include "sleigh_arch.hh"
#include "crc32.hh"
#include "R2LoadImage.h"
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <list>
+5 -3
View File
@@ -1,14 +1,16 @@
/* r2ghidra - LGPL - Copyright 2020-2025 - pancake, FXTi */
#include "SleighAsm.h"
#include "SleighAnalValue.h"
#include "ArchMap.h"
#include <r_lib.h>
#include <r_anal.h>
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cfenv>
#include "ArchMap.h"
#include "SleighAsm.h"
#include "SleighAnalValue.h"
#if R2_VERSION_NUMBER >= 50709
#define RAnalEsil REsil
+6 -4
View File
@@ -2,11 +2,15 @@
#include "R2Architecture.h"
#include "CodeXMLParse.h"
#include "PcodeFixupPreprocessor.h"
#include "PrettyXmlEncode.h"
#include "ArchMap.h"
#include "R2PrintC.h"
#include "SleighAsm.h"
#include "ArchMap.h"
#include "PcodeFixupPreprocessor.h"
#include "r2ghidra.h"
#include <r_core.h>
// Windows clash
@@ -15,8 +19,6 @@
#endif
#include <libdecomp.hh>
#include <printc.hh>
#include "R2PrintC.h"
#include <vector>
#include <mutex>
+1 -1
View File
@@ -3,5 +3,5 @@ url = https://github.com/radareorg/ghidra-native
revision = d2242691bf45a12e3ea483a4789f825af4651506
directory = ghidra-native
patch_directory = ghidra-native
diff_files = ghidra-native/patches/0001-space-after-comma.patch, ghidra-native/patches/0002-make-sleigharch-public.patch, ghidra-native/patches/0004-public-fields.patch, ghidra-native/patches/0006-readonly-warning.patch, ghidra-native/patches/0010-null-subflow.patch, ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch, ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch, ghidra-native/patches/0024-ignore-symbol-beyond-space.patch, ghidra-native/patches/0044-bad-unicode-codepoint.patch, ghidra-native/patches/0055-datatype-clone.patch, ghidra-native/patches/0056-nullderef-workaround.patch, ghidra-native/patches/0080-getparent-flow.patch, ghidra-native/patches/0090-nocasts-warnings.patch, ghidra-native/patches/0091-decompiler-xml-packer.patch, ghidra-native/patches/0092-badvar-segfault.patch, ghidra-native/patches/0093-no-virtual-destructor.patch
diff_files = ghidra-native/patches/0001-space-after-comma.patch, ghidra-native/patches/0002-make-sleigharch-public.patch, ghidra-native/patches/0004-public-fields.patch, ghidra-native/patches/0006-readonly-warning.patch, ghidra-native/patches/0010-null-subflow.patch, ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch, ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch, ghidra-native/patches/0024-ignore-symbol-beyond-space.patch, ghidra-native/patches/0044-bad-unicode-codepoint.patch, ghidra-native/patches/0055-datatype-clone.patch, ghidra-native/patches/0056-nullderef-workaround.patch, ghidra-native/patches/0080-getparent-flow.patch, ghidra-native/patches/0090-nocasts-warnings.patch, ghidra-native/patches/0091-decompiler-xml-packer.patch, ghidra-native/patches/0092-badvar-segfault.patch, ghidra-native/patches/0093-no-virtual-destructor.patch, ghidra-native/patches/0100-CHAR-windows.patch
depth = 1
@@ -72,7 +72,6 @@ decompiler_sources = [
]
libdecomp_sources = [
'src/decompiler/sleigh_arch.cc',
'src/decompiler/libdecomp.cc',
]
@@ -91,6 +90,7 @@ ghidra_sources = [
slgh_sources = [
'src/decompiler/sleigh.cc',
'src/decompiler/sleigh_arch.cc',
'src/decompiler/inject_sleigh.cc',
'src/decompiler/pcodecompile.cc',
'src/decompiler/sleighbase.cc',
@@ -1,5 +1,5 @@
diff --git a/src/decompiler/loadimage.hh b/src/decompiler/loadimage.hh
index 59d4c9a..3557744 100644
index 76dce9b..2df840a 100644
--- a/src/decompiler/loadimage.hh
+++ b/src/decompiler/loadimage.hh
@@ -21,6 +21,10 @@
@@ -10,6 +10,21 @@ index 59d4c9a..3557744 100644
+#undef LoadImage
+#endif
+
namespace ghidra {
/// \brief Exception indicating data was not available
///
/// This exception is thrown when a request for load image
diff --git a/src/decompiler/sleigh.hh b/src/decompiler/sleigh.hh
index 32ef856..f0a7461 100644
--- a/src/decompiler/sleigh.hh
+++ b/src/decompiler/sleigh.hh
@@ -21,6 +21,10 @@
#include "sleighbase.hh"
+#ifdef LoadImage
+#undef LoadImage
+#endif
+
namespace ghidra {
class LoadImage;
@@ -0,0 +1,39 @@
diff --git a/src/decompiler/slghparse.cc b/src/decompiler/slghparse.cc
index ec1f76a..01abe32 100644
--- a/src/decompiler/slghparse.cc
+++ b/src/decompiler/slghparse.cc
@@ -246,7 +246,7 @@ extern int sleighdebug;
ELLIPSIS_KEY = 344,
GLOBALSET_KEY = 345,
BITRANGE_KEY = 346,
- CHAR = 347,
+ CHARVALUE = 347,
INTEGER = 348,
INTB = 349,
STRING = 350,
diff --git a/src/decompiler/slghparse.hh b/src/decompiler/slghparse.hh
index 3d615cc..065e1e9 100644
--- a/src/decompiler/slghparse.hh
+++ b/src/decompiler/slghparse.hh
@@ -161,7 +161,7 @@ extern int sleighdebug;
ELLIPSIS_KEY = 344,
GLOBALSET_KEY = 345,
BITRANGE_KEY = 346,
- CHAR = 347,
+ CHARVALUE = 347,
INTEGER = 348,
INTB = 349,
STRING = 350,
diff --git a/src/decompiler/slghscan.cc b/src/decompiler/slghscan.cc
index 82f7e82..4e21247 100644
--- a/src/decompiler/slghscan.cc
+++ b/src/decompiler/slghscan.cc
@@ -2138,7 +2138,7 @@ YY_RULE_SETUP
YY_BREAK
case 61:
YY_RULE_SETUP
-{ sleighlval.ch = sleightext[0]; return CHAR; }
+{ sleighlval.ch = sleightext[0]; return CHARVALUE; }
YY_BREAK
case 62:
YY_RULE_SETUP