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
This commit is contained in:
dongsheng28849455 2022-12-13 12:45:26 +08:00 committed by GitHub
parent d827315122
commit 9083334f69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;