Enable libc-wasi for windows msvc build (#3852)

The default iwasm building in Windows MSVC enables libc-uvwasi because
libc-wasi isn't supported at the beginning. Since libc-wasi had been refactored
and is supported in Windows msys2 building, and libc-wasi supports more
functionalities(e.g. sockets) than libc-uvwasi, this PR fixes some issues to
enable libc-wasi in windows MSVC buidlings.
This commit is contained in:
Wenyong Huang
2024-10-14 09:52:25 +08:00
committed by GitHub
parent 36d438051e
commit b16b6044ee
8 changed files with 96 additions and 28 deletions

View File

@ -2512,6 +2512,15 @@ try_merge_data_and_text(const uint8 **buf, const uint8 **buf_end,
/* merge failed but may be not critical for some targets */
return false;
}
#ifdef BH_PLATFORM_WINDOWS
if (!os_mem_commit(sections, code_size,
MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC)) {
os_munmap(sections, (uint32)total_size);
return false;
}
#endif
/* change the code part to be executable */
if (os_mprotect(sections, code_size,
MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC)