Skip to content

Commit 9083334

Browse files
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
1 parent d827315 commit 9083334

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/iwasm/compilation/aot_llvm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,11 +2229,11 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol)
22292229

22302230
if (idx < 0) {
22312231
if (comp_ctx->pointer_size == sizeof(uint32)
2232-
&& !strncmp(symbol, "f64#", 4)) {
2232+
&& (!strncmp(symbol, "f64#", 4) || !strncmp(symbol, "i64#", 4))) {
22332233
idx = bh_list_length(&comp_ctx->native_symbols);
22342234
/* Add 4 bytes padding on 32-bit target to make sure that
22352235
the f64 const is stored on 8-byte aligned address */
2236-
if ((idx & 1) && !strncmp(comp_ctx->target_arch, "i386", 4)) {
2236+
if (idx & 1) {
22372237
if (!insert_native_symbol(comp_ctx, "__ignore", idx)) {
22382238
return -1;
22392239
}
@@ -2246,7 +2246,7 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol)
22462246
}
22472247

22482248
if (comp_ctx->pointer_size == sizeof(uint32)
2249-
&& !strncmp(symbol, "f64#", 4)) {
2249+
&& (!strncmp(symbol, "f64#", 4) || !strncmp(symbol, "i64#", 4))) {
22502250
/* f64 const occupies 2 pointer slots on 32-bit target */
22512251
if (!insert_native_symbol(comp_ctx, "__ignore", idx + 1)) {
22522252
return -1;

0 commit comments

Comments
 (0)