• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
2
3target triple = "wasm32-unknown-unknown"
4
5; Verify that addresses of external functions generate correctly typed
6; imports and relocations or type R_TABLE_INDEX_I32.
7
8declare void @f0(i32) #0
9@ptr_to_f0 = hidden global void (i32)* @f0, align 4
10
11attributes #0 = { "wasm-import-module"="somewhere" }
12
13declare void @f1(i32) #1
14@ptr_to_f1 = hidden global void (i32)* @f1, align 4
15
16; CHECK:      --- !WASM
17; CHECK-NEXT: FileHeader:
18; CHECK-NEXT:   Version:         0x00000001
19; CHECK-NEXT: Sections:
20; CHECK-NEXT:   - Type:            TYPE
21; CHECK-NEXT:     Signatures:
22; CHECK-NEXT:       - Index:           0
23; CHECK-NEXT:         ReturnType:      NORESULT
24; CHECK-NEXT:         ParamTypes:
25; CHECK-NEXT:           - I32
26; CHECK:        - Type:            IMPORT
27; CHECK-NEXT:     Imports:
28; CHECK:            - Module:          env
29; CHECK-NEXT:         Field:           __linear_memory
30; CHECK:            - Module:          env
31; CHECK-NEXT:         Field:           __indirect_function_table
32; CHECK:            - Module:          somewhere
33; CHECK-NEXT:         Field:           f0
34; CHECK:            - Module:          env
35; CHECK-NEXT:         Field:           f1
36; CHECK-NEXT:         Kind:            FUNCTION
37; CHECK-NEXT:         SigIndex:        0
38; CHECK:        - Type:            ELEM
39; CHECK-NEXT:     Segments:
40; CHECK-NEXT:       - Offset:
41; CHECK-NEXT:           Opcode:          I32_CONST
42; CHECK-NEXT:           Value:           1
43; CHECK-NEXT:         Functions:       [ 0, 1 ]
44; CHECK:        - Type:            DATA
45; CHECK-NEXT:     Relocations:
46; CHECK-NEXT:       - Type:            R_WEBASSEMBLY_TABLE_INDEX_I32
47; CHECK-NEXT:         Index:           1
48; CHECK-NEXT:         Offset:          0x00000006
49