librz/arch: fix m68k CPU32 detection with Capstone v6 (#6314)
Co-authored-by agent: Codex/GPT-5
This commit is contained in:
parent
00b8496bf0
commit
d4ff5b7f95
3 changed files with 22 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#define M68K_LONGEST_INSTRUCTION 22
|
||||
|
||||
#if CS_NEXT_VERSION >= 7
|
||||
#ifdef RZ_CAPSTONE_HAS_M68K_CPU32
|
||||
#define M68K_CPUS "68000,68010,68020,68030,68040,68060,cpu32"
|
||||
#else
|
||||
#define M68K_CPUS "68000,68010,68020,68030,68040,68060"
|
||||
|
|
@ -19,7 +19,7 @@ static inline cs_mode rz_m68k_cs_mode(const char *cpu) {
|
|||
if (!cpu) {
|
||||
return CS_MODE_M68K_040;
|
||||
}
|
||||
#if CS_NEXT_VERSION >= 7
|
||||
#ifdef RZ_CAPSTONE_HAS_M68K_CPU32
|
||||
if (strstr(cpu, "cpu32") || strstr(cpu, "CPU32")) {
|
||||
return CS_MODE_M68K_CPU32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ static char **m68k_cpu_descriptions() {
|
|||
"68030", "Motorola 68030: Enhanced 32-bit microprocessor with integrated MMU",
|
||||
"68040", "Motorola 68040: High-performance 32-bit microprocessor with integrated FPU",
|
||||
"68060", "Motorola 68060: 32-bit microprocessor, highest performer in m68k series",
|
||||
#if CS_NEXT_VERSION >= 7
|
||||
#ifdef RZ_CAPSTONE_HAS_M68K_CPU32
|
||||
"cpu32", "Motorola CPU32: 32-bit embedded-controller CPU core based on the 68020",
|
||||
#endif
|
||||
NULL
|
||||
|
|
|
|||
19
meson.build
19
meson.build
|
|
@ -191,6 +191,8 @@ cmake_package_relative_path = run_command(py3_exe, cmake_package_prefix_dir_py,
|
|||
subproject_clean_error_msg = 'Subprojects are not updated. Please run `git clean -dxff subprojects/` to delete all local subprojects directories. If you want to compile against current subprojects then set option `subprojects_check=false`.'
|
||||
|
||||
# handle capstone dependency
|
||||
capstone_check_deps = []
|
||||
capstone_check_includes = []
|
||||
capstone_dep = dependency('capstone', version: '>=4.0.2', required: get_option('use_sys_capstone'), static: is_static_build)
|
||||
if not capstone_dep.found()
|
||||
capstone_version = get_option('use_capstone_version')
|
||||
|
|
@ -204,13 +206,30 @@ if not capstone_dep.found()
|
|||
error('Wrong capstone version selected. Please use one of the supported versions.')
|
||||
endif
|
||||
capstone_dep = capstone_proj.get_variable('capstone_dep')
|
||||
capstone_check_includes = capstone_proj.get_variable('capstone_includes')
|
||||
else
|
||||
capstone_check_deps = [capstone_dep]
|
||||
# Package managers CS version has no meta programming macros for AArch64 -> ARM64 renaming
|
||||
# (because it is outdated).
|
||||
# With this define we includeour copy of those macros.
|
||||
add_project_arguments(['-DUSE_SYS_CAPSTONE'], language: 'c')
|
||||
endif
|
||||
|
||||
has_capstone_m68k_cpu32 = cc.compiles('''
|
||||
#include <capstone/capstone.h>
|
||||
int main(void) {
|
||||
cs_mode mode = CS_MODE_M68K_CPU32;
|
||||
return mode == 0;
|
||||
}
|
||||
''',
|
||||
dependencies: capstone_check_deps,
|
||||
include_directories: capstone_check_includes,
|
||||
name: 'Capstone has M68K CPU32 mode'
|
||||
)
|
||||
if has_capstone_m68k_cpu32
|
||||
add_project_arguments(['-DRZ_CAPSTONE_HAS_M68K_CPU32'], language: 'c')
|
||||
endif
|
||||
|
||||
# Handle PCRE2
|
||||
cpu_jit_supported = [ 'aarch64', 'arm', 'mips', 'mips64', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'x86', 'x86_64' ]
|
||||
pcre2_jit_supported = target_machine.cpu_family() in cpu_jit_supported and cc.get_id() != 'tcc' and target_machine.system() not in ['darwin', 'serenity']
|
||||
|
|
|
|||
Loading…
Reference in a new issue