1
1
# # In this test case we check that we can override the default values for
2
- # # e_shentsize, e_shoff, e_shnum and e_shstrndx fields in the YAML.
2
+ # # ELF header fields in the YAML.
3
3
4
4
# # First we check the default values.
5
5
6
6
# RUN: yaml2obj %s -o %t-default
7
7
# RUN: llvm-readelf --file-headers %t-default | FileCheck %s --check-prefix=DEFAULT
8
8
9
- # DEFAULT: Start of section headers: 88 (bytes into file)
10
- # DEFAULT: Size of section headers: 64 (bytes)
11
- # DEFAULT: Number of section headers: 3
12
- # DEFAULT: Section header string table index: 2
9
+ # DEFAULT: Start of program headers: 64 (bytes into file)
10
+ # DEFAULT: Start of section headers: 200 (bytes into file)
11
+ # DEFAULT: Size of program headers: 56 (bytes)
12
+ # DEFAULT: Number of program headers: 2
13
+ # DEFAULT: Size of section headers: 64 (bytes)
14
+ # DEFAULT: Number of section headers: 3
15
+ # DEFAULT: Section header string table index: 2
13
16
14
17
--- !ELF
15
18
FileHeader :
16
19
Class : ELFCLASS64
17
20
Data : ELFDATA2LSB
18
21
Type : ET_REL
19
22
Machine : EM_X86_64
23
+ ProgramHeaders :
24
+ - Type : PT_LOAD
25
+ Sections : []
26
+ - Type : PT_LOAD
27
+ Sections : []
20
28
21
29
# # Check we can override all default values using the same values
22
30
# # and that this does not change the output.
@@ -29,10 +37,18 @@ FileHeader:
29
37
Data : ELFDATA2LSB
30
38
Type : ET_REL
31
39
Machine : EM_X86_64
32
- SHEntSize : [[SHENTSIZE=64]]
33
- SHOff : [[SHOFF=88]]
34
- SHNum : [[SHNUM=3]]
35
- SHStrNdx : [[SHSTRNDX=2]]
40
+ SHEntSize : [[SHENTSIZE=64]]
41
+ SHOff : [[SHOFF=200]]
42
+ SHNum : [[SHNUM=3]]
43
+ SHStrNdx : [[SHSTRNDX=2]]
44
+ EPhOff : [[PHOFF=64]]
45
+ EPhEntSize : [[PHENTSIZE=56]]
46
+ EPhNum : [[PHNUM=2]]
47
+ ProgramHeaders :
48
+ - Type : PT_LOAD
49
+ Sections : []
50
+ - Type : PT_LOAD
51
+ Sections : []
36
52
37
53
# # Override different fields to check the output produced.
38
54
@@ -63,3 +79,21 @@ FileHeader:
63
79
# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t-default | FileCheck %s --check-prefix=OLDSIZE
64
80
# NEWSIZE: 01
65
81
# OLDSIZE: 40
82
+
83
+ # # Override the e_phoff field.
84
+ # RUN: yaml2obj --docnum=2 %s -DPHOFF=3 -o %t6
85
+ # RUN: llvm-readelf --file-headers %t6 | FileCheck %s --check-prefix=PHOFF
86
+
87
+ # PHOFF: Start of program headers: 3 (bytes into file){{$}}
88
+
89
+ # # Override the e_phnum field.
90
+ # RUN: yaml2obj --docnum=2 %s -DPHNUM=1 -o %t7
91
+ # RUN: llvm-readelf --file-headers %t7 | FileCheck %s --check-prefix=PHNUM
92
+
93
+ # PHNUM: Number of program headers: 1{{$}}
94
+
95
+ # # Override the e_phentsize field.
96
+ # RUN: yaml2obj --docnum=2 %s -DPHENTSIZE=1 -o %t8
97
+ # RUN: not llvm-readelf --file-headers %t8 2>&1 | FileCheck %s --check-prefix=PHENTSIZE
98
+
99
+ # PHENTSIZE: invalid e_phentsize: 1{{$}}
0 commit comments