125 lines · plain
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o2# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-ret32.s -o %t.call.o3# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.main.o4 5# RUN: wasm-ld --export=call_ret32 --export=ret32 -o %t.wasm %t.main.o %t.ret32.o %t.call.o 2>&1 | FileCheck %s -check-prefix=WARN6# RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=YAML7 8# RUN: wasm-ld -r -o %t.reloc.o %t.main.o %t.ret32.o %t.call.o 2>&1 | FileCheck %s -check-prefix=WARN9# RUN: obj2yaml %t.reloc.o | FileCheck %s -check-prefix=RELOC10 11# RUN: rm -f %t.a12# RUN: llvm-ar crS %t.a %t.ret32.o %t.call.o13# RUN: wasm-ld --export=call_ret32 --export=ret32 -o %t2.wasm %t.main.o %t.a 2>&1 | FileCheck %s -check-prefix=ARCHIVE14# RUN: obj2yaml %t2.wasm | FileCheck %s -check-prefix=YAML15 16# RUN: not wasm-ld --fatal-warnings -o %t.wasm %t.main.o %t.ret32.o %t.call.o 2>&1 | FileCheck %s -check-prefix=ERROR17 18.functype ret32 (i32, i64, i32) -> (i32)19 20.hidden _start21.globl _start22_start:23 .functype _start () -> ()24 i32.const 125 i64.const 226 i32.const 327 call ret3228 drop29 i32.const 130 i64.const 231 i32.const 332 i32.const 033 i32.load ret32_address_main34 call_indirect (i32, i64, i32) -> (i32)35 drop36 end_function37 38.section .data,"",@39.globl ret32_address_main40.p2align 241 42ret32_address_main:43 .int32 ret3244.size ret32_address_main, 445 46# WARN: warning: function signature mismatch: ret3247# WARN-NEXT: >>> defined as (i32, i64, i32) -> i32 in {{.*}}.main.o48# WARN-NEXT: >>> defined as (f32) -> i32 in {{.*}}.ret32.o49 50# ARCHIVE: warning: function signature mismatch: ret3251# ARCHIVE-NEXT: >>> defined as (i32, i64, i32) -> i32 in {{.*}}.main.o52# ARCHIVE-NEXT: >>> defined as (f32) -> i32 in {{.*}}.ret32.o53 54# ERROR: error: function signature mismatch: ret3255# ERROR-NEXT: >>> defined as (i32, i64, i32) -> i32 in {{.*}}.main.o56# ERROR-NEXT: >>> defined as (f32) -> i32 in {{.*}}.ret32.o57 58# YAML: - Type: EXPORT59# YAML: - Name: ret3260# YAML-NEXT: Kind: FUNCTION61# YAML-NEXT: Index: 262# YAML-NEXT: - Name: call_ret3263# YAML-NEXT: Kind: FUNCTION64# YAML-NEXT: Index: 365 66# YAML: - Type: CUSTOM67# YAML-NEXT: Name: name68# YAML-NEXT: FunctionNames:69# YAML-NEXT: - Index: 070# YAML-NEXT: Name: 'signature_mismatch:ret32'71# YAML-NEXT: - Index: 172# YAML-NEXT: Name: _start73# YAML-NEXT: - Index: 274# YAML-NEXT: Name: ret3275# YAML-NEXT: - Index: 376# YAML-NEXT: Name: call_ret3277# YAML-NEXT: GlobalNames:78# YAML-NEXT: - Index: 079# YAML-NEXT: Name: __stack_pointer80# YAML-NEXT: DataSegmentNames:81# YAML-NEXT: - Index: 082# YAML-NEXT: Name: .data83# YAML-NEXT: ...84 85# RELOC: Name: linking86# RELOC-NEXT: Version: 287# RELOC-NEXT: SymbolTable:88# RELOC-NEXT: - Index: 089# RELOC-NEXT: Kind: FUNCTION90# RELOC-NEXT: Name: _start91# RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]92# RELOC-NEXT: Function: 193# RELOC-NEXT: - Index: 194# RELOC-NEXT: Kind: FUNCTION95# RELOC-NEXT: Name: ret3296# RELOC-NEXT: Flags: [ ]97# RELOC-NEXT: Function: 298# RELOC-NEXT: - Index: 299# RELOC-NEXT: Kind: DATA100# RELOC-NEXT: Name: ret32_address_main101# RELOC-NEXT: Flags: [ ]102# RELOC-NEXT: Segment: 0103# RELOC-NEXT: Size: 4104# RELOC-NEXT: - Index: 3105# RELOC-NEXT: Kind: TABLE106# RELOC-NEXT: Name: __indirect_function_table107# RELOC-NEXT: Flags: [ UNDEFINED, NO_STRIP ]108# RELOC-NEXT: Table: 0109# RELOC-NEXT: - Index: 4110# RELOC-NEXT: Kind: FUNCTION111# RELOC-NEXT: Name: call_ret32112# RELOC-NEXT: Flags: [ ]113# RELOC-NEXT: Function: 3114# RELOC-NEXT: - Index: 5115# RELOC-NEXT: Kind: DATA116# RELOC-NEXT: Name: ret32_address117# RELOC-NEXT: Flags: [ ]118# RELOC-NEXT: Segment: 1119# RELOC-NEXT: Size: 4120# RELOC-NEXT: - Index: 6121# RELOC-NEXT: Kind: FUNCTION122# RELOC-NEXT: Name: 'signature_mismatch:ret32'123# RELOC-NEXT: Flags: [ BINDING_LOCAL ]124# RELOC-NEXT: Function: 0125