Enable emitting custom name section to aot file (#794)

Enable emitting custom name section to aot file when adding
`--enable-dump-call-stack` or `--enable-dump-call-stack` to
wamrc and there is custom name section in wasm file, which
can be generated by wasi-sdk/emcc "-g" option. So aot runtime
can also get the function name from the custom name section
instead of export section,  to which developer should use
`--export-all` for wasi-sdk/emcc to generate export function
names.
This commit is contained in:
Javan
2021-10-26 16:32:52 +08:00
committed by GitHub
parent 1a987ae59b
commit 788e14ed6c
13 changed files with 519 additions and 18 deletions

View File

@ -515,6 +515,12 @@ aot_create_comp_data(WASMModule *module)
if (comp_data->func_count && !(comp_data->funcs = aot_create_funcs(module)))
goto fail;
#if WASM_ENABLE_CUSTOM_NAME_SECTION != 0
/* Create custom name section */
comp_data->name_section_buf = module->name_section_buf;
comp_data->name_section_buf_end = module->name_section_buf_end;
#endif
/* Create aux data/heap/stack information */
comp_data->aux_data_end_global_index = module->aux_data_end_global_index;
comp_data->aux_data_end = module->aux_data_end;
@ -581,5 +587,8 @@ aot_destroy_comp_data(AOTCompData *comp_data)
if (comp_data->funcs)
aot_destroy_funcs(comp_data->funcs, comp_data->func_count);
if (comp_data->aot_name_section_buf)
wasm_runtime_free(comp_data->aot_name_section_buf);
wasm_runtime_free(comp_data);
}