1; RUN: llc -filetype=obj -o %t.o %s
2; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hidden.s -o %t2.o
3; RUN: rm -f %t2.a
4; RUN: llvm-ar rcs %t2.a %t2.o
5
6; Test that symbols with hidden visibility are not export, even with
7; --export-dynamic
8; RUN: wasm-ld --export-dynamic %t.o %t2.a -o %t.wasm
9; RUN: obj2yaml %t.wasm | FileCheck %s
10
11; Test that symbols with default visibility are not exported without
12; --export-dynamic
13; RUN: wasm-ld %t.o %t2.a -o %t.nodef.wasm
14; RUN: obj2yaml %t.nodef.wasm | FileCheck %s -check-prefix=NO-DEFAULT
15
16
17target triple = "wasm32-unknown-unknown"
18
19define hidden i32 @objectHidden() {
20entry:
21    ret i32 0
22}
23
24define i32 @objectDefault() {
25entry:
26    ret i32 0
27}
28
29declare i32 @archiveHidden()
30declare i32 @archiveDefault()
31
32define void @_start() {
33entry:
34  %call1 = call i32 @objectHidden()
35  %call2 = call i32 @objectDefault()
36  %call3 = call i32 @archiveHidden()
37  %call4 = call i32 @archiveDefault()
38  ret void
39}
40
41; CHECK:        - Type:            EXPORT
42; CHECK-NEXT:     Exports:
43; CHECK-NEXT:       - Name:            memory
44; CHECK-NEXT:         Kind:            MEMORY
45; CHECK-NEXT:         Index:           0
46; CHECK-NEXT:       - Name:            objectDefault
47; CHECK-NEXT:         Kind:            FUNCTION
48; CHECK-NEXT:         Index:           1
49; CHECK-NEXT:       - Name:            _start
50; CHECK-NEXT:         Kind:            FUNCTION
51; CHECK-NEXT:         Index:           2
52; CHECK-NEXT:       - Name:            archiveDefault
53; CHECK-NEXT:         Kind:            FUNCTION
54; CHECK-NEXT:         Index:           4
55; CHECK-NEXT:   - Type:
56
57
58; NO-DEFAULT:        - Type:            EXPORT
59; NO-DEFAULT-NEXT:     Exports:
60; NO-DEFAULT-NEXT:       - Name:            memory
61; NO-DEFAULT-NEXT:         Kind:            MEMORY
62; NO-DEFAULT-NEXT:         Index:           0
63; NO-DEFAULT-NEXT:       - Name:            _start
64; NO-DEFAULT-NEXT:         Kind:            FUNCTION
65; NO-DEFAULT-NEXT:         Index:           2
66; NO-DEFAULT-NEXT:   - Type:
67