blob: 503a9075f4a0613da2666456585822121c07937e [file] [log] [blame]
Jake Ehrlichd246b0a2017-09-19 21:37:35 +00001# This test tests that each segment is assigned a canonical parent segment.
2# Importantly if two segments could be the parent segment of a segment this test
3# should cover the case where a new parent replaces the old parent and the case
4# where an old parent is not replaced by a new parent.
5
6# RUN: yaml2obj %s -o %t
7# RUN: llvm-objcopy %t %t2
8# RUN: llvm-readobj --program-headers %t2 | FileCheck %s
9
10!ELF
11FileHeader:
12 Class: ELFCLASS64
13 Data: ELFDATA2LSB
14 Type: ET_EXEC
15 Machine: EM_X86_64
16Sections:
17 - Name: .text
18 Type: SHT_PROGBITS
19 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
20 AddressAlign: 0x1000
21 Size: 4096
22 - Name: .text2
23 Type: SHT_PROGBITS
24 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
25 AddressAlign: 0x1000
26 Size: 4096
27 - Name: .text3
28 Type: SHT_PROGBITS
29 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
30 AddressAlign: 0x1000
31 Size: 4096
32 - Name: .text4
33 Type: SHT_PROGBITS
34 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
35 AddressAlign: 0x1000
36 Size: 4096
37 - Name: .text5
38 Type: SHT_PROGBITS
39 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
40 AddressAlign: 0x1000
41 Size: 4096
42ProgramHeaders:
43 - Type: PT_LOAD
44 Flags: [ PF_X, PF_R ]
45 Sections:
46 - Section: .text4
47 - Section: .text5
48 - Type: PT_LOAD
49 Flags: [ PF_X, PF_R ]
50 Sections:
51 - Section: .text3
52 - Section: .text4
53 - Section: .text5
54 - Type: PT_LOAD
55 Flags: [ PF_X, PF_R ]
56 Sections:
57 - Section: .text
58 - Section: .text2
59 - Section: .text3
60 - Section: .text4
61 - Section: .text5
62 - Type: PT_LOAD
63 Flags: [ PF_X, PF_R ]
64 Sections:
65 - Section: .text2
66 - Section: .text3
67 - Section: .text4
68 - Section: .text5
69
70#CHECK: ProgramHeaders [
71#CHECK-NEXT: ProgramHeader {
72#CHECK-NEXT: Type: PT_LOAD (0x1)
73#CHECK-NEXT: Offset: 0x4000
74#CHECK-NEXT: VirtualAddress: 0x0
75#CHECK-NEXT: PhysicalAddress: 0x0
76#CHECK-NEXT: FileSize: 8192
77#CHECK-NEXT: MemSize: 8192
78#CHECK-NEXT: Flags [ (0x5)
79#CHECK-NEXT: PF_R (0x4)
80#CHECK-NEXT: PF_X (0x1)
81#CHECK-NEXT: ]
82#CHECK-NEXT: Alignment: 4096
83#CHECK-NEXT: }
84#CHECK-NEXT: ProgramHeader {
85#CHECK-NEXT: Type: PT_LOAD (0x1)
86#CHECK-NEXT: Offset: 0x3000
87#CHECK-NEXT: VirtualAddress: 0x0
88#CHECK-NEXT: PhysicalAddress: 0x0
89#CHECK-NEXT: FileSize: 12288
90#CHECK-NEXT: MemSize: 12288
91#CHECK-NEXT: Flags [ (0x5)
92#CHECK-NEXT: PF_R (0x4)
93#CHECK-NEXT: PF_X (0x1)
94#CHECK-NEXT: ]
95#CHECK-NEXT: Alignment: 4096
96#CHECK-NEXT: }
97#CHECK-NEXT: ProgramHeader {
98#CHECK-NEXT: Type: PT_LOAD (0x1)
99#CHECK-NEXT: Offset: 0x1000
100#CHECK-NEXT: VirtualAddress: 0x0
101#CHECK-NEXT: PhysicalAddress: 0x0
102#CHECK-NEXT: FileSize: 20480
103#CHECK-NEXT: MemSize: 20480
104#CHECK-NEXT: Flags [ (0x5)
105#CHECK-NEXT: PF_R (0x4)
106#CHECK-NEXT: PF_X (0x1)
107#CHECK-NEXT: ]
108#CHECK-NEXT: Alignment: 4096
109#CHECK-NEXT: }
110#CHECK-NEXT: ProgramHeader {
111#CHECK-NEXT: Type: PT_LOAD (0x1)
112#CHECK-NEXT: Offset: 0x2000
113#CHECK-NEXT: VirtualAddress: 0x0
114#CHECK-NEXT: PhysicalAddress: 0x0
115#CHECK-NEXT: FileSize: 16384
116#CHECK-NEXT: MemSize: 16384
117#CHECK-NEXT: Flags [ (0x5)
118#CHECK-NEXT: PF_R (0x4)
119#CHECK-NEXT: PF_X (0x1)
120#CHECK-NEXT: ]
121#CHECK-NEXT: Alignment: 4096
122#CHECK-NEXT: }
123#CHECK-NEXT:]