aot: Avoid possible relocations around "stack_sizes" for XIP mode (#2322)

Fixes https://github.com/bytecodealliance/wasm-micro-runtime/issues/2316

Lightly tested on riscv64 qemu.
This commit is contained in:
YAMAMOTO Takashi
2023-06-29 19:45:33 +09:00
committed by GitHub
parent 5c13bbbde7
commit 03418ef5ac
4 changed files with 57 additions and 1 deletions

View File

@ -42,6 +42,8 @@ bh_static_assert(offsetof(AOTModuleInstance, cur_exception)
bh_static_assert(offsetof(AOTModuleInstance, global_table_data)
== 13 * sizeof(uint64) + 128 + 11 * sizeof(uint64));
bh_static_assert(offsetof(AOTModuleInstanceExtra, stack_sizes) == 0);
static void
set_error_buf(char *error_buf, uint32 error_buf_size, const char *string)
{
@ -1210,6 +1212,9 @@ aot_instantiate(AOTModule *module, bool is_sub_inst, WASMExecEnv *exec_env_main,
#endif
module_inst->default_wasm_stack_size = stack_size;
((AOTModuleInstanceExtra *)module_inst->e)->stack_sizes =
aot_get_data_section_addr(module, AOT_STACK_SIZES_SECTION_NAME, NULL);
#if WASM_ENABLE_PERF_PROFILING != 0
total_size = (uint64)sizeof(AOTFuncPerfProfInfo)
* (module->import_func_count + module->func_count);