Thomas Lively 6474d1b20e [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
2020-04-14 13:49:28 -07:00

27 lines
846 B
LLVM

; RUN: llc -filetype=obj %s -o %t.o
target triple = "wasm32-unknown-unknown"
define hidden void @entry() local_unnamed_addr #0 {
entry:
ret void
}
; RUN: not wasm-ld -o %t.exe 2>&1 | FileCheck -check-prefix=IN %s
; IN: error: no input files
; RUN: not wasm-ld %t.o 2>&1 | FileCheck -check-prefix=OUT %s
; OUT: error: no output file specified
; RUN: not wasm-ld 2>&1 | FileCheck -check-prefix=BOTH %s
; BOTH: error: no input files
; BOTH-NOT: error: no output file specified
; RUN: not wasm-ld --export-table --import-table %t.o 2>&1 \
; RUN: | FileCheck -check-prefix=TABLE %s
; TABLE: error: --import-table and --export-table may not be used together
; RUN: not wasm-ld --relocatable --shared-memory %t.o 2>&1 \
; RUN: | FileCheck -check-prefix=SHARED-MEM %s
; SHARED-MEM: error: -r and --shared-memory may not be used together