xref: /llvm-project/llvm/test/Object/objdump-no-sectionheaders.test (revision 43efb5e445fdd86ab7a0e849b6d70d96d7fafcdc)
1## Check llvm-objdump -h can handle ELF files without section info.
2## Only PT_LOAD segments with the PF_X flag will be displayed as fake sections.
3
4# RUN: yaml2obj %s -o %t
5# RUN: llvm-objdump -h %t | FileCheck %s
6
7# CHECK:      Sections:
8# CHECK-NEXT: Idx Name          Size     VMA              Type
9# CHECK-NEXT:   0 PT_LOAD#1     00000100 0000000000400000 TEXT
10# CHECK-NEXT:   1 PT_LOAD#3     00000200 0000000000600400 TEXT
11# CHECK-NOT:  {{.}}
12
13!ELF
14FileHeader:
15  Class:           ELFCLASS64
16  Data:            ELFDATA2LSB
17  Type:            ET_CORE
18  Machine:         EM_X86_64
19Sections:
20  - Type:            SectionHeaderTable
21    NoHeaders:       true
22  - Type:            Fill
23    Name:            code1
24    Pattern:         "cc"
25    Size:            0x100
26    Offset:          0x200
27  - Type:            Fill
28    Name:            data1
29    Pattern:         "aa55"
30    Size:            0x100
31    Offset:          0x300
32  - Type:            Fill
33    Name:            code2
34    Pattern:         "ff"
35    Size:            0x200
36    Offset:          0x400
37ProgramHeaders:
38  - Type:            PT_PHDR
39    Flags:           [ PF_X ]
40    VAddr:           0x400000
41    MemSize:         0x100
42  - Type:            PT_LOAD
43    Flags:           [ PF_X ]
44    VAddr:           0x400000
45    MemSize:         0x100
46    FirstSec:        code1
47    LastSec:         code1
48  - Type:            PT_LOAD
49    Flags:           [ PF_R ]
50    VAddr:           0x500300
51    MemSize:         0x100
52    FirstSec:        data1
53    LastSec:         data1
54  - Type:            PT_LOAD
55    Flags:           [ PF_R, PF_X ]
56    VAddr:           0x600400
57    MemSize:         0x200
58    FirstSec:        code2
59    LastSec:         code2
60