;;; TOOL: run-wasm-link
;;; FLAGS: -r
(module
  (import "__extern" "bar" (global i32))
  (global i32 (i32.const 1))
  (global i32 (i32.const 2))
  (func (param i32)
     get_global 2
     get_global 1
     i32.add
     get_global 0
     i32.add
     call 0)
)
(module
  (import "__extern" "baz" (global i64))
  (global i64 (i64.const 2))
  (func (param i64) (param i64)
     get_global 0
     get_global 1
     call 0)
)
(;; STDOUT ;;;

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

linked.wasm:	file format wasm 0x1

Sections:

     Type start=0x0000000a end=0x00000014 (size=0x0000000a) count: 2
   Import start=0x0000001a end=0x0000003b (size=0x00000021) count: 2
 Function start=0x00000041 end=0x00000044 (size=0x00000003) count: 2
   Global start=0x00000046 end=0x00000056 (size=0x00000010) count: 3
     Code start=0x00000058 end=0x0000008b (size=0x00000033) count: 2
   Custom start=0x00000091 end=0x00000099 (size=0x00000008) "linking"
   Custom start=0x0000009f end=0x000000c1 (size=0x00000022) "reloc.Code"

Section Details:

Type:
 - type[0] (i32) -> nil
 - type[1] (i64, i64) -> nil
Import:
 - global[0] i32 mutable=0 <- __extern.bar
 - global[1] i64 mutable=0 <- __extern.baz
Function:
 - func[0] sig=0
 - func[1] sig=1
Global:
 - global[2] i32 mutable=0 - init i32=1
 - global[3] i32 mutable=0 - init i32=2
 - global[4] i64 mutable=0 - init i64=2
Custom:
 - name: "linking"
Custom:
 - name: "reloc.Code"
  - section: Code
   - R_WEBASSEMBLY_GLOBAL_INDEX_LEB offset=0x000004(file=0x00005c) index=3
   - R_WEBASSEMBLY_GLOBAL_INDEX_LEB offset=0x00000a(file=0x000062) index=2
   - R_WEBASSEMBLY_GLOBAL_INDEX_LEB offset=0x000011(file=0x000069) index=0
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x000018(file=0x000070) index=0
   - R_WEBASSEMBLY_GLOBAL_INDEX_LEB offset=0x000021(file=0x000079) index=1
   - R_WEBASSEMBLY_GLOBAL_INDEX_LEB offset=0x000027(file=0x00007f) index=4
   - R_WEBASSEMBLY_FUNCTION_INDEX_LEB offset=0x00002d(file=0x000085) index=1

Code Disassembly:

000059 func[0]:
 00005b: 23 83 80 80 80 00          | get_global 3
           00005c: R_WEBASSEMBLY_GLOBAL_INDEX_LEB 3
 000061: 23 82 80 80 80 00          | get_global 2
           000062: R_WEBASSEMBLY_GLOBAL_INDEX_LEB 2
 000067: 6a                         | i32.add
 000068: 23 80 80 80 80 00          | get_global 0
           000069: R_WEBASSEMBLY_GLOBAL_INDEX_LEB 0
 00006e: 6a                         | i32.add
 00006f: 10 80 80 80 80 00          | call 0
           000070: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 0
 000075: 0b                         | end
000076 func[1]:
 000078: 23 81 80 80 80 00          | get_global 1
           000079: R_WEBASSEMBLY_GLOBAL_INDEX_LEB 1
 00007e: 23 84 80 80 80 00          | get_global 4
           00007f: R_WEBASSEMBLY_GLOBAL_INDEX_LEB 4
 000084: 10 81 80 80 80 00          | call 1
           000085: R_WEBASSEMBLY_FUNCTION_INDEX_LEB 1
 00008a: 0b                         | end
;;; STDOUT ;;)
