relr-section.yaml
5.04 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
## Test how we create SHT_RELR sections.
## Test that the content of SHT_RELR sections for 64-bit little endian targets is correct.
# RUN: yaml2obj --docnum=1 -D ENCODE=LSB %s -o %t.le64
# RUN: llvm-readobj --sections --section-data %t.le64 | FileCheck %s --check-prefix=LE64
# LE64: Name: .relr.dyn
# LE64-NEXT: Type: SHT_RELR
# LE64-NEXT: Flags [
# LE64-NEXT: SHF_ALLOC
# LE64-NEXT: ]
# LE64-NEXT: Address: 0x0
# LE64-NEXT: Offset: 0x40
# LE64-NEXT: Size: 32
# LE64-NEXT: Link: 0
# LE64-NEXT: Info: 0
# LE64-NEXT: AddressAlignment: 0
# LE64-NEXT: EntrySize: 8
# LE64-NEXT: SectionData (
# LE64-NEXT: 0000: DDCCBBAA 00000000 2211FFEE 00000000
# LE64-NEXT: 0010: 66554433 00000010 AA998877 00000010
# LE64-NEXT: )
## Test that the content of SHT_RELR sections for 64-bit big endian targets is correct.
# RUN: yaml2obj --docnum=1 -D ENCODE=MSB %s -o %t.be64
# RUN: llvm-readobj --sections --section-data %t.be64 | FileCheck %s --check-prefix=BE64
# BE64: Name: .relr.dyn
# BE64: SectionData (
# BE64-NEXT: 0000: 00000000 AABBCCDD 00000000 EEFF1122
# BE64-NEXT: 0010: 10000000 33445566 10000000 778899AA
# BE64-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2[[ENCODE]]
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
## Set an arbitrary flag to demonstrate flags are set when requested.
Flags: [ SHF_ALLOC ]
Entries: [ 0x00000000AABBCCDD, 0x00000000EEFF1122,
0x1000000033445566, 0x10000000778899AA ]
## Test that the content of SHT_RELR sections for 32-bit little endian targets is correct.
# RUN: yaml2obj --docnum=2 -D ENCODE=LSB %s -o %t.le32
# RUN: llvm-readobj --sections --section-data %t.le32 | FileCheck %s --check-prefix=LE32
# LE32: Name: .relr.dyn
# LE32-NEXT: Type: SHT_RELR
# LE32-NEXT: Flags [
# LE32-NEXT: SHF_ALLOC
# LE32-NEXT: ]
# LE32-NEXT: Address: 0x0
# LE32-NEXT: Offset: 0x34
# LE32-NEXT: Size: 16
# LE32-NEXT: Link: 0
# LE32-NEXT: Info: 0
# LE32-NEXT: AddressAlignment: 0
# LE32-NEXT: EntrySize: 4
# LE32-NEXT: SectionData (
# LE32-NEXT: 0000: DDCCBBAA BBAAFFEE BBAAFFEE BCAAFFEE
# LE32-NEXT: )
## Test that the content of SHT_RELR sections for 32-bit big endian targets is correct.
# RUN: yaml2obj --docnum=2 -D ENCODE=MSB %s -o %t.be32
# RUN: llvm-readobj --sections --section-data %t.be32 | FileCheck %s --check-prefix=BE32
# BE32: Name: .relr.dyn
# BE32: SectionData (
# BE32-NEXT: 0000: AABBCCDD EEFFAABB EEFFAABB EEFFAABC |
# BE32-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2[[ENCODE]]
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
## Set an arbitrary flag to demonstrate flags are set when requested.
Flags: [ SHF_ALLOC ]
Entries: [ 0xAABBCCDD, 0xEEFFAABB,
0xEEFFAABB, 0xEEFFAABC ]
## Test we can use "Content" to describe SHT_RELR section.
# RUN: yaml2obj --docnum=3 %s -o %t.content
# RUN: llvm-readobj --sections --section-data %t.content | FileCheck %s --check-prefix=CONTENT
# CONTENT: Name: .relr.dyn
# CONTENT: SectionData (
# CONTENT-NEXT: 0000: 112233 |
# CONTENT-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
Content: "112233"
## Check we are able to set an arbitrary sh_entsize.
# RUN: yaml2obj --docnum=4 %s -o %t.entsize
# RUN: llvm-readelf --sections %t.entsize | FileCheck %s --check-prefix=ENTSIZE
# ENTSIZE: [Nr] Name Type Address Off Size ES
# ENTSIZE: [ 1] .relr.dyn RELR 00000000 000034 000001 34
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
EntSize: 0x34
Content: "12"
## Test we can't use 64-bit offsets/bitmaps when creating a 32-bit object.
# RUN: yaml2obj --docnum=5 %s -o %t.nottoolarge
# RUN: llvm-readobj --sections --section-data %t.nottoolarge | FileCheck %s --check-prefix=NOT-TOO-LARGE
# NOT-TOO-LARGE: Name: .relr.dyn
# NOT-TOO-LARGE: SectionData (
# NOT-TOO-LARGE-NEXT: 0000: FFFFFFFF
# NOT-TOO-LARGE-NEXT: )
# RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=TOO-LARGE
# TOO-LARGE: error: .relr.dyn: the value is too large for 32-bits: 0x100000000
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
Entries: [ 0x00000000FFFFFFFF ]
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
Entries: [ 0x0000000100000000 ]
## Test we can't specify "Entries" and "Content" properties at the same time.
# RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=BOTH
# BOTH: error: "Entries" and "Content" can't be used together
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .relr.dyn
Type: SHT_RELR
Entries: [ 0x0 ]
Content: "00"