xref: /llvm-project/llvm/test/tools/llvm-readobj/XCOFF/sections.test (revision 26db845536aa4ada6231873a01252c75637fcbae)
1## This is a general test for the --section-headers option.
2
3# RUN: yaml2obj %s -o %t1
4# RUN: llvm-readobj --section-headers %t1 | \
5# RUN:   FileCheck --strict-whitespace --match-full-lines --check-prefixes=SEC,SEC32 %s
6
7# RUN: yaml2obj -DMAGIC=0x01F7 %s -o %t2
8# RUN: llvm-readobj --section-headers %t2 | \
9# RUN:   FileCheck --strict-whitespace --match-full-lines --check-prefixes=SEC,SEC64 %s
10
11#      SEC32:Format: aixcoff-rs6000
12#      SEC64:Format: aix5coff64-rs6000
13# SEC32-NEXT:Arch: powerpc
14# SEC64-NEXT:Arch: powerpc64
15# SEC32-NEXT:AddressSize: 32bit
16# SEC64-NEXT:AddressSize: 64bit
17#   SEC-NEXT:Sections [
18#   SEC-NEXT:  Section {
19#   SEC-NEXT:    Index: 1
20#   SEC-NEXT:    Name: .text
21#   SEC-NEXT:    PhysicalAddress: 0x0
22#   SEC-NEXT:    VirtualAddress: 0x0
23#   SEC-NEXT:    Size: 0x2
24# SEC32-NEXT:    RawDataOffset: 0xB4
25# SEC64-NEXT:    RawDataOffset: 0x138
26#   SEC-NEXT:    RelocationPointer: 0x0
27#   SEC-NEXT:    LineNumberPointer: 0x0
28#   SEC-NEXT:    NumberOfRelocations: 0
29#   SEC-NEXT:    NumberOfLineNumbers: 0
30#   SEC-NEXT:    Type: STYP_TEXT (0x20)
31#   SEC-NEXT:  }
32#   SEC-NEXT:  Section {
33#   SEC-NEXT:    Index: 2
34#   SEC-NEXT:    Name: .data
35#   SEC-NEXT:    PhysicalAddress: 0x0
36#   SEC-NEXT:    VirtualAddress: 0x0
37#   SEC-NEXT:    Size: 0x2
38# SEC32-NEXT:    RawDataOffset: 0xB8
39# SEC64-NEXT:    RawDataOffset: 0x13C
40# SEC32-NEXT:    RelocationPointer: 0xC4
41# SEC64-NEXT:    RelocationPointer: 0x148
42#   SEC-NEXT:    LineNumberPointer: 0x0
43#   SEC-NEXT:    NumberOfRelocations: 1
44#   SEC-NEXT:    NumberOfLineNumbers: 0
45#   SEC-NEXT:    Type: STYP_DATA (0x40)
46#   SEC-NEXT:  }
47#   SEC-NEXT:  Section {
48#   SEC-NEXT:    Index: 3
49#   SEC-NEXT:    Name: .dwabrev
50#        SEC:    Type: STYP_DWARF (0x10)
51#   SEC-NEXT:    DWARFSubType: SSUBTYP_DWABREV (0x60000)
52#   SEC-NEXT:  }
53#   SEC-NEXT:  Section {
54#   SEC-NEXT:    Index: 4
55#   SEC-NEXT:    Name: .dwinfo
56#        SEC:    Type: STYP_DWARF (0x10)
57#   SEC-NEXT:    DWARFSubType: SSUBTYP_DWINFO (0x10000)
58#   SEC-NEXT:  }
59#   SEC-NEXT:]
60
61--- !XCOFF
62FileHeader:
63  MagicNumber: [[MAGIC=0x1DF]]
64Sections:
65  - Name:        .text
66    Flags:       [ STYP_TEXT ]
67    SectionData: "1234"
68  - Name:        .data
69    Flags:       [ STYP_DATA ]
70    SectionData: "5678"
71    Relocations:
72      - Address: 0x80
73        Symbol:  0x21
74        Info:    0x1F
75        Type:    0x0
76  - Name:            .dwabrev
77    Address:         0x0
78    Size:            0x4
79    Flags:           [ STYP_DWARF ]
80    DWARFSectionSubtype: SSUBTYP_DWABREV
81    SectionData:     01110125
82  - Name:            .dwinfo
83    Address:         0x0
84    Size:            0x4
85    Flags:           [ STYP_DWARF ]
86    DWARFSectionSubtype: SSUBTYP_DWINFO
87    SectionData:     00000080
88