xref: /llvm-project/lld/test/wasm/driver.s (revision 966427b8471d204b3df1412041af9aa9702db869)
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
2
3.globl  _start
4_start:
5  .functype _start () -> ()
6  end_function
7
8# RUN: not wasm-ld %t -o 2>&1 | FileCheck --check-prefix=NO_O_VAL %s
9# NO_O_VAL: error: -o: missing argument
10
11# RUN: not wasm-ld -o %t.exe 2>&1 | FileCheck -check-prefix=IN %s
12# IN: error: no input files
13
14# RUN: not wasm-ld %t.o 2>&1 | FileCheck -check-prefix=OUT %s
15# OUT: error: no output file specified
16
17# RUN: not wasm-ld 2>&1 | FileCheck -check-prefix=BOTH %s
18# BOTH:     error: no input files
19# BOTH-NOT: error: no output file specified
20
21# RUN: not wasm-ld --export-table --import-table %t.o 2>&1 \
22# RUN:   | FileCheck -check-prefix=TABLE %s
23# TABLE: error: --import-table and --export-table may not be used together
24
25# RUN: not wasm-ld --relocatable --shared-memory %t.o 2>&1 \
26# RUN:   | FileCheck -check-prefix=SHARED-MEM %s
27# SHARED-MEM: error: -r and --shared-memory may not be used together
28
29# RUN: wasm-ld %t.o -z foo -o /dev/null 2>&1 | FileCheck -check-prefix=ERR10 %s
30# RUN: wasm-ld %t.o -z foo -o /dev/null --version 2>&1 | FileCheck -check-prefix=ERR10 %s
31# ERR10: warning: unknown -z value: foo
32
33## Check we report "unknown -z value" error even with -v.
34# RUN: wasm-ld %t.o -z foo -o /dev/null -v 2>&1 | FileCheck -check-prefix=ERR10 %s
35
36## Note: in GNU ld, --fatal-warning still leads to a warning.
37# RUN: not wasm-ld %t.o -z foo --fatal-warnings 2>&1 | FileCheck --check-prefix=ERR10-FATAL %s
38# ERR10-FATAL: error: unknown -z value: foo
39
40## stack-size without an = is also an error
41# RUN: not wasm-ld %t.o -z stack-size 2>&1 | FileCheck -check-prefix=ERR11 %s
42# ERR11: unknown -z value: stack-size
43