1 ; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %p/Inputs/comdat1.ll -o %t1.o
2 ; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %p/Inputs/comdat2.ll -o %t2.o
3 ; RUN: llc -filetype=obj -mtriple=wasm32-unknown-uknown-wasm %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 target triple = "wasm32-unknown-unknown"
9 declare void @__wasm_call_ctors()
10 declare i32 @comdatFn()
12 define void @_start() {
14 call void @__wasm_call_ctors()
15 %call = call i32 @comdatFn()
19 ; CHECK: - Type: GLOBAL
20 ; CHECK-NEXT: Globals:
21 ; CHECK-NEXT: - Index: 0
22 ; CHECK-NEXT: Type: I32
23 ; CHECK-NEXT: Mutable: true
24 ; CHECK-NEXT: InitExpr:
25 ; CHECK-NEXT: Opcode: I32_CONST
26 ; CHECK-NEXT: Value: 66576
27 ; CHECK-NEXT: - Index: 1
28 ; CHECK-NEXT: Type: I32
29 ; CHECK-NEXT: Mutable: false
30 ; CHECK-NEXT: InitExpr:
31 ; CHECK-NEXT: Opcode: I32_CONST
32 ; CHECK-NEXT: Value: 1024
33 ; CHECK-NEXT: - Type: EXPORT
34 ; CHECK-NEXT: Exports:
35 ; CHECK-NEXT: - Name: memory
36 ; CHECK-NEXT: Kind: MEMORY
37 ; CHECK-NEXT: Index: 0
38 ; CHECK-NEXT: - Name: _start
39 ; CHECK-NEXT: Kind: FUNCTION
40 ; CHECK-NEXT: Index: 1
41 ; CHECK-NEXT: - Name: comdatFn
42 ; CHECK-NEXT: Kind: FUNCTION
43 ; CHECK-NEXT: Index: 2
44 ; CHECK-NEXT: - Name: constantData
45 ; CHECK-NEXT: Kind: GLOBAL
46 ; CHECK-NEXT: Index: 1
47 ; CHECK-NEXT: - Name: callComdatFn1
48 ; CHECK-NEXT: Kind: FUNCTION
49 ; CHECK-NEXT: Index: 4
50 ; CHECK-NEXT: - Name: callComdatFn2
51 ; CHECK-NEXT: Kind: FUNCTION
52 ; CHECK-NEXT: Index: 5
53 ; CHECK-NEXT: - Type: ELEM
54 ; CHECK-NEXT: Segments:
55 ; CHECK-NEXT: - Offset:
56 ; CHECK-NEXT: Opcode: I32_CONST
57 ; CHECK-NEXT: Value: 1
58 ; CHECK-NEXT: Functions: [ 2 ]
59 ; CHECK-NEXT: - Type: CODE
60 ; CHECK-NEXT: Functions:
61 ; CHECK-NEXT: - Index: 0
63 ; CHECK-NEXT: Body: 10030B
64 ; CHECK-NEXT: - Index: 1
66 ; CHECK-NEXT: Body: 1080808080001082808080001A0B
67 ; CHECK-NEXT: - Index: 2
69 ; CHECK-NEXT: Body: 4180888080000B
70 ; CHECK-NEXT: - Index: 3
72 ; CHECK-NEXT: Body: 0B
73 ; CHECK-NEXT: - Index: 4
75 ; CHECK-NEXT: Body: 4181808080000B
76 ; CHECK-NEXT: - Index: 5
78 ; CHECK-NEXT: Body: 4181808080000B
79 ; CHECK-NEXT: - Type: DATA
80 ; CHECK-NEXT: Segments:
81 ; CHECK-NEXT: - SectionOffset: 7
82 ; CHECK-NEXT: InitFlags: 0
84 ; CHECK-NEXT: Opcode: I32_CONST
85 ; CHECK-NEXT: Value: 1024
86 ; CHECK-NEXT: Content: '616263'