xref: /llvm-project/llvm/test/tools/yaml2obj/XCOFF/offset-check.yaml (revision b5abaea3c0de605c8145035b21a5ee492883ebd7)
1## Report errors when specified file offsets are invalid.
2
3# RUN: not yaml2obj %s -DTEXTRAWDATAOFFSET=0xFFFFFFF0 -o %t 2>&1 | \
4# RUN:   FileCheck %s --check-prefix=ERROR1
5# ERROR1: current file offset (4294967288) is bigger than the specified FileOffsetToData for the .data section (108)
6
7# RUN: not yaml2obj %s -DDATARAWDATAOFFSET=0xFFFFFFF0 -o %t 2>&1 | \
8# RUN:   FileCheck %s --check-prefix=ERROR2
9# ERROR2: current file offset (4294967284) is bigger than the specified FileOffsetToRelocations for the .text section (112)
10
11# RUN: not yaml2obj %s -DRELOCOFFSET=0xFFFFFFF0 -o %t 2>&1 | \
12# RUN:   FileCheck %s --check-prefix=ERROR3
13# ERROR3: current file offset (4294967290) is bigger than the specified SymbolTableOffset (122)
14
15# RUN: not yaml2obj %s -DSYMTABOFFSET=0x100000000 -o %t 2>&1 | \
16# RUN:   FileCheck %s --check-prefix=ERROR4
17# ERROR4: maximum object size of 4294967295 exceeded when writing symbols
18
19# RUN: not yaml2obj %s -DRELOCOFFSET=0x100000000 -o %t 2>&1 | \
20# RUN:   FileCheck %s --check-prefix=ERROR5
21# ERROR5: maximum object size (4294967295) exceeded when writing relocation data for section .text
22
23# RUN: not yaml2obj %s -DDATARAWDATAOFFSET=0x100000000 -o %t 2>&1 | \
24# RUN:   FileCheck %s --check-prefix=ERROR6
25# ERROR6: maximum object size (4294967295) exceeded when writing data for section 2 (.data)
26
27--- !XCOFF
28FileHeader:
29  MagicNumber:     0x1DF
30  NumberOfSections: 2
31  OffsetToSymbolTable: [[SYMTABOFFSET=0x7A]]
32  EntriesInSymbolTable: 6
33  AuxiliaryHeaderSize: 0
34  Flags:           0x0
35Sections:
36  - Name:            .text
37    Address:         0x0
38    Size:            0x8
39    FileOffsetToData: [[TEXTRAWDATAOFFSET=0x64]]
40    FileOffsetToRelocations: [[RELOCOFFSET=0x70]]
41    NumberOfRelocations: 0x1
42    Flags:           [ STYP_TEXT ]
43    SectionData:     386000004BFFFFFC
44    Relocations:
45      - Address:         0x4
46        Symbol:          0x2
47        Info:            0x99
48        Type:            0x1A
49  - Name:            .data
50    Address:         0x0
51    Size:            0x4
52    FileOffsetToData: [[DATARAWDATAOFFSET=0x6C]]
53    FileOffsetToRelocations: 0
54    Flags:           [ STYP_DATA ]
55    SectionData:     3210ABCD
56Symbols:
57  - Name:            .bar
58    Value:           0x0
59    Section:         N_UNDEF
60    Type:            0x0
61    StorageClass:    C_EXT
62    NumberOfAuxEntries: 1
63    AuxEntries:
64      - Type:            AUX_CSECT
65        SymbolAlignmentAndType: 0
66        StorageMappingClass: XMC_PR
67        SectionOrLength: 0
68  - Name:            ''
69    Value:           0x0
70    Section:         .text
71    Type:            0x0
72    StorageClass:    C_HIDEXT
73    NumberOfAuxEntries: 1
74    AuxEntries:
75      - Type:            AUX_CSECT
76        SymbolAlignmentAndType: 17
77        StorageMappingClass: XMC_PR
78        SectionOrLength: 8
79  - Name:            .foo
80    Value:           0x0
81    Section:         .text
82    Type:            0x0
83    StorageClass:    C_EXT
84    NumberOfAuxEntries: 1
85    AuxEntries:
86      - Type:            AUX_CSECT
87        SymbolAlignmentAndType: 2
88        StorageMappingClass: XMC_PR
89        SectionOrLength: 2
90StringTable:     {}
91...
92