Skip to content

Detect riscv64 targets and disable JIT#2684

Open
carlosqwqqwq wants to merge 1 commit into
melonDS-emu:masterfrom
carlosqwqqwq:riscv-melonds
Open

Detect riscv64 targets and disable JIT#2684
carlosqwqqwq wants to merge 1 commit into
melonDS-emu:masterfrom
carlosqwqqwq:riscv-melonds

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

Why

melonDS used host compiler predefined macros for architecture selection, so a simulated or cross-target riscv64 configuration could still inherit the host x86_64 JIT path. This patch makes the riscv64 baseline path explicit and keeps RISC-V on the interpreter-only core build.

What changed

  • Recognize CMAKE_SYSTEM_PROCESSOR=riscv64 explicitly in the top-level CMake architecture selection instead of relying on host compiler predefined macros.
  • Route RISC-V 64-bit targets onto the interpreter-only core build path and keep ENABLE_JIT off by default.
  • Preserve the existing x86_64 and ARM64 JIT paths without changing any JIT backend implementation.
  • Keep this patch conservative: it does not add a RISC-V JIT backend or RISC-V-specific graphics optimizations.

Verification

  • Ran native CMake configuration with Ninja on the local Windows host using BUILD_QT_SDL=OFF, ENABLE_OGLRENDERER=OFF, TEAKRA_BUILD_UNIT_TESTS=OFF, and TEAKRA_BUILD_TOOLS=OFF.
  • Built the native tree successfully with cmake --build build-codex-native-riscvfix --parallel 4.
  • Ran simulated riscv64 CMake configuration with CMAKE_SYSTEM_NAME=Linux, CMAKE_SYSTEM_PROCESSOR=riscv64, CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY, BUILD_QT_SDL=OFF, ENABLE_OGLRENDERER=OFF, TEAKRA_BUILD_UNIT_TESTS=OFF, TEAKRA_BUILD_TOOLS=OFF, and forced __riscv=1 / __riscv_xlen=64 macros because no real RISC-V toolchain is available on the host.
  • Built the simulated riscv64 tree successfully with cmake --build build-codex-riscv-riscvfix --parallel 4.
  • Confirmed the simulated riscv64 configuration prints Detected RISC-V 64-bit target; building interpreter path with JIT disabled.
  • Checked build-codex-riscv-riscvfix/build.ninja and compile_commands.json: they contain ARCHITECTURE_RISCV64=1, __riscv=1, and __riscv_xlen=64.
  • Confirmed build-codex-riscv-riscvfix/build.ninja does not contain ARCHITECTURE_x86_64=1, JIT_ENABLED, ARMJIT_x64, ARMJIT_A64, x64Emitter, Arm64Emitter, GPU_OpenGL, or OGLRENDERER_ENABLED.

Notes

This is a conservative portability patch. It only fixes target architecture selection so that riscv64 no longer inherits the host x86_64 JIT path during configuration. Verification covers native core-only build stability plus simulated RISC-V target selection and backend exclusion checks, but not a real riscv64 cross-toolchain build, frontend dependency build, or hardware run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant