brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 40e1593 Raw
44 lines · plain
1# RUN: split-file %s %t2# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t_main.o %t/main.s3# RUN: llvm-as %S/Inputs/foo.ll -o %t_foo.o4# RUN: llvm-as %S/Inputs/libcall.ll -o %t_libcall.o5# RUN: wasm-ld -mllvm -mattr=-bulk-memory,-bulk-memory-opt %t_main.o %t_libcall.o %t_foo.o %p/Inputs/stub.so -o %t.wasm6# RUN: obj2yaml %t.wasm | FileCheck %s7 8# The function `func_with_libcall` will generate an undefined reference to9# `memcpy` at LTO time.  `memcpy` itself also declared in stub.so and depends10# on `foo`11 12# If %t_foo.o is not included in the link we get an undefined symbol reported13# to the dependency of memcpy on the foo export:14 15# RUN: not wasm-ld -mllvm -mattr=-bulk-memory,-bulk-memory-opt %t_main.o %t_libcall.o %p/Inputs/stub.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING %s16# MISSING: stub.so: undefined symbol: foo. Required by memcpy17 18#--- main.s19.functype func_with_libcall (i32, i32) -> ()20.globl _start21_start:22    .functype _start () -> ()23    i32.const 024    i32.const 025    call func_with_libcall26    end_function27 28# CHECK:         Imports:29# CHECK-NEXT:      - Module:          env30# CHECK-NEXT:        Field:           memcpy31# CHECK-NEXT:        Kind:            FUNCTION32# CHECK-NEXT:        SigIndex:        033 34# CHECK:         Exports:35# CHECK-NEXT:       - Name:            memory36# CHECK-NEXT:         Kind:            MEMORY37# CHECK-NEXT:         Index:           038# CHECK-NEXT:       - Name:            _start39# CHECK-NEXT:         Kind:            FUNCTION40# CHECK-NEXT:         Index:           141# CHECK-NEXT:       - Name:            foo42# CHECK-NEXT:         Kind:            FUNCTION43# CHECK-NEXT:         Index:           344