[PATCH] D93066: [lld][WebAssembly] Split __wasm_apply_relocs function in two

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 13:28:56 PST 2020


sbc100 created this revision.
Herald added subscribers: wingo, ecnelises, jfb, sunfish, jgravelle-google, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

We have two types of relocations that we apply on startup:

1. Relocations that apply to wasm globals
2. Relocations that apply to wasm memory

The first set of relocations use only the `__memory_base` import to
update a set of internal globals.  Because wasm globals are thread local
these need to run on each thread.  Memory relocations, like static
constructors, must only be run once.

To ensure global relocations run on all threads and because the only
depend on the immutable `__memory_base` import we can run them during
the WebAssembly start functions, instead of waiting until the
post-instantiation __wasm_call_ctors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93066

Files:
  lld/test/wasm/bsymbolic.s
  lld/test/wasm/data-segments.ll
  lld/test/wasm/pie.ll
  lld/test/wasm/weak-undefined-pic.s
  lld/wasm/Driver.cpp
  lld/wasm/MarkLive.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/SyntheticSections.h
  lld/wasm/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93066.311006.patch
Type: text/x-patch
Size: 17907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201210/95ae3c9e/attachment.bin>


More information about the llvm-commits mailing list