[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL
[llvm-project.git] / lld / test / wasm / command-exports.s
blobe1b47ce9658f9540e2cac54cb19361066b901ff4
1 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
2 # RUN: wasm-ld --no-entry %t.o -o %t.wasm
3 # RUN: obj2yaml %t.wasm | FileCheck %s
5 # This test defines a command with two exported functions, as well as a static
6 # constructor and a static destructor. Check that the exports, constructor, and
7 # destructor are all set up properly.
9 .globl foo_i32
10 foo_i32:
11 .functype foo_i32 (i32, i32) -> (i32)
12 local.get 0
13 local.get 1
14 i32.add
15 end_function
17 .globl foo_f64
18 foo_f64:
19 .functype foo_f64 (f64, f64) -> (f64)
20 local.get 0
21 local.get 1
22 f64.add
23 end_function
25 .globl some_ctor
26 some_ctor:
27 .functype some_ctor () -> ()
28 end_function
30 .globl some_dtor
31 some_dtor:
32 .functype some_dtor () -> ()
33 end_function
35 .hidden __cxa_atexit
36 .globl __cxa_atexit
37 __cxa_atexit:
38 .functype __cxa_atexit (i32, i32, i32) -> (i32)
39 i32.const 0
40 end_function
42 .section .text..Lcall_dtors.1,"",@
43 .Lcall_dtors.1:
44 .functype .Lcall_dtors.1 (i32) -> ()
45 call some_dtor
46 end_function
48 .section .text..Lregister_call_dtors.1,"",@
49 .Lregister_call_dtors.1:
50 .functype .Lregister_call_dtors.1 () -> ()
51 block
52 i32.const .Lcall_dtors.1
53 i32.const 0
54 i32.const 0
55 call __cxa_atexit
56 i32.eqz
57 br_if 0
58 unreachable
59 .LBB6_2:
60 end_block
61 end_function
63 .section .init_array.1,"",@
64 .p2align 2
65 .int32 some_ctor
66 .int32 .Lregister_call_dtors.1
67 .export_name foo_i32, foo_i32
68 .export_name foo_f64, foo_f64
70 # CHECK: - Type: EXPORT
71 # CHECK-NEXT: Exports:
72 # CHECK-NEXT: - Name: memory
73 # CHECK-NEXT: Kind: MEMORY
74 # CHECK-NEXT: Index: 0
75 # CHECK-NEXT: - Name: foo_i32
76 # CHECK-NEXT: Kind: FUNCTION
77 # CHECK-NEXT: Index: 8
78 # CHECK-NEXT: - Name: foo_f64
79 # CHECK-NEXT: Kind: FUNCTION
80 # CHECK-NEXT: Index: 9
82 # CHECK: - Type: CODE
84 # CHECK: - Index: 8
85 # CHECK-NEXT: Locals: []
86 # CHECK-NEXT: Body: 10002000200110010B
87 # CHECK-NEXT: - Index: 9
88 # CHECK-NEXT: Locals: []
89 # CHECK-NEXT: Body: 10002000200110020B
91 # CHECK: - Type: CUSTOM
92 # CHECK-NEXT: Name: name
93 # CHECK-NEXT: FunctionNames:
94 # CHECK-NEXT: - Index: 0
95 # CHECK-NEXT: Name: __wasm_call_ctors
96 # CHECK-NEXT: - Index: 1
97 # CHECK-NEXT: Name: foo_i32
98 # CHECK-NEXT: - Index: 2
99 # CHECK-NEXT: Name: foo_f64
100 # CHECK-NEXT: - Index: 3
101 # CHECK-NEXT: Name: some_ctor
102 # CHECK-NEXT: - Index: 4
103 # CHECK-NEXT: Name: some_dtor
104 # CHECK-NEXT: - Index: 5
105 # CHECK-NEXT: Name: __cxa_atexit
106 # CHECK-NEXT: - Index: 6
107 # CHECK-NEXT: Name: .Lcall_dtors.1
108 # CHECK-NEXT: - Index: 7
109 # CHECK-NEXT: Name: .Lregister_call_dtors.1
110 # CHECK-NEXT: - Index: 8
111 # CHECK-NEXT: Name: foo_i32.command_export
112 # CHECK-NEXT: - Index: 9
113 # CHECK-NEXT: Name: foo_f64.command_export