[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL
[llvm-project.git] / lld / test / wasm / shared-weak-symbols.s
blob90de006353b3d32665b05de687edfc683ba7066c
1 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
2 # RUN: wasm-ld --experimental-pic -shared -o %t.wasm %t.o
3 # RUN: obj2yaml %t.wasm | FileCheck %s
4 # RUN: llvm-objdump -d %t.wasm | FileCheck %s -check-prefix=ASM
6 # Verify the weakly defined fuctions (weak_func) are both imported and exported,
7 # and that internal usage (direct call) always uses the imported version.
8 # Hidden functions, even if weak, should not be imported or exported.
10 .globl weak_func
11 .weak weak_func
12 weak_func:
13 .functype weak_func () -> (i32)
14 i32.const 0
15 end_function
17 .globl hidden_weak_func
18 .hidden hidden_weak_func
19 .weak hidden_weak_func
20 hidden_weak_func:
21 .functype hidden_weak_func () -> (i32)
22 i32.const 42
23 end_function
25 .globl call_weak
26 call_weak:
27 # ASM: <call_weak>:
28 .functype call_weak () -> (i32)
29 call weak_func
30 # ASM: 10 80 80 80 80 00 call 0
31 drop
32 call hidden_weak_func
33 # ASM: 10 84 80 80 80 00 call 4
34 end_function
35 # ASM-NEXT: 0b end
37 # CHECK: - Type: IMPORT
38 # CHECK-NEXT: Imports:
39 # CHECK-NEXT: - Module: env
40 # CHECK-NEXT: Field: memory
41 # CHECK-NEXT: Kind: MEMORY
42 # CHECK-NEXT: Memory:
43 # CHECK-NEXT: Minimum: 0x0
44 # CHECK-NEXT: - Module: env
45 # CHECK-NEXT: Field: __memory_base
46 # CHECK-NEXT: Kind: GLOBAL
47 # CHECK-NEXT: GlobalType: I32
48 # CHECK-NEXT: GlobalMutable: false
49 # CHECK-NEXT: - Module: env
50 # CHECK-NEXT: Field: __table_base
51 # CHECK-NEXT: Kind: GLOBAL
52 # CHECK-NEXT: GlobalType: I32
53 # CHECK-NEXT: GlobalMutable: false
54 # CHECK-NEXT: - Module: env
55 # CHECK-NEXT: Field: weak_func
56 # CHECK-NEXT: Kind: FUNCTION
57 # CHECK-NEXT: SigIndex: 0
58 # CHECK-NEXT: - Type: FUNCTION
60 # CHECK: - Type: EXPORT
61 # CHECK-NEXT: Exports:
62 # CHECK-NEXT: - Name: __wasm_call_ctors
63 # CHECK-NEXT: Kind: FUNCTION
64 # CHECK-NEXT: Index: 1
65 # CHECK-NEXT: - Name: __wasm_apply_data_relocs
66 # CHECK-NEXT: Kind: FUNCTION
67 # CHECK-NEXT: Index: 2
68 # CHECK-NEXT: - Name: weak_func
69 # CHECK-NEXT: Kind: FUNCTION
70 # CHECK-NEXT: Index: 3
71 # CHECK-NEXT: - Name: call_weak
72 # CHECK-NEXT: Kind: FUNCTION
73 # CHECK-NEXT: Index: 5
74 # CHECK-NEXT: - Type: CODE
76 # CHECK: - Type: CUSTOM
77 # CHECK-NEXT: Name: name
78 # CHECK-NEXT: FunctionNames:
79 # CHECK-NEXT: - Index: 0
80 # CHECK-NEXT: Name: weak_func
81 # CHECK-NEXT: - Index: 1
82 # CHECK-NEXT: Name: __wasm_call_ctors
83 # CHECK-NEXT: - Index: 2
84 # CHECK-NEXT: Name: __wasm_apply_data_relocs
85 # CHECK-NEXT: - Index: 3
86 # CHECK-NEXT: Name: weak_func
87 # CHECK-NEXT: - Index: 4
88 # CHECK-NEXT: Name: hidden_weak_func
89 # CHECK-NEXT: - Index: 5
90 # CHECK-NEXT: Name: call_weak