1 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/weak-symbol1.s -o %t1.o
2 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/weak-symbol2.s -o %t2.o
3 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o
4 # RUN: wasm-ld --export-dynamic -o %t.wasm %t.o %t1.o %t2.o
5 # RUN: obj2yaml %t.wasm | FileCheck %s
7 .functype weakFn () -> (i32)
11 .functype _start () -> ()
19 # CHECK-NEXT: FileHeader:
20 # CHECK-NEXT: Version: 0x1
21 # CHECK-NEXT: Sections:
22 # CHECK-NEXT: - Type: TYPE
23 # CHECK-NEXT: Signatures:
24 # CHECK-NEXT: - Index: 0
25 # CHECK-NEXT: ParamTypes: []
26 # CHECK-NEXT: ReturnTypes: []
27 # CHECK-NEXT: - Index: 1
28 # CHECK-NEXT: ParamTypes: []
29 # CHECK-NEXT: ReturnTypes:
31 # CHECK-NEXT: - Type: FUNCTION
32 # CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1 ]
33 # CHECK-NEXT: - Type: TABLE
35 # CHECK-NEXT: - Index: 0
36 # CHECK-NEXT: ElemType: FUNCREF
38 # CHECK-NEXT: Flags: [ HAS_MAX ]
39 # CHECK-NEXT: Minimum: 0x2
40 # CHECK-NEXT: Maximum: 0x2
41 # CHECK-NEXT: - Type: MEMORY
42 # CHECK-NEXT: Memories:
43 # CHECK-NEXT: - Minimum: 0x2
44 # CHECK-NEXT: - Type: GLOBAL
45 # CHECK-NEXT: Globals:
46 # CHECK-NEXT: - Index: 0
47 # CHECK-NEXT: Type: I32
48 # CHECK-NEXT: Mutable: true
49 # CHECK-NEXT: InitExpr:
50 # CHECK-NEXT: Opcode: I32_CONST
51 # CHECK-NEXT: Value: 66576
52 # CHECK-NEXT: - Index: 1
53 # CHECK-NEXT: Type: I32
54 # CHECK-NEXT: Mutable: false
55 # CHECK-NEXT: InitExpr:
56 # CHECK-NEXT: Opcode: I32_CONST
57 # CHECK-NEXT: Value: 1024
58 # CHECK-NEXT: - Type: EXPORT
59 # CHECK-NEXT: Exports:
60 # CHECK-NEXT: - Name: memory
61 # CHECK-NEXT: Kind: MEMORY
62 # CHECK-NEXT: Index: 0
63 # CHECK-NEXT: - Name: _start
64 # CHECK-NEXT: Kind: FUNCTION
65 # CHECK-NEXT: Index: 0
66 # CHECK-NEXT: - Name: weakFn
67 # CHECK-NEXT: Kind: FUNCTION
68 # CHECK-NEXT: Index: 1
69 # CHECK-NEXT: - Name: exportWeak1
70 # CHECK-NEXT: Kind: FUNCTION
71 # CHECK-NEXT: Index: 2
72 # CHECK-NEXT: - Name: weakGlobal
73 # CHECK-NEXT: Kind: GLOBAL
74 # CHECK-NEXT: Index: 1
75 # CHECK-NEXT: - Name: exportWeak2
76 # CHECK-NEXT: Kind: FUNCTION
77 # CHECK-NEXT: Index: 3
78 # CHECK-NEXT: - Type: ELEM
79 # CHECK-NEXT: Segments:
80 # CHECK-NEXT: - Offset:
81 # CHECK-NEXT: Opcode: I32_CONST
82 # CHECK-NEXT: Value: 1
83 # CHECK-NEXT: Functions: [ 1 ]
84 # CHECK-NEXT: - Type: CODE
85 # CHECK-NEXT: Functions:
86 # CHECK-NEXT: - Index: 0
88 # CHECK-NEXT: Body: 1081808080001A0B
89 # CHECK-NEXT: - Index: 1
91 # CHECK-NEXT: Body: 41010B
92 # CHECK-NEXT: - Index: 2
94 # CHECK-NEXT: Body: 4181808080000B
95 # CHECK-NEXT: - Index: 3
97 # CHECK-NEXT: Body: 4181808080000B
98 # CHECK-NEXT: - Type: DATA
99 # CHECK-NEXT: Segments:
100 # CHECK-NEXT: - SectionOffset: 7
101 # CHECK-NEXT: InitFlags: 0
102 # CHECK-NEXT: Offset:
103 # CHECK-NEXT: Opcode: I32_CONST
104 # CHECK-NEXT: Value: 1024
105 # CHECK-NEXT: Content: '01000000'
106 # CHECK-NEXT: - Type: CUSTOM
107 # CHECK-NEXT: Name: name
108 # CHECK-NEXT: FunctionNames:
109 # CHECK-NEXT: - Index: 0
110 # CHECK-NEXT: Name: _start
111 # CHECK-NEXT: - Index: 1
112 # CHECK-NEXT: Name: weakFn
113 # CHECK-NEXT: - Index: 2
114 # CHECK-NEXT: Name: exportWeak1
115 # CHECK-NEXT: - Index: 3
116 # CHECK-NEXT: Name: exportWeak2
117 # CHECK-NEXT: GlobalNames:
118 # CHECK-NEXT: - Index: 0
119 # CHECK-NEXT: Name: __stack_pointer
120 # CHECK-NEXT: DataSegmentNames:
121 # CHECK-NEXT: - Index: 0
122 # CHECK-NEXT: Name: .data