[all-commits] [llvm/llvm-project] e52881: [lld][WebAssembly] Split __wasm_apply_relocs funct...

Sam Clegg via All-commits all-commits at lists.llvm.org
Thu Dec 10 17:07:59 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e52881a2870234f0dad6e338a0f084eddeaa9356
      https://github.com/llvm/llvm-project/commit/e52881a2870234f0dad6e338a0f084eddeaa9356
  Author: Sam Clegg <sbc at chromium.org>
  Date:   2020-12-10 (Thu, 10 Dec 2020)

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

  Log Message:
  -----------
  [lld][WebAssembly] Split __wasm_apply_relocs function in two

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.

Differential Revision: https://reviews.llvm.org/D93066




More information about the All-commits mailing list