From 9083334f69459b8245cc58378d451660b8bdabf6 Mon Sep 17 00:00:00 2001 From: dongsheng28849455 <68947925+dongsheng28849455@users.noreply.github.com> Date: Tue, 13 Dec 2022 12:45:26 +0800 Subject: [PATCH] Fix XIP issue of handling 64-bit const in 32-bit target (#1803) - Handle i64 const like f64 const - Ensure i64/f64 const is stored on 8-byte aligned address --- core/iwasm/compilation/aot_llvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/iwasm/compilation/aot_llvm.c b/core/iwasm/compilation/aot_llvm.c index b6e8b116..889ab259 100644 --- a/core/iwasm/compilation/aot_llvm.c +++ b/core/iwasm/compilation/aot_llvm.c @@ -2229,11 +2229,11 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol) if (idx < 0) { if (comp_ctx->pointer_size == sizeof(uint32) - && !strncmp(symbol, "f64#", 4)) { + && (!strncmp(symbol, "f64#", 4) || !strncmp(symbol, "i64#", 4))) { idx = bh_list_length(&comp_ctx->native_symbols); /* Add 4 bytes padding on 32-bit target to make sure that the f64 const is stored on 8-byte aligned address */ - if ((idx & 1) && !strncmp(comp_ctx->target_arch, "i386", 4)) { + if (idx & 1) { if (!insert_native_symbol(comp_ctx, "__ignore", idx)) { return -1; } @@ -2246,7 +2246,7 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol) } if (comp_ctx->pointer_size == sizeof(uint32) - && !strncmp(symbol, "f64#", 4)) { + && (!strncmp(symbol, "f64#", 4) || !strncmp(symbol, "i64#", 4))) { /* f64 const occupies 2 pointer slots on 32-bit target */ if (!insert_native_symbol(comp_ctx, "__ignore", idx + 1)) { return -1;