[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL
[llvm-project.git] / lld / test / wasm / weak-undefined.s
blob5b8b9775fcea1ad1adec94ccda70aa4667212d12
1 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
2 # RUN: wasm-ld -strip-all %t.o -o %t.wasm
3 # RUN: obj2yaml %t.wasm | FileCheck %s
5 # Test that undefined weak externals (global_var) and (foo) don't cause
6 # link failures and resolve to zero.
8 .functype foo () -> (i32)
10 .globl get_address_of_foo
11 get_address_of_foo:
12 .functype get_address_of_foo () -> (i32)
13 i32.const foo
14 end_function
16 .globl get_address_of_global_var
17 get_address_of_global_var:
18 .functype get_address_of_global_var () -> (i32)
19 i32.const global_var
20 end_function
22 .globl _start
23 _start:
24 .functype _start () -> ()
25 call get_address_of_global_var
26 drop
27 call get_address_of_foo
28 drop
29 call foo
30 drop
31 end_function
33 .weak foo
34 .weak global_var
37 # CHECK: --- !WASM
38 # CHECK-NEXT: FileHeader:
39 # CHECK-NEXT: Version: 0x1
40 # CHECK-NEXT: Sections:
41 # CHECK-NEXT: - Type: TYPE
42 # CHECK-NEXT: Signatures:
43 # CHECK-NEXT: - Index: 0
44 # CHECK-NEXT: ParamTypes: []
45 # CHECK-NEXT: ReturnTypes:
46 # CHECK-NEXT: - I32
47 # CHECK-NEXT: - Index: 1
48 # CHECK-NEXT: ParamTypes: []
49 # CHECK-NEXT: ReturnTypes: []
50 # CHECK-NEXT: - Type: FUNCTION
51 # CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 1 ]
52 # CHECK-NEXT: - Type: TABLE
53 # CHECK-NEXT: Tables:
54 # CHECK-NEXT: - Index: 0
55 # CHECK-NEXT: ElemType: FUNCREF
56 # CHECK-NEXT: Limits:
57 # CHECK-NEXT: Flags: [ HAS_MAX ]
58 # CHECK-NEXT: Minimum: 0x1
59 # CHECK-NEXT: Maximum: 0x1
60 # CHECK-NEXT: - Type: MEMORY
61 # CHECK-NEXT: Memories:
62 # CHECK-NEXT: - Minimum: 0x2
63 # CHECK-NEXT: - Type: GLOBAL
64 # CHECK-NEXT: Globals:
65 # CHECK-NEXT: - Index: 0
66 # CHECK-NEXT: Type: I32
67 # CHECK-NEXT: Mutable: true
68 # CHECK-NEXT: InitExpr:
69 # CHECK-NEXT: Opcode: I32_CONST
70 # CHECK-NEXT: Value: 66560
71 # CHECK-NEXT: - Type: EXPORT
72 # CHECK-NEXT: Exports:
73 # CHECK-NEXT: - Name: memory
74 # CHECK-NEXT: Kind: MEMORY
75 # CHECK-NEXT: Index: 0
76 # CHECK-NEXT: - Name: _start
77 # CHECK-NEXT: Kind: FUNCTION
78 # CHECK-NEXT: Index: 3
79 # CHECK-NEXT: - Type: CODE
80 # CHECK-NEXT: Functions:
81 # CHECK-NEXT: - Index: 0
82 # CHECK-NEXT: Locals:
83 # CHECK-NEXT: Body: 000B
84 # CHECK-NEXT: - Index: 1
85 # CHECK-NEXT: Locals:
86 # CHECK-NEXT: Body: 4180808080000B
87 # CHECK-NEXT: - Index: 2
88 # CHECK-NEXT: Locals:
89 # CHECK-NEXT: Body: 4180808080000B
90 # CHECK-NEXT: - Index: 3
91 # CHECK-NEXT: Locals:
92 # CHECK-NEXT: Body: 1082808080001A1081808080001A1080808080001A0B
93 # CHECK-NEXT: ...