Fix aot code failed to run on darwin/android issue (#599)

This commit is contained in:
Wenyong Huang 2021-04-01 23:34:21 -05:00 committed by GitHub
parent 7db2221ad9
commit fe76c89c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1838,7 +1838,7 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end,
} }
/* Set read only for AOT code and some data sections */ /* Set read only for AOT code and some data sections */
map_prot = MMAP_PROT_READ; map_prot = MMAP_PROT_READ | MMAP_PROT_EXEC;
if (module->code) { if (module->code) {
/* The layout is: literal size + literal + code (with plt table) */ /* The layout is: literal size + literal + code (with plt table) */
@ -1848,6 +1848,8 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end,
os_mprotect(mmap_addr, total_size, map_prot); os_mprotect(mmap_addr, total_size, map_prot);
} }
map_prot = MMAP_PROT_READ;
#if defined(BH_PLATFORM_WINDOWS) #if defined(BH_PLATFORM_WINDOWS)
if (module->extra_plt_data) { if (module->extra_plt_data) {
os_mprotect(module->extra_plt_data, module->extra_plt_data_size, os_mprotect(module->extra_plt_data, module->extra_plt_data_size,