1 ; RUN: llc -mcpu=mvp -filetype=obj -o %t.o %s
2 ; RUN: llc -mcpu=mvp -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
3 ; RUN: wasm-ld --export-dynamic %t.o %t2.o -o %t.wasm
4 ; RUN: obj2yaml %t.wasm | FileCheck %s
6 ; Test that the strongly defined alias_fn from this file is used both here
9 target triple = "wasm32-unknown-unknown"
11 define i32 @alias_fn() local_unnamed_addr #1 {
15 ; Function Attrs: nounwind uwtable
16 define void @_start() local_unnamed_addr #1 {
18 %call = tail call i32 @alias_fn() #2
23 ; CHECK-NEXT: FileHeader:
24 ; CHECK-NEXT: Version: 0x1
25 ; CHECK-NEXT: Sections:
26 ; CHECK-NEXT: - Type: TYPE
27 ; CHECK-NEXT: Signatures:
28 ; CHECK-NEXT: - Index: 0
29 ; CHECK-NEXT: ParamTypes: []
30 ; CHECK-NEXT: ReturnTypes:
32 ; CHECK-NEXT: - Index: 1
33 ; CHECK-NEXT: ParamTypes: []
34 ; CHECK-NEXT: ReturnTypes: []
35 ; CHECK-NEXT: - Type: FUNCTION
36 ; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 0, 0, 0, 0 ]
37 ; CHECK-NEXT: - Type: TABLE
39 ; CHECK-NEXT: - Index: 0
40 ; CHECK-NEXT: ElemType: FUNCREF
42 ; CHECK-NEXT: Flags: [ HAS_MAX ]
43 ; CHECK-NEXT: Minimum: 0x3
44 ; CHECK-NEXT: Maximum: 0x3
45 ; CHECK-NEXT: - Type: MEMORY
46 ; CHECK-NEXT: Memories:
47 ; CHECK-NEXT: - Minimum: 0x2
48 ; CHECK-NEXT: - Type: GLOBAL
49 ; CHECK-NEXT: Globals:
50 ; CHECK-NEXT: - Index: 0
51 ; CHECK-NEXT: Type: I32
52 ; CHECK-NEXT: Mutable: true
53 ; CHECK-NEXT: InitExpr:
54 ; CHECK-NEXT: Opcode: I32_CONST
55 ; CHECK-NEXT: Value: 66560
56 ; CHECK-NEXT: - Type: EXPORT
57 ; CHECK-NEXT: Exports:
58 ; CHECK-NEXT: - Name: memory
59 ; CHECK-NEXT: Kind: MEMORY
60 ; CHECK-NEXT: Index: 0
61 ; CHECK-NEXT: - Name: alias_fn
62 ; CHECK-NEXT: Kind: FUNCTION
63 ; CHECK-NEXT: Index: 0
64 ; CHECK-NEXT: - Name: _start
65 ; CHECK-NEXT: Kind: FUNCTION
66 ; CHECK-NEXT: Index: 1
67 ; CHECK-NEXT: - Name: direct_fn
68 ; CHECK-NEXT: Kind: FUNCTION
69 ; CHECK-NEXT: Index: 2
70 ; CHECK-NEXT: - Name: call_direct
71 ; CHECK-NEXT: Kind: FUNCTION
72 ; CHECK-NEXT: Index: 3
73 ; CHECK-NEXT: - Name: call_alias
74 ; CHECK-NEXT: Kind: FUNCTION
75 ; CHECK-NEXT: Index: 4
76 ; CHECK-NEXT: - Name: call_alias_ptr
77 ; CHECK-NEXT: Kind: FUNCTION
78 ; CHECK-NEXT: Index: 5
79 ; CHECK-NEXT: - Name: call_direct_ptr
80 ; CHECK-NEXT: Kind: FUNCTION
81 ; CHECK-NEXT: Index: 6
82 ; CHECK-NEXT: - Type: ELEM
83 ; CHECK-NEXT: Segments:
84 ; CHECK-NEXT: - Offset:
85 ; CHECK-NEXT: Opcode: I32_CONST
86 ; CHECK-NEXT: Value: 1
87 ; CHECK-NEXT: Functions: [ 0, 2 ]
88 ; CHECK-NEXT: - Type: CODE
89 ; CHECK-NEXT: Functions:
90 ; CHECK-NEXT: - Index: 0
92 ; CHECK-NEXT: Body: 41010B
93 ; CHECK-NEXT: - Index: 1
95 ; CHECK-NEXT: Body: 1080808080001A0B
96 ; CHECK-NEXT: - Index: 2
98 ; CHECK-NEXT: Body: 41000B
99 ; CHECK-NEXT: - Index: 3
100 ; CHECK-NEXT: Locals:
101 ; CHECK-NEXT: Body: 1082808080000B
102 ; CHECK-NEXT: - Index: 4
103 ; CHECK-NEXT: Locals:
104 ; CHECK-NEXT: Body: 1080808080000B
105 ; CHECK-NEXT: - Index: 5
106 ; CHECK-NEXT: Locals:
107 ; CHECK-NEXT: - Type: I32
108 ; CHECK-NEXT: Count: 2
109 ; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081080808080002101200041106A24808080800020010B
110 ; CHECK-NEXT: - Index: 6
111 ; CHECK-NEXT: Locals:
112 ; CHECK-NEXT: - Type: I32
113 ; CHECK-NEXT: Count: 2
114 ; CHECK-NEXT: Body: 23808080800041106B220024808080800020004182808080003602081082808080002101200041106A24808080800020010B
115 ; CHECK-NEXT: - Type: CUSTOM
116 ; CHECK-NEXT: Name: name
117 ; CHECK-NEXT: FunctionNames:
118 ; CHECK-NEXT: - Index: 0
119 ; CHECK-NEXT: Name: alias_fn
120 ; CHECK-NEXT: - Index: 1
121 ; CHECK-NEXT: Name: _start
122 ; CHECK-NEXT: - Index: 2
123 ; CHECK-NEXT: Name: direct_fn
124 ; CHECK-NEXT: - Index: 3
125 ; CHECK-NEXT: Name: call_direct
126 ; CHECK-NEXT: - Index: 4
127 ; CHECK-NEXT: Name: call_alias
128 ; CHECK-NEXT: - Index: 5
129 ; CHECK-NEXT: Name: call_alias_ptr
130 ; CHECK-NEXT: - Index: 6
131 ; CHECK-NEXT: Name: call_direct_ptr
132 ; CHECK-NEXT: GlobalNames:
133 ; CHECK-NEXT: - Index: 0
134 ; CHECK-NEXT: Name: __stack_pointer