extern hidden unsigned __default_guardsize;
#define DEFAULT_STACK_SIZE 131072
+#ifdef __wasilibc_unmodified_upstream
#define DEFAULT_GUARD_SIZE 8192
+#else
+/* guard doesn't make much sense without mprotect. */
+#define DEFAULT_GUARD_SIZE 0
+#endif
#define DEFAULT_STACK_MAX (8<<20)
#define DEFAULT_GUARD_MAX (1<<20)
}
#endif
+#ifdef __wasilibc_unmodified_upstream
#define ROUND(x) (((x)+PAGE_SIZE-1)&-PAGE_SIZE)
+#else
+/*
+ * As we allocate stack with malloc() instead of mmap/mprotect,
+ * there is no point to round it up to PAGE_SIZE.
+ * Instead, round up to a sane alignment.
+ * Note: PAGE_SIZE is rather big on WASM. (65536)
+ */
+#define ROUND(x) (((x)+16-1)&-16)
+#endif
/* pthread_key_create.c overrides this */
static volatile size_t dummy = 0;