mirror of
https://github.com/radareorg/r2ghidra.git
synced 2026-11-07 06:25:57 -10:00
Fix w64 build (#24)
This commit is contained in:
1 parent
6076841c46
commit
3dd9a97fb1
5 files changed
+94
-60
No files matched your search
@@ -17,6 +17,15 @@ option(GENERATE_PARSERS "Re-generate all parsers with Bison/Flex instead of usin
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
# C++latest needed for designed initializers, but funnily MSVC includes fail to compile with this flag
|
||||
# if (MSVC_VERSION GREATER_EQUAL "1900")
|
||||
# include(CheckCXXCompilerFlag)
|
||||
# CHECK_CXX_COMPILER_FLAG("/std:c++latest" _cpp_latest_flag_supported)
|
||||
# if (_cpp_latest_flag_supported)
|
||||
# add_compile_options("/std:c++latest")
|
||||
# endif()
|
||||
# endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_definitions(-std=c++11)
|
||||
@@ -25,6 +34,10 @@ else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
if (MSVC_VERSION GREATER_EQUAL "1900")
|
||||
add_definitions(-D_WINDOWS)
|
||||
endif()
|
||||
|
||||
add_subdirectory(ghidra)
|
||||
add_subdirectory(third-party)
|
||||
|
||||
|
||||
@@ -222,6 +222,8 @@ add_executable(sleighc ${SLEIGH_COMPILER_SOURCE_CXX})
|
||||
target_link_libraries(sleighc ghidra_decompiler_sleigh ghidra_decompiler_base)
|
||||
target_include_directories(sleighc PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/flex")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-ULoadImage")
|
||||
|
||||
if(BUILD_SLASPECS)
|
||||
file(GLOB_RECURSE SLASPEC_FILES "ghidra/Ghidra/Processors/*.slaspec")
|
||||
file(GLOB_RECURSE CPEC_FILES "ghidra/Ghidra/Processors/*.cspec")
|
||||
|
||||
+1
-1
Submodule ghidra/ghidra updated: 031ac31055...5560ac1711.
+45
-35
@@ -2093,47 +2093,57 @@ static int sanal_fini(void *p)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if __WINDOWS__
|
||||
// this is not really a windows issue, but GCC/CLANG support
|
||||
// designed initializers as a C++ extension and its better
|
||||
// to not blindly fill structs
|
||||
#define KV(x, y) y
|
||||
#else
|
||||
#define KV(x, y) x = y
|
||||
#endif
|
||||
|
||||
static RAnalPlugin r_anal_plugin_ghidra = {
|
||||
.name = "r2ghidra",
|
||||
.desc = "SLEIGH Disassembler from Ghidra",
|
||||
.license = "GPL3",
|
||||
.arch = "sleigh",
|
||||
.author = "FXTi",
|
||||
.version = nullptr,
|
||||
.bits = 0,
|
||||
.esil = true,
|
||||
.fileformat_type = 0,
|
||||
.init = &sanal_init,
|
||||
.fini = &sanal_fini,
|
||||
.archinfo = &archinfo,
|
||||
.anal_mask = nullptr,
|
||||
.preludes = nullptr,
|
||||
.op = &sleigh_op,
|
||||
.cmd_ext = nullptr,
|
||||
.set_reg_profile = nullptr,
|
||||
.get_reg_profile = &get_reg_profile,
|
||||
.fingerprint_bb = nullptr,
|
||||
.fingerprint_fcn = nullptr,
|
||||
.diff_bb = nullptr,
|
||||
.diff_fcn = nullptr,
|
||||
.diff_eval = nullptr,
|
||||
.esil_init = esil_sleigh_init,
|
||||
.esil_post_loop = nullptr,
|
||||
.esil_trap = nullptr,
|
||||
.esil_fini = esil_sleigh_fini,
|
||||
KV(.name, "r2ghidra"),
|
||||
KV(.desc, "SLEIGH Disassembler from Ghidra"),
|
||||
KV(.license, "GPL3"),
|
||||
KV(.arch, "sleigh"),
|
||||
KV(.author, "FXTi"),
|
||||
KV(.version, nullptr),
|
||||
KV(.bits, 0),
|
||||
KV(.esil, true),
|
||||
KV(.fileformat_type, 0),
|
||||
KV(.init, &sanal_init),
|
||||
KV(.fini, &sanal_fini),
|
||||
KV(.archinfo, &archinfo),
|
||||
KV(.anal_mask, nullptr),
|
||||
KV(.preludes, nullptr),
|
||||
KV(.op, &sleigh_op),
|
||||
KV(.cmd_ext, nullptr),
|
||||
KV(.set_reg_profile, nullptr),
|
||||
KV(.get_reg_profile, &get_reg_profile),
|
||||
KV(.fingerprint_bb, nullptr),
|
||||
KV(.fingerprint_fcn, nullptr),
|
||||
KV(.diff_bb, nullptr),
|
||||
KV(.diff_fcn, nullptr),
|
||||
KV(.diff_eval, nullptr),
|
||||
KV(.esil_init, esil_sleigh_init),
|
||||
KV(.esil_post_loop, nullptr),
|
||||
KV(.esil_trap, nullptr),
|
||||
KV(.esil_fini, esil_sleigh_fini),
|
||||
};
|
||||
|
||||
#ifndef CORELIB
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C" {
|
||||
#endif
|
||||
R_API RLibStruct radare_plugin = {
|
||||
/* .type = */ R_LIB_TYPE_ANAL,
|
||||
/* .data = */ &r_anal_plugin_ghidra,
|
||||
/* .version = */ R2_VERSION,
|
||||
/* .free = */ nullptr
|
||||
#if R2_VERSION_MAJOR >= 4 && R2_VERSION_MINOR >= 2
|
||||
, "r2ghidra"
|
||||
#endif
|
||||
KV(.type, R_LIB_TYPE_ANAL),
|
||||
KV(.data, &r_anal_plugin_ghidra),
|
||||
KV(.version, R2_VERSION),
|
||||
KV(.free, nullptr),
|
||||
KV(.pkgname, "r2ghidra")
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+33
-24
@@ -72,24 +72,33 @@ static bool fini(void *p)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if __WINDOWS__
|
||||
// this is not really a windows issue, but GCC/CLANG support
|
||||
// designed initializers as a C++ extension and its better
|
||||
// to not blindly fill structs
|
||||
#define KV(x, y) y
|
||||
#else
|
||||
#define KV(x, y) x = y
|
||||
#endif
|
||||
|
||||
static RAsmPlugin r_asm_plugin_ghidra = {
|
||||
.name = "r2ghidra",
|
||||
.arch = "sleigh",
|
||||
.author = "FXTi",
|
||||
.version = nullptr,
|
||||
.cpus = nullptr,
|
||||
.desc = "SLEIGH Disassembler from Ghidra",
|
||||
.license = "GPL3",
|
||||
.user = nullptr,
|
||||
.bits = 8 | 16 | 32 | 64,
|
||||
.endian = 0,
|
||||
.init = nullptr,
|
||||
.fini = &fini,
|
||||
.disassemble = &disassemble,
|
||||
.assemble = nullptr,
|
||||
.modify = nullptr,
|
||||
.mnemonics = nullptr,
|
||||
.features = nullptr
|
||||
KV(.name, "r2ghidra"),
|
||||
KV(.arch, "sleigh"),
|
||||
KV(.author, "FXTi"),
|
||||
KV(.version, nullptr),
|
||||
KV(.cpus, nullptr),
|
||||
KV(.desc, "SLEIGH Disassembler from Ghidra"),
|
||||
KV(.license, "GPL3"),
|
||||
KV(.user, nullptr),
|
||||
KV(.bits, 8 | 16 | 32 | 64),
|
||||
KV(.endian, 0),
|
||||
KV(.init, nullptr),
|
||||
KV(.fini, &fini),
|
||||
KV(.disassemble, &disassemble),
|
||||
KV(.assemble, nullptr),
|
||||
KV(.modify, nullptr),
|
||||
KV(.mnemonics, nullptr),
|
||||
KV(.features, nullptr)
|
||||
};
|
||||
|
||||
#ifndef CORELIB
|
||||
@@ -97,13 +106,13 @@ static RAsmPlugin r_asm_plugin_ghidra = {
|
||||
extern "C" {
|
||||
#endif
|
||||
R_API RLibStruct radare_plugin = {
|
||||
.type = R_LIB_TYPE_ASM,
|
||||
.data = &r_asm_plugin_ghidra,
|
||||
.version = R2_VERSION,
|
||||
.free = nullptr
|
||||
#if R2_VERSION_MAJOR >= 4 && R2_VERSION_MINOR >= 2
|
||||
, "r2ghidra"
|
||||
#endif
|
||||
KV(.type, R_LIB_TYPE_ASM),
|
||||
KV(.data, &r_asm_plugin_ghidra),
|
||||
KV(.version, R2_VERSION),
|
||||
KV(.free, nullptr),
|
||||
KV(.pkgname, "r2ghidra")
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user