LATX, fix: Keep optimization configurations buildable - #339
Merged
LaurenIsACoder merged 7 commits intoJul 28, 2026
Merged
Conversation
Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
CONFIG_LATX_JRRA_STACK depends on the JRRA TranslationBlock fields. LOW_MEM_MODE_0 disabled CONFIG_LATX_JRRA alone, leaving O2 and O3 builds to compile JRRA stack users without those fields. Disable JRRA stack together with JRRA in low memory mode. Test: O2 + LOW_MEM_0 aot_link_seg object build (RED before, GREEN after). Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
O0 disables CONFIG_LATX_XCOMISX_OPT, so tr_generate_exit_tb has no func or stub parameters. The common exit path still passed those names to set_jmp_reset_offset and failed to compile. Pass NULL placeholders when XCOMISX optimization is disabled while preserving the common jump-reset offset generation. Test: O0 + LOW_MEM_0 translate object build (RED before, GREEN after). Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
O0 and low-memory configurations can compile out CONFIG_LATX_AOT while the runtime option_aot variable remains available. The SMC reload and pread paths therefore retained references to AOT-only implementations and failed to link. Compile those call sites only when AOT support is present. Test: O0 + LOW_MEM_0 latx-x86_64 link (RED before, GREEN after). Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
O3 enables CONFIG_LATX_SYSCALL_TUNNEL, whose translation path still used removed address helper names and passed an IR2 operand to la_syscall after its interface changed to an integer immediate. Use the current 64-bit add, address-sized store, and syscall emitter interfaces. Test: O3 + LOW_MEM_0 tr-misc object build (RED before, GREEN after). Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
The O3 syscall tunnel indexed its optimization table directly with the guest EAX value. Valid i386 syscall numbers above the 387-entry table, as well as arbitrary values, could read past the array and select the wrong path. Expose the table count, branch out-of-range translated syscalls to the traditional path, and make the C lookup reject invalid indices too. Test: source-level RED showed no bounds branch; O3 configuration build verifies the emitted guard compiles. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
last_executed_tb stores a host TranslationBlock pointer in a 64-bit virtual-register slot. Using the guest address-sized store would truncate the pointer for a 32-bit guest. Store the pointer explicitly with la_st_d, matching the slot and host pointer width. Test: source review RED identified address-sized truncation; O3 configuration build verifies the corrected emitter. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
LaurenIsACoder
force-pushed
the
lauren/latx-config-build-guards
branch
from
July 24, 2026 00:27
bdb494e to
695ab19
Compare
LaurenIsACoder
marked this pull request as ready for review
July 28, 2026 01:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Review findings fixed
Validation
Rebased without conflicts on
master@c8cae544266.Mac:
LoongArch host
l1, persistent checkout and build directory:latx-i386link: PASSninja latx-x86_64 -j8: PASSninja -j8: PASS--enable-testsbuild: PASSmeson test --no-rebuild --print-errorlogs: 4/4 PASS