xref: /llvm-project-15.0.7/lld/test/wasm/duplicate-function-imports.s (revision 1d445a6e)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o
2# RUN: wasm-ld -o %t1.wasm %t.o
3# RUN: obj2yaml %t1.wasm | FileCheck %s
4
5.globl f1
6.import_module f1, env
7.import_name f1, f
8.functype f1 () -> (i32)
9
10# Same import module/name/type as `f1`, should be de-duped.
11.globl f2
12.import_module f2, env
13.import_name f2, f
14.functype f2 () -> (i32)
15
16# Same import module/name, but different type. Should not be de-duped.
17.globl f3
18.import_module f3, env
19.import_name f3, f
20.functype f3 () -> (f32)
21
22.globl _start
23_start:
24  .functype _start () -> ()
25  call f1
26  drop
27  call f2
28  drop
29  call f3
30  drop
31  end_function
32
33
34# CHECK:        - Type:            TYPE
35# CHECK-NEXT:     Signatures:
36# CHECK-NEXT:       - Index:           0
37# CHECK-NEXT:         ParamTypes:      []
38# CHECK-NEXT:         ReturnTypes:
39# CHECK-NEXT:           - I32
40# CHECK-NEXT:       - Index:           1
41# CHECK-NEXT:         ParamTypes:      []
42# CHECK-NEXT:         ReturnTypes:
43# CHECK-NEXT:           - F32
44# CHECK-NEXT:       - Index:           2
45# CHECK-NEXT:         ParamTypes:      []
46# CHECK-NEXT:         ReturnTypes:     []
47# CHECK-NEXT:   - Type:            IMPORT
48# CHECK-NEXT:     Imports:
49# CHECK-NEXT:       - Module:          env
50# CHECK-NEXT:         Field:           f
51# CHECK-NEXT:         Kind:            FUNCTION
52# CHECK-NEXT:         SigIndex:        0
53# CHECK-NEXT:       - Module:          env
54# CHECK-NEXT:         Field:           f
55# CHECK-NEXT:         Kind:            FUNCTION
56# CHECK-NEXT:         SigIndex:        1
57# CHECK-NEXT:   - Type:
58

served by {OpenGrok

Last Index Update: Fri May 15 20:09:11 GMT 2026