[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL
[llvm-project.git] / lld / test / wasm / shared-weak-undefined.s
blobcb3e29b5a9b7bb686361db17e8f581a74902ef94
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 # Run the same test but include a definition of ret32 in a library file.
7 # This verifies that LazySymbols (those found in library archives) are correctly
8 # demoted to undefined symbols in the final link when they are only weakly
9 # referenced.
10 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.ret32.o %p/Inputs/ret32.s
11 # RUN: rm -f %T/libret32.a
12 # RUN: llvm-ar cru %T/libret32.a %t.ret32.o
13 # RUN: wasm-ld --experimental-pic -shared -o %t.ret32.wasm %t.o %T/libret32.a
14 # RUN: obj2yaml %t.wasm | FileCheck %s
15 # RUN: llvm-objdump -d %t.wasm | FileCheck %s -check-prefix=ASM
17 # Verify the weak undefined symbols are marked as such in the
18 # dylink section.
20 .weak weak_func
21 .functype weak_func () -> (i32)
22 .weak ret32
23 .functype ret32 (f32) -> (i32)
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 end_function
32 # ASM-NEXT: 0b end
34 # This function is defined in library archive, but since our reference to it
35 # is weak we don't expect this definition to be used. Instead we expect it to
36 # act like an undefined reference and result in an imported function.
37 .globl call_weak_libfunc
38 call_weak_libfunc:
39 # ASM: <call_weak_libfunc>:
40 .functype call_weak_libfunc () -> (i32)
41 f32.const 1.0
42 call ret32
43 # ASM: 10 81 80 80 80 00 call 1
44 end_function
45 # ASM-NEXT: 0b end
47 # CHECK: Sections:
48 # CHECK-NEXT: - Type: CUSTOM
49 # CHECK-NEXT: Name: dylink.0
50 # CHECK-NEXT: MemorySize: 0
51 # CHECK-NEXT: MemoryAlignment: 0
52 # CHECK-NEXT: TableSize: 0
53 # CHECK-NEXT: TableAlignment: 0
54 # CHECK-NEXT: Needed: []
55 # CHECK-NEXT: ImportInfo:
56 # CHECK-NEXT: - Module: env
57 # CHECK-NEXT: Field: weak_func
58 # CHECK-NEXT: Flags: [ BINDING_WEAK, UNDEFINED ]
59 # CHECK-NEXT: - Module: env
60 # CHECK-NEXT: Field: ret32
61 # CHECK-NEXT: Flags: [ BINDING_WEAK, UNDEFINED ]