Skip to content

Commit 7e3d690

Browse files
committed
Adapt to custom-page-sizes
cf. llvm/llvm-project#128942
1 parent c1b54ea commit 7e3d690

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

libc-bottom-half/headers/public/__macro_PAGESIZE.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22
#define __wasilibc___macro_PAGESIZE_h
33

44
/*
5-
* The page size in WebAssembly is fixed at 64 KiB. If this ever changes,
6-
* it's expected that applications will need to opt in, so we can change
7-
* this.
5+
* Without custom-page-sizes proposal, the page size in WebAssembly
6+
* is fixed at 64 KiB.
7+
*
8+
* The LLVM versions with a support of custom-page-sizes proposal
9+
* provides __wasm_first_page_end global to allow page-size-agnostic
10+
* objects.
811
*
912
* If this ever needs to be a value outside the range of an `int`, the
1013
* `getpagesize` function which returns this value will need special
1114
* consideration. POSIX has deprecated `getpagesize` in favor of
1215
* `sysconf(_SC_PAGESIZE)` which does not have this problem.
1316
*/
17+
#if __clang_major__ >= 22
18+
extern char __wasm_first_page_end;
19+
#define PAGESIZE ((unsigned long)&__wasm_first_page_end)
20+
#else
1421
#define PAGESIZE (0x10000)
22+
#endif
1523

1624
#endif

0 commit comments

Comments
 (0)