brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · b632588 Raw
92 lines · yaml
1## Test that obj2yaml output includes the section header size encoding length2## only when the length isn't padded to 5 bytes.3# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s4 5--- !WASM6FileHeader:7  Version:         0x18Sections:9  - Type:            TYPE10    HeaderSecSizeEncodingLen:   311    Signatures:12      - Index:           013        ParamTypes:14          - I3215          - I3216        ReturnTypes:17          - I3218  - Type:            FUNCTION19    HeaderSecSizeEncodingLen:  420    FunctionTypes:             [ 0 ]21  - Type:            MEMORY22    HeaderSecSizeEncodingLen:  123    Memories:24      - Flags:           [ HAS_MAX ]25        Minimum:         0x10026        Maximum:         0x10027  - Type:            EXPORT28    HeaderSecSizeEncodingLen:  529    Exports:30      - Name:            add31        Kind:            FUNCTION32        Index:           033  - Type:            CODE34    HeaderSecSizeEncodingLen:  235    Functions:36      - Index:           037        Locals:          []38        Body:            200020016A0B39...40# CHECK: --- !WASM41# CHECK-NEXT: FileHeader:42# CHECK-NEXT:   Version:         0x143# CHECK-NEXT: Sections:44# CHECK-NEXT:   - Type:            TYPE45# CHECK-NEXT:     HeaderSecSizeEncodingLen:   346# CHECK-NEXT:     Signatures:47# CHECK-NEXT:       - Index:           048# CHECK-NEXT:         ParamTypes:49# CHECK-NEXT:           - I3250# CHECK-NEXT:           - I3251# CHECK-NEXT:         ReturnTypes:52# CHECK-NEXT:           - I3253# CHECK-NEXT:   - Type:            FUNCTION54# CHECK-NEXT:     HeaderSecSizeEncodingLen:  455# CHECK-NEXT:     FunctionTypes:             [ 0 ]56# CHECK-NEXT:   - Type:            MEMORY57# CHECK-NEXT:     Memories:58# CHECK-NEXT:       - Flags:           [ HAS_MAX ]59# CHECK-NEXT:         Minimum:         0x10060# CHECK-NEXT:         Maximum:         0x10061# CHECK-NEXT:   - Type:            EXPORT62# CHECK-NEXT:     Exports:63# CHECK-NEXT:       - Name:            add64# CHECK-NEXT:         Kind:            FUNCTION65# CHECK-NEXT:         Index:           066# CHECK-NEXT:   - Type:            CODE67# CHECK-NEXT:     HeaderSecSizeEncodingLen:  268# CHECK-NEXT:     Functions:69# CHECK-NEXT:       - Index:           070# CHECK-NEXT:         Locals:          []71# CHECK-NEXT:         Body:            200020016A0B72 73## Test if we correctly error out if the provided section header size is less74## than the size required.75# RUN: not yaml2obj --docnum=2 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=INVALID76# INVALID: yaml2obj: error: section header length can't be encoded in a LEB of size 077 78--- !WASM79FileHeader:80  Version:         0x181Sections:82  - Type:            TYPE83    HeaderSecSizeEncodingLen:   084    Signatures:85      - Index:           086        ParamTypes:87          - I3288          - I3289        ReturnTypes:90          - I3291...92