Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / wasm / unresolved-symbols-dynamic.s
blobc3d4a753acf6060340b0a0b743eee6cd94928894
1 # Unresolve data symbols are allowing under import-dynamic when GOT
2 # relocations are used
3 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t-dynamic.o
4 # RUN: wasm-ld %t-dynamic.o -o %t.wasm --unresolved-symbols=import-dynamic 2>&1 | FileCheck -check-prefix=WARN %s
5 # WARN: wasm-ld: warning: dynamic imports are not yet stable (--unresolved-symbols=import-dynamic)
6 # RUN: obj2yaml %t.wasm | FileCheck %s
8 .functype undef () -> ()
10 .globl get_data_addr
11 get_data_addr:
12 .functype get_data_addr () -> (i32)
13 global.get undef_data@GOT
14 return
15 end_function
17 .globl get_func_addr
18 get_func_addr:
19 .functype get_func_addr () -> (i32)
20 global.get undef@GOT
21 return
22 end_function
24 .globl _start
25 _start:
26 .functype _start () -> ()
27 call undef
28 call get_func_addr
29 drop
30 call get_data_addr
31 i32.load data_ptr
32 drop
33 end_function
35 .section .data.data_ptr,"",@
36 data_ptr:
37 .int32 data_external+42
38 .size data_ptr, 4
40 .size data_external, 4
42 # CHECK: - Type: IMPORT
43 # CHECK-NEXT: Imports:
44 # CHECK-NEXT: - Module: env
45 # CHECK-NEXT: Field: undef
46 # CHECK-NEXT: Kind: FUNCTION
47 # CHECK-NEXT: SigIndex: 0
48 # CHECK-NEXT: - Module: GOT.mem
49 # CHECK-NEXT: Field: undef_data
50 # CHECK-NEXT: Kind: GLOBAL
51 # CHECK-NEXT: GlobalType: I32
52 # CHECK-NEXT: GlobalMutable: true
53 # CHECK-NEXT: - Module: GOT.func
54 # CHECK-NEXT: Field: undef
55 # CHECK-NEXT: Kind: GLOBAL
56 # CHECK-NEXT: GlobalType: I32
57 # CHECK-NEXT: GlobalMutable: true
59 # CHECK: - Type: CUSTOM
60 # CHECK-NEXT: Name: name
61 # CHECK-NEXT: FunctionNames:
62 # CHECK-NEXT: - Index: 0
63 # CHECK-NEXT: Name: undef
64 # CHECK-NEXT: - Index: 1
65 # CHECK-NEXT: Name: __wasm_apply_data_relocs
66 # CHECK-NEXT: - Index: 2
67 # CHECK-NEXT: Name: get_data_addr
68 # CHECK-NEXT: - Index: 3
69 # CHECK-NEXT: Name: get_func_addr
70 # CHECK-NEXT: - Index: 4
71 # CHECK-NEXT: Name: _start
72 # CHECK-NEXT: GlobalNames:
73 # CHECK-NEXT: - Index: 0
74 # CHECK-NEXT: Name: undef_data
75 # CHECK-NEXT: - Index: 1
76 # CHECK-NEXT: Name: undef
77 # CHECK-NEXT: - Index: 2
78 # CHECK-NEXT: Name: data_external
79 # CHECK-NEXT: - Index: 3
80 # CHECK-NEXT: Name: __stack_pointer
81 # CHECK-NEXT: DataSegmentNames:
82 # CHECK-NEXT: - Index: 0
83 # CHECK-NEXT: Name: .data
84 # CHECK-NEXT:...