• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This test tests that if two possible parent segments have the same offset that
2# they're disambiguated based on their original index. This ensures that cycles
3# do not occur.
4
5# RUN: yaml2obj %s -o %t
6# RUN: llvm-objcopy %t %t2
7# RUN: llvm-readobj --program-headers %t2 | FileCheck %s
8
9!ELF
10FileHeader:
11  Class:           ELFCLASS64
12  Data:            ELFDATA2LSB
13  Type:            ET_EXEC
14  Machine:         EM_X86_64
15Sections:
16  - Name:            .text
17    Type:            SHT_PROGBITS
18    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
19    AddressAlign:    0x1000
20    Size:            4096
21  - Name:            .text2
22    Type:            SHT_PROGBITS
23    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
24    AddressAlign:    0x1000
25    Size:            4096
26ProgramHeaders:
27  - Type: PT_LOAD
28    Flags: [ PF_X, PF_R ]
29    Sections:
30      - Section: .text2
31  - Type: PT_LOAD
32    Flags: [ PF_X, PF_R ]
33    Sections:
34      - Section: .text
35      - Section: .text2
36  - Type: PT_LOAD
37    Flags: [ PF_X, PF_R ]
38    Sections:
39      - Section: .text
40      - Section: .text2
41
42#CHECK:     ProgramHeaders [
43#CHECK-NEXT:  ProgramHeader {
44#CHECK-NEXT:    Type: PT_LOAD (0x1)
45#CHECK-NEXT:    Offset: 0x2000
46#CHECK-NEXT:    VirtualAddress: 0x0
47#CHECK-NEXT:    PhysicalAddress: 0x0
48#CHECK-NEXT:    FileSize: 4096
49#CHECK-NEXT:    MemSize: 4096
50#CHECK-NEXT:    Flags [ (0x5)
51#CHECK-NEXT:      PF_R (0x4)
52#CHECK-NEXT:      PF_X (0x1)
53#CHECK-NEXT:    ]
54#CHECK-NEXT:    Alignment: 4096
55#CHECK-NEXT:  }
56#CHECK-NEXT:  ProgramHeader {
57#CHECK-NEXT:    Type: PT_LOAD (0x1)
58#CHECK-NEXT:    Offset: 0x1000
59#CHECK-NEXT:    VirtualAddress: 0x0
60#CHECK-NEXT:    PhysicalAddress: 0x0
61#CHECK-NEXT:    FileSize: 8192
62#CHECK-NEXT:    MemSize: 8192
63#CHECK-NEXT:    Flags [ (0x5)
64#CHECK-NEXT:      PF_R (0x4)
65#CHECK-NEXT:      PF_X (0x1)
66#CHECK-NEXT:    ]
67#CHECK-NEXT:    Alignment: 4096
68#CHECK-NEXT:  }
69#CHECK-NEXT:  ProgramHeader {
70#CHECK-NEXT:    Type: PT_LOAD (0x1)
71#CHECK-NEXT:    Offset: 0x1000
72#CHECK-NEXT:    VirtualAddress: 0x0
73#CHECK-NEXT:    PhysicalAddress: 0x0
74#CHECK-NEXT:    FileSize: 8192
75#CHECK-NEXT:    MemSize: 8192
76#CHECK-NEXT:    Flags [ (0x5)
77#CHECK-NEXT:      PF_R (0x4)
78#CHECK-NEXT:      PF_X (0x1)
79#CHECK-NEXT:    ]
80#CHECK-NEXT:    Alignment: 4096
81#CHECK-NEXT:  }
82#CHECK-NEXT:]
83