mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-11 09:25:20 +00:00
Fix a wrong alignment assumption when emitting aot file (#792)
The size used to apply "size = align_uint(size, 4)" may be different when calculating total size (in get_object_data_sections_size) and emitting actual data (in aot_emit_object_data_section_info) for the object data section. This patch fixes the "Error: emit object data section info failed".
This commit is contained in:
parent
808ad2e4f1
commit
68d72c300f
|
@ -423,17 +423,6 @@ get_import_func_info_size(AOTCompData *comp_data)
|
|||
comp_data->import_func_count);
|
||||
}
|
||||
|
||||
static uint32
|
||||
get_object_data_section_size(AOTObjectDataSection *data_section)
|
||||
{
|
||||
/* name + size + data */
|
||||
uint32 size = get_string_size(data_section->name);
|
||||
size = align_uint(size, 4);
|
||||
size += (uint32)sizeof(uint32);
|
||||
size += data_section->size;
|
||||
return size;
|
||||
}
|
||||
|
||||
static uint32
|
||||
get_object_data_sections_size(AOTObjectDataSection *data_sections,
|
||||
uint32 data_sections_count)
|
||||
|
@ -442,8 +431,12 @@ get_object_data_sections_size(AOTObjectDataSection *data_sections,
|
|||
uint32 size = 0, i;
|
||||
|
||||
for (i = 0; i < data_sections_count; i++, data_section++) {
|
||||
/* name + size + data */
|
||||
size = align_uint(size, 2);
|
||||
size += get_object_data_section_size(data_section);
|
||||
size += get_string_size(data_section->name);
|
||||
size = align_uint(size, 4);
|
||||
size += (uint32)sizeof(uint32);
|
||||
size += data_section->size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user