Skip to content

Commit b109200

Browse files
committed
wasm-ld: constexpr size_t kV8MaxWasmFunctionSize = 7'654'321;
1 parent 005e14c commit b109200

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lld/wasm/InputChunks.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,10 @@ void InputChunk::generateRelocationCode(std::vector<std::string> &funcs) const {
384384
if (!requiresRuntimeReloc)
385385
continue;
386386

387-
if (funcs.empty() || funcs.back().size() >= 7654300) {
388-
funcs.emplace_back(std::string());
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) {
390+
funcs.emplace_back(std::string());
389391
raw_string_ostream os(funcs.back());
390392
writeUleb128(os, 0, "num locals");
391393
}

0 commit comments

Comments
 (0)