2 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
3 # RUN: not wasm-ld --export=missing -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
4 # RUN: wasm-ld --export=hidden_function -o %t.wasm %t.o
5 # RUN: obj2yaml %t.wasm | FileCheck %s
7 # Now test in Emscripten mode
8 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-emscripten -o %t.o %s
9 # RUN: not wasm-ld --export=missing -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
10 # RUN: wasm-ld --export=hidden_function -o %t.wasm %t.o
11 # RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes=CHECK,EMSCRIPTEN
13 # Not exported by default, but forced via commandline
14 .hidden hidden_function
15 .globl hidden_function
17 .functype hidden_function () -> (i32)
21 # Not exported by default
22 .globl default_function
24 .functype default_function () -> (i32)
28 # Exported in emscripten mode which treats .no_dead_strip as a signal to export
29 .no_dead_strip used_function
32 .functype used_function () -> (i32)
39 .functype _start () -> ()
42 # CHECK-ERROR: error: symbol exported via --export not found: missing
44 # CHECK-NOT: - Name: default_function
46 # CHECK: - Type: EXPORT
47 # CHECK-NEXT: Exports:
48 # CHECK-NEXT: - Name: memory
49 # CHECK-NEXT: Kind: MEMORY
50 # CHECK-NEXT: Index: 0
51 # CHECK-NEXT: - Name: hidden_function
52 # CHECK-NEXT: Kind: FUNCTION
53 # CHECK-NEXT: Index: 0
54 # EMSCRIPTEN-NEXT: - Name: used_function
55 # EMSCRIPTEN-NEXT: Kind: FUNCTION
56 # EMSCRIPTEN-NEXT: Index: 1
57 # CHECK-NEXT: - Name: _start
58 # CHECK-NEXT: Kind: FUNCTION
59 # CHECK-NEXT: Index: 2
60 # CHECK-NEXT: - Type: CODE