;;; TOOL: run-wasm-link
;;; FLAGS: --spec
(module
  (export "export1" (func $export1))
  (export "call_import1" (func $call_import1))
  (export "call_import2" (func $call_import2))
  (import "__extern" "export2" (func $import1 (result i32)))
  (import "__extern" "export3" (func $import2 (result i64)))
  (func $export1 (result f32)
    f32.const 1
    return
  )
  (func $call_import1 (result i32)
    call $import1
    return
  )
  (func $call_import2 (result i64)
    call $import2
    return
  )
)
(module
  (export "export2" (func $export2))
  (func $export2 (result i32)
    i32.const 42
    return
  )
)
(module
  (export "export3" (func $export3))
  (func $export3 (result i64)
    i64.const 99
    return
  )
)

(assert_return (invoke "export1") (f32.const 1))
(assert_return (invoke "export2") (i32.const 42))
(assert_return (invoke "export3") (i64.const 99))
(assert_return (invoke "call_import1") (i32.const 42))
(assert_return (invoke "call_import2") (i64.const 99))

(;; STDOUT ;;;

******************************************************************
WARNING: wasm-link is deprecated. Where possible, use lld instead.
******************************************************************

linked.wasm:	file format wasm 0x1

Sections:

     Type start=0x0000000a end=0x0000001f (size=0x00000015) count: 5
   Import start=0x00000025 end=0x00000026 (size=0x00000001) count: 0
 Function start=0x0000002c end=0x00000032 (size=0x00000006) count: 5
   Export start=0x00000038 end=0x00000075 (size=0x0000003d) count: 5
     Code start=0x00000077 end=0x000000a2 (size=0x0000002b) count: 5
   Custom start=0x000000a8 end=0x000000eb (size=0x00000043) "name"

Section Details:

Type:
 - type[0] () -> i32
 - type[1] () -> i64
 - type[2] () -> f32
 - type[3] () -> i32
 - type[4] () -> i64
Import:
Function:
 - func[0] sig=2 <export1>
 - func[1] sig=0 <call_import1>
 - func[2] sig=1 <call_import2>
 - func[3] sig=3 <export2>
 - func[4] sig=4 <export3>
Export:
 - func[0] <export1> -> "export1"
 - func[1] <call_import1> -> "call_import1"
 - func[2] <call_import2> -> "call_import2"
 - func[3] <export2> -> "export2"
 - func[4] <export3> -> "export3"
Custom:
 - name: "name"
 - func[0] export1
 - func[1] call_import1
 - func[2] call_import2
 - func[3] export2
 - func[4] export3

Code Disassembly:

000078 <export1>:
 00007a: 43 00 00 80 3f             | f32.const 0x1p+0
 00007f: 0f                         | return
 000080: 0b                         | end
000081 <call_import1>:
 000083: 10 83 80 80 80 00          | call 3 <export2>
 000089: 0f                         | return
 00008a: 0b                         | end
00008b <call_import2>:
 00008d: 10 84 80 80 80 00          | call 4 <export3>
 000093: 0f                         | return
 000094: 0b                         | end
000095 <export2>:
 000097: 41 2a                      | i32.const 42
 000099: 0f                         | return
 00009a: 0b                         | end
00009b <export3>:
 00009d: 42 e3 00                   | i64.const 99
 0000a0: 0f                         | return
 0000a1: 0b                         | end
5/5 tests passed.
;;; STDOUT ;;)
