[lld][WebAssembly] Do not require --shared-memory with --relocatable
authorThomas Lively <tlively@google.com>
Tue, 14 Apr 2020 02:16:20 +0000 (19:16 -0700)
committerThomas Lively <tlively@google.com>
Tue, 14 Apr 2020 20:49:28 +0000 (13:49 -0700)
commit6474d1b20ea74982f9446a11b367a5936b6bbbdd
tree35fb7349032ef6b8f4ee3aea7817bf82246e07e3
parent5f07dcd23c2dac5b34115df07d3ae629c35c6eb3
[lld][WebAssembly] Do not require --shared-memory with --relocatable

Summary:
wasm-ld requires --shared-memory to be passed when the atomics feature
is enabled because historically atomic operations were only valid with
shared memories. This change relaxes that requirement for when
building relocatable objects because their memories are not
meaningful. This technically maintains the validity of object files
because the threads spec now allows atomic operations with unshared
memories, although we don't support that elsewhere in the tools yet.

This fixes and Emscripten build issue reported at
https://bugs.chromium.org/p/webp/issues/detail?id=463.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78072
lld/test/wasm/driver.ll
lld/test/wasm/relocatable.ll
lld/test/wasm/shared-memory.yaml
lld/wasm/Driver.cpp
lld/wasm/Writer.cpp