program-header-size-offset.yaml
2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
## Show that yaml2obj properly emits program headers with explicit file size,
## memory size and offset parameters.
# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj %t --program-headers | FileCheck %s
# CHECK: ProgramHeaders [
# CHECK: Offset: 0x1234
# CHECK: FileSize: 1111
# CHECK: MemSize: 9999
# CHECK: Offset: 0x2000
# CHECK: FileSize: 6
# CHECK: MemSize: 4
# CHECK: Offset: 0x2000
# CHECK: FileSize: 4
# CHECK: MemSize: 6
# CHECK: Offset: 0x1FFF
# CHECK: FileSize: 5
# CHECK: MemSize: 5
# CHECK: Offset: 0xFFE
# CHECK: FileSize: 7
# CHECK: MemSize: 9
# CHECK: Offset: 0x3000
# CHECK: FileSize: 3
# CHECK: MemSize: 2
# CHECK: Offset: 0x2004
# CHECK: FileSize: 4
# CHECK: MemSize: 6
# CHECK: ]
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Size: 4
ShOffset: 0x1000
AddressAlign: 0x1000
- Name: .rodata
Type: SHT_PROGBITS
Size: 4
ShOffset: 0x2000
AddressAlign: 0x1000
- Name: .data
Type: SHT_PROGBITS
ShOffset: 0x2004
Size: 4
- Name: .nobits1
Type: SHT_NOBITS
ShOffset: 0x2008
Size: 1
- Name: .nobits2
Type: SHT_NOBITS
# Intentionally set to 0x2009 though the previous section is SHT_NOBITS.
ShOffset: 0x2009
Size: 1
ProgramHeaders:
# Program header with no sections.
- Type: 0x6abcdef0 # arbitrary type
Offset: 0x1234
FileSize: 1111
MemSize: 9999
# Program header with only file size set.
- Type: 0x6abcdef0
FileSize: 6
Sections:
- Section: .rodata
# Program header with only mem size set.
- Type: 0x6abcdef0
MemSize: 6
Sections:
- Section: .rodata
# Program header with only offset set.
- Type: 0x6abcdef0
Offset: 0x1fff
Sections:
- Section: .rodata
# Program header with sections, valid properties.
- Type: 0x6abcdef0
Offset: 0xffe
FileSize: 7
MemSize: 9
Sections:
- Section: .text
# Program header with sections, invalid properties.
- Type: 0x6abcdef0
Offset: 0x3000
FileSize: 3
MemSize: 2
Sections:
- Section: .data
# Program header with 2 SHT_NOBITS sections.
- Type: 0x6abcdef0
Offset: 0x2004
Sections:
- Section: .data
- Section: .nobits1
- Section: .nobits2