Skip to content

Commit 0d3cf94

Browse files
committed
wasm-ld: Set max function body size check of 7'654'321 bytes.
1 parent 005e14c commit 0d3cf94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lld/wasm/InputChunks.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ void InputChunk::generateRelocationCode(std::vector<std::string> &funcs) const {
384384
if (!requiresRuntimeReloc)
385385
continue;
386386

387-
if (funcs.empty() || funcs.back().size() >= 7654300) {
387+
// https://www.w3.org/TR/wasm-js-api-2/#limits
388+
// The maximum size of a function body, including locals declarations, is 7,654,321 bytes.
389+
if (funcs.empty() || funcs.back().size() >= 7654321) {
388390
funcs.emplace_back(std::string());
389391
raw_string_ostream os(funcs.back());
390392
writeUleb128(os, 0, "num locals");

0 commit comments

Comments
 (0)