;;; TOOL: run-wasm-link
;;; FLAGS: -r
(module
  (import "__extern" "foo" (func $import0 (param i32) (result i32)))
  (import "__extern" "bar" (func $import1 (param i32) (result i32)))
  (func $local_func (param i32)
     get_local 0
     call $local_func
     call $import0
     call $import1)
)
(module
  (import "__extern" "baz" (func $m2_import0 (param f64)))
  (export "foo" (func $m2_local_func))
  (func $m2_local_func (param i64)
     f64.const 1
     call $m2_import0
     i64.const 10
     call $m2_local_func)
)
(;; STDOUT ;;;

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

linked.wasm:	file format wasm 0x1

Sections:

     Type start=0x0000000a end=0x0000001c (size=0x00000012) count: 4
   Import start=0x00000022 end=0x00000041 (size=0x0000001f) count: 2
 Function start=0x00000047 end=0x0000004a (size=0x00000003) count: 2
   Export start=0x00000050 end=0x00000057 (size=0x00000007) count: 1
     Code start=0x00000059 end=0x0000008b (size=0x00000032) count: 2
   Custom start=0x00000091 end=0x000000cd (size=0x0000003c) "name"
   Custom start=0x000000d3 end=0x000000db (size=0x00000008) "linking"
   Custom start=0x000000e1 end=0x000000fd (size=0x0000001c) "reloc.Code"

Section Details:

Type:
 - type[0] (i32) -> i32
 - type[1] (i32) -> nil
 - type[2] (f64) -> nil
 - type[3] (i64) -> nil
Import:
 - func[0] sig=0 <import1> <- __extern.bar
 - func[1] sig=2 <m2_import0> <- __extern.baz
Function:
 - func[2] sig=1 <local_func>
 - func[3] sig=3 <m2_local_func>
Export:
 - func[3] <m2_local_func> -> "foo"
Custom:
 - name: "name"
 - func[0] import1
 - func[1] m2_import0
 - func[2] local_func
 - func[3] m2_local_func
Custom:
 - name: "linking"
Custom:
 - name: "reloc.Code"
  - section: Code
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x000006(file=0x00005f) index=2
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x00000c(file=0x000065) index=3
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x000012(file=0x00006b) index=0
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x000024(file=0x00007d) index=1
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x00002c(file=0x000085) index=3

Code Disassembly:

00005a <local_func>:
 00005c: 20 00                      | get_local 0
 00005e: 10 82 80 80 80 00          | call 2 <local_func>
           00005f: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 2 <local_func>
 000064: 10 83 80 80 80 00          | call 3 <m2_local_func>
           000065: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 3 <m2_local_func>
 00006a: 10 80 80 80 80 00          | call 0 <import1>
           00006b: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 0 <import1>
 000070: 0b                         | end
000071 <m2_local_func>:
 000073: 44 00 00 00 00 00 00 f0 3f | f64.const 0x1p+0
 00007c: 10 81 80 80 80 00          | call 1 <m2_import0>
           00007d: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 1 <m2_import0>
 000082: 42 0a                      | i64.const 10
 000084: 10 83 80 80 80 00          | call 3 <m2_local_func>
           000085: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 3 <m2_local_func>
 00008a: 0b                         | end
;;; STDOUT ;;)
