xref: /llvm-project/llvm/test/tools/llvm-readobj/XCOFF/sections.test (revision 26db845536aa4ada6231873a01252c75637fcbae)
181441cf4SEsme-Yi## This is a general test for the --section-headers option.
20dc5e0cdSjasonliu
381441cf4SEsme-Yi# RUN: yaml2obj %s -o %t1
481441cf4SEsme-Yi# RUN: llvm-readobj --section-headers %t1 | \
5*26db8455Sstephenpeckham# RUN:   FileCheck --strict-whitespace --match-full-lines --check-prefixes=SEC,SEC32 %s
6*26db8455Sstephenpeckham
7*26db8455Sstephenpeckham# RUN: yaml2obj -DMAGIC=0x01F7 %s -o %t2
8*26db8455Sstephenpeckham# RUN: llvm-readobj --section-headers %t2 | \
9*26db8455Sstephenpeckham# RUN:   FileCheck --strict-whitespace --match-full-lines --check-prefixes=SEC,SEC64 %s
100dc5e0cdSjasonliu
1181441cf4SEsme-Yi#      SEC32:Format: aixcoff-rs6000
12*26db8455Sstephenpeckham#      SEC64:Format: aix5coff64-rs6000
130dc5e0cdSjasonliu# SEC32-NEXT:Arch: powerpc
14*26db8455Sstephenpeckham# SEC64-NEXT:Arch: powerpc64
150dc5e0cdSjasonliu# SEC32-NEXT:AddressSize: 32bit
16*26db8455Sstephenpeckham# SEC64-NEXT:AddressSize: 64bit
17*26db8455Sstephenpeckham#   SEC-NEXT:Sections [
18*26db8455Sstephenpeckham#   SEC-NEXT:  Section {
19*26db8455Sstephenpeckham#   SEC-NEXT:    Index: 1
20*26db8455Sstephenpeckham#   SEC-NEXT:    Name: .text
21*26db8455Sstephenpeckham#   SEC-NEXT:    PhysicalAddress: 0x0
22*26db8455Sstephenpeckham#   SEC-NEXT:    VirtualAddress: 0x0
23*26db8455Sstephenpeckham#   SEC-NEXT:    Size: 0x2
24*26db8455Sstephenpeckham# SEC32-NEXT:    RawDataOffset: 0xB4
25*26db8455Sstephenpeckham# SEC64-NEXT:    RawDataOffset: 0x138
26*26db8455Sstephenpeckham#   SEC-NEXT:    RelocationPointer: 0x0
27*26db8455Sstephenpeckham#   SEC-NEXT:    LineNumberPointer: 0x0
28*26db8455Sstephenpeckham#   SEC-NEXT:    NumberOfRelocations: 0
29*26db8455Sstephenpeckham#   SEC-NEXT:    NumberOfLineNumbers: 0
30*26db8455Sstephenpeckham#   SEC-NEXT:    Type: STYP_TEXT (0x20)
31*26db8455Sstephenpeckham#   SEC-NEXT:  }
32*26db8455Sstephenpeckham#   SEC-NEXT:  Section {
33*26db8455Sstephenpeckham#   SEC-NEXT:    Index: 2
34*26db8455Sstephenpeckham#   SEC-NEXT:    Name: .data
35*26db8455Sstephenpeckham#   SEC-NEXT:    PhysicalAddress: 0x0
36*26db8455Sstephenpeckham#   SEC-NEXT:    VirtualAddress: 0x0
37*26db8455Sstephenpeckham#   SEC-NEXT:    Size: 0x2
38*26db8455Sstephenpeckham# SEC32-NEXT:    RawDataOffset: 0xB8
39*26db8455Sstephenpeckham# SEC64-NEXT:    RawDataOffset: 0x13C
40*26db8455Sstephenpeckham# SEC32-NEXT:    RelocationPointer: 0xC4
41*26db8455Sstephenpeckham# SEC64-NEXT:    RelocationPointer: 0x148
42*26db8455Sstephenpeckham#   SEC-NEXT:    LineNumberPointer: 0x0
43*26db8455Sstephenpeckham#   SEC-NEXT:    NumberOfRelocations: 1
44*26db8455Sstephenpeckham#   SEC-NEXT:    NumberOfLineNumbers: 0
45*26db8455Sstephenpeckham#   SEC-NEXT:    Type: STYP_DATA (0x40)
46*26db8455Sstephenpeckham#   SEC-NEXT:  }
47*26db8455Sstephenpeckham#   SEC-NEXT:  Section {
48*26db8455Sstephenpeckham#   SEC-NEXT:    Index: 3
49*26db8455Sstephenpeckham#   SEC-NEXT:    Name: .dwabrev
50*26db8455Sstephenpeckham#        SEC:    Type: STYP_DWARF (0x10)
51*26db8455Sstephenpeckham#   SEC-NEXT:    DWARFSubType: SSUBTYP_DWABREV (0x60000)
52*26db8455Sstephenpeckham#   SEC-NEXT:  }
53*26db8455Sstephenpeckham#   SEC-NEXT:  Section {
54*26db8455Sstephenpeckham#   SEC-NEXT:    Index: 4
55*26db8455Sstephenpeckham#   SEC-NEXT:    Name: .dwinfo
56*26db8455Sstephenpeckham#        SEC:    Type: STYP_DWARF (0x10)
57*26db8455Sstephenpeckham#   SEC-NEXT:    DWARFSubType: SSUBTYP_DWINFO (0x10000)
58*26db8455Sstephenpeckham#   SEC-NEXT:  }
59*26db8455Sstephenpeckham#   SEC-NEXT:]
600dc5e0cdSjasonliu
6181441cf4SEsme-Yi--- !XCOFF
6281441cf4SEsme-YiFileHeader:
6381441cf4SEsme-Yi  MagicNumber: [[MAGIC=0x1DF]]
6481441cf4SEsme-YiSections:
6581441cf4SEsme-Yi  - Name:        .text
6681441cf4SEsme-Yi    Flags:       [ STYP_TEXT ]
6781441cf4SEsme-Yi    SectionData: "1234"
6881441cf4SEsme-Yi  - Name:        .data
6981441cf4SEsme-Yi    Flags:       [ STYP_DATA ]
7081441cf4SEsme-Yi    SectionData: "5678"
7181441cf4SEsme-Yi    Relocations:
7281441cf4SEsme-Yi      - Address: 0x80
7381441cf4SEsme-Yi        Symbol:  0x21
7481441cf4SEsme-Yi        Info:    0x1F
7581441cf4SEsme-Yi        Type:    0x0
76*26db8455Sstephenpeckham  - Name:            .dwabrev
77*26db8455Sstephenpeckham    Address:         0x0
78*26db8455Sstephenpeckham    Size:            0x4
79*26db8455Sstephenpeckham    Flags:           [ STYP_DWARF ]
80*26db8455Sstephenpeckham    DWARFSectionSubtype: SSUBTYP_DWABREV
81*26db8455Sstephenpeckham    SectionData:     01110125
82*26db8455Sstephenpeckham  - Name:            .dwinfo
83*26db8455Sstephenpeckham    Address:         0x0
84*26db8455Sstephenpeckham    Size:            0x4
85*26db8455Sstephenpeckham    Flags:           [ STYP_DWARF ]
86*26db8455Sstephenpeckham    DWARFSectionSubtype: SSUBTYP_DWINFO
87*26db8455Sstephenpeckham    SectionData:     00000080
88