From 1521011029b0531c02eb0142c239b7f85a3165b5 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Thu, 16 Apr 2026 22:56:24 +0200 Subject: [PATCH] baremetal: place mmap memory region in .text segment --- core/shared/platform/baremetal/platform_init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/shared/platform/baremetal/platform_init.c b/core/shared/platform/baremetal/platform_init.c index 09cdd439..ec1fa981 100644 --- a/core/shared/platform/baremetal/platform_init.c +++ b/core/shared/platform/baremetal/platform_init.c @@ -44,8 +44,9 @@ os_dumps_proc_mem_info(char *out, unsigned int size) // #11 0x08048cff in wasm_runtime_load // #12 0x08048112 in main -// I hope this isn't too simple -static uint8_t mmap_space[MMAP_SPACE_SIZE]; +// Place mmap memory inside the .text segment, so FAIL* ignores it +__attribute__((section(".text.wamr_aot"), + aligned(4096))) static uint8_t mmap_space[MMAP_SPACE_SIZE]; static size_t mmap_offset = 0; // Free space begins here static size_t @@ -58,6 +59,7 @@ align_up(size_t x, size_t a) return (x + a - 1) & ~(a - 1); } +// I hope this isn't too simple void * os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) {