brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 58c2e3c Raw
63 lines · plain
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s2# RUN: wasm-ld --experimental-pic -shared -o %t.wasm %t.o3# RUN: obj2yaml %t.wasm | FileCheck %s4# RUN: llvm-objdump -d %t.wasm | FileCheck %s -check-prefix=ASM5 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 correctly8# demoted to undefined symbols in the final link when they are only weakly9# referenced.10# RUN: mkdir -p %t.dir11# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.ret32.o %p/Inputs/ret32.s12# RUN: rm -f %t.dir/libret32.a13# RUN: llvm-ar cru %t.dir/libret32.a %t.ret32.o14# RUN: wasm-ld --experimental-pic -shared -o %t.ret32.wasm %t.o %t.dir/libret32.a15# RUN: obj2yaml %t.wasm | FileCheck %s16# RUN: llvm-objdump -d %t.wasm | FileCheck %s -check-prefix=ASM17 18# Verify the weak undefined symbols are marked as such in the19# dylink section.20 21.weak weak_func22.functype weak_func () -> (i32)23.weak ret3224.functype ret32 (f32) -> (i32)25 26.globl call_weak27call_weak:28# ASM: <call_weak>:29  .functype call_weak () -> (i32)30  call weak_func31# ASM:           10 80 80 80 80 00      call  032  end_function33# ASM-NEXT:      0b                     end34 35# This function is defined in library archive, but since our reference to it36# is weak we don't expect this definition to be used.  Instead we expect it to37# act like an undefined reference and result in an imported function.38.globl call_weak_libfunc39call_weak_libfunc:40# ASM: <call_weak_libfunc>:41  .functype call_weak_libfunc () -> (i32)42  f32.const 1.043  call ret3244# ASM:           10 81 80 80 80 00 call 145  end_function46# ASM-NEXT:      0b                     end47 48#      CHECK: Sections:49# CHECK-NEXT:   - Type:            CUSTOM50# CHECK-NEXT:     Name:            dylink.051# CHECK-NEXT:     MemorySize:      052# CHECK-NEXT:     MemoryAlignment: 053# CHECK-NEXT:     TableSize:       054# CHECK-NEXT:     TableAlignment:  055# CHECK-NEXT:     Needed:          []56# CHECK-NEXT:     ImportInfo:57# CHECK-NEXT:       - Module:          env58# CHECK-NEXT:         Field:           weak_func59# CHECK-NEXT:         Flags:           [ BINDING_WEAK, UNDEFINED ]60# CHECK-NEXT:       - Module:          env61# CHECK-NEXT:         Field:           ret3262# CHECK-NEXT:         Flags:           [ BINDING_WEAK, UNDEFINED ]63