[PATCH] D75703: Splits __wasm_apply_relocs into multiple functions

Daniel Church via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 10:58:14 PST 2020


danchurch created this revision.
danchurch added reviewers: lld, loladiro, sbc100.
Herald added subscribers: llvm-commits, sunfish, aheejin.
Herald added a project: LLVM.

Rather than having one potentially large __wasm_apply_relocs function, __wasm_apply_relocs is split into 10 smaller functions, all executed in order.

Safari on iOS struggles with excessively large functions, and for a larger .wasm module (~7mb observed), _wasm_apply_relocs balloons to >500kb, causing Safari iOS to fail with a "max stack size exceeded" error.  By splitting __wasm_apply_relocs into multiple smaller methods, relocation functionality is preserved while being able to load/run on iOS.

I understand that this code may not be perfect, setting the initial function count to 10 is a hack, etc.  I'm submitting this patch to spark discussion, expecting that the overall approach may need to be modified (or at-least made tune-able with linker flags).


https://reviews.llvm.org/D75703

Files:
  lld/wasm/Driver.cpp
  lld/wasm/InputChunks.cpp
  lld/wasm/InputChunks.h
  lld/wasm/MarkLive.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75703.248549.patch
Type: text/x-patch
Size: 6783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200305/05afb18f/attachment.bin>


More information about the llvm-commits mailing list