Skip to content
Open
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
Binary file modified qjs.wasm
Binary file not shown.
9 changes: 9 additions & 0 deletions qjswasm/qjswasm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ target_link_options(qjswasm PRIVATE
"LINKER:--export=malloc"
"LINKER:--export=free"
"LINKER:--export=initialize"

# Grow the C shadow stack well beyond wasm-ld's ~1 MiB default.
# QuickJS's parser/evaluator recurse in C, so deep (but ordinary)
# source nesting overflowed the small default stack and trapped as
# "out of bounds memory access". With --stack-first the stack sits at
# the bottom of linear memory, so initial memory must exceed
# stack-size + data. See fastschema/qjs#47.
"LINKER:-z,stack-size=16777216" # 16 MiB C stack
"LINKER:--initial-memory=20971520" # 320 pages (20 MiB)
)

target_compile_options(qjswasm PRIVATE "-fvisibility=default")
Expand Down