From fe76c89c258a00b12164ce0a3753f77a3329f222 Mon Sep 17 00:00:00 2001 From: Wenyong Huang Date: Thu, 1 Apr 2021 23:34:21 -0500 Subject: [PATCH] Fix aot code failed to run on darwin/android issue (#599) --- core/iwasm/aot/aot_loader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index 40d497369..5c4b7e1ac 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -1838,7 +1838,7 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end, } /* 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) { /* 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); } + map_prot = MMAP_PROT_READ; + #if defined(BH_PLATFORM_WINDOWS) if (module->extra_plt_data) { os_mprotect(module->extra_plt_data, module->extra_plt_data_size,