xref: /llvm-project/llvm/test/Object/Wasm/bad-relocation.yaml (revision 0d96422768908a8235f05a5d3b1d43ecc6038004)
1# RUN: yaml2obj %s | not llvm-objdump -s - 2>&1 | FileCheck %s
2
3# Check for invalid relocations.  In this case we have a relocations of type
4# R_WASM_FUNCTION_INDEX_LEB against a symbol (foo) which is not a function
5# symbol but a data symbol.
6
7# CHECK: invalid function relocation: foo
8
9--- !WASM
10FileHeader:
11  Version:         0x00000001
12Sections:
13  - Type:            DATA
14    Segments:
15      - SectionOffset:   0
16        InitFlags:       0
17        Offset:
18          Opcode:          I32_CONST
19          Value:           0
20        Content:         '6401020304'
21    Relocations:
22      - Type:            R_WASM_FUNCTION_INDEX_LEB
23        Index:           0
24        Offset:          0x00000000
25  - Type:            CUSTOM
26    Name:            linking
27    Version:         2
28    SymbolTable:
29      - Index:           0
30        Kind:            DATA
31        Name:            foo
32        Flags:           [ ]
33        Segment:         0
34        Offset:          0
35        Size:            1
36