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
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
21 .functype weak_func () -> (i32)
23 .functype ret32 (f32) -> (i32)
28 .functype call_weak () -> (i32)
30 # ASM: 10 80 80 80 80 00 call 0
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
39 # ASM: <call_weak_libfunc>:
40 .functype call_weak_libfunc () -> (i32)
43 # ASM: 10 81 80 80 80 00 call 1
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 ]