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
| ## In this test case we check that we can override the default values for
## e_shentsize, e_shoff, e_shnum and e_shstrndx fields in the YAML.
## First we check the default values.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readelf --file-headers %t1 | FileCheck %s --check-prefix=DEFAULT
# DEFAULT: Start of section headers: 88 (bytes into file)
# DEFAULT: Size of section headers: 64 (bytes)
# DEFAULT: Number of section headers: 3
# DEFAULT: Section header string table index: 2
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
## Override 3 fields: e_shoff, e_shnum and e_shstrndx. Check the output.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-readelf --file-headers %t2 | FileCheck %s --check-prefix=CUSTOM
# CUSTOM: Start of section headers: 2 (bytes into file)
# CUSTOM: Size of section headers: 64 (bytes)
# CUSTOM: Number of section headers: 3
# CUSTOM: Section header string table index: 4
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
SHEntSize: 64
SHOff: 2
SHNum: 3
SHStrNdx: 4
## Finally, we use the same YAML as above, but set e_shentsize to 1.
## Check the result using raw output from 'od' because llvm-readelf
## is unable to dump such headers.
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t3 | FileCheck %s --check-prefix=NEWSIZE
# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t2 | FileCheck %s --check-prefix=OLDSIZE
# NEWSIZE: 01
# OLDSIZE: 40
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
SHEntSize: 1
SHOff: 2
SHNum: 3
SHStrNdx: 4
|