Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/libc/include/wasm-wasi-musl/__macro_PAGESIZE.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions lib/libc/include/wasm-wasi-musl/__wasi_snapshot.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* This file is (practically) empty by default. The Makefile will replace it
with a non-empty version that defines `__wasilibc_use_wasip2` if targeting
`wasm32-wasip2`.
*/

Loading