diff --git a/libc-bottom-half/headers/public/__macro_PAGESIZE.h b/libc-bottom-half/headers/public/__macro_PAGESIZE.h index d89222050..fbeff8d00 100644 --- a/libc-bottom-half/headers/public/__macro_PAGESIZE.h +++ b/libc-bottom-half/headers/public/__macro_PAGESIZE.h @@ -2,15 +2,23 @@ #define __wasilibc___macro_PAGESIZE_h /* - * The page size in WebAssembly is fixed at 64 KiB. If this ever changes, - * it's expected that applications will need to opt in, so we can change - * this. + * Without custom-page-sizes proposal, the page size in WebAssembly + * is fixed at 64 KiB. + * + * The LLVM versions with a support of custom-page-sizes proposal + * provides __wasm_first_page_end global to allow page-size-agnostic + * objects. * * If this ever needs to be a value outside the range of an `int`, the * `getpagesize` function which returns this value will need special * consideration. POSIX has deprecated `getpagesize` in favor of * `sysconf(_SC_PAGESIZE)` which does not have this problem. */ +#if __clang_major__ >= 22 +extern char __wasm_first_page_end; +#define PAGESIZE ((unsigned long)&__wasm_first_page_end) +#else #define PAGESIZE (0x10000) +#endif #endif