1 ## In this test case we check that we can override the default values for
2 ## ELF header fields in the YAML.
4 ## First we check the default values.
6 # RUN: yaml2obj %s -o %t-default
7 # RUN: llvm-readelf --file-headers %t-default | FileCheck %s --check-prefix=DEFAULT
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
26 ## Check we can override all default values using the same values
27 ## and that this does not change the output.
28 # RUN: yaml2obj --docnum=2 %s -o %t-default-override
29 # RUN: cmp %t-default %t-default-override
36 EShEntSize: [[SHENTSIZE=64]]
39 EShStrNdx: [[SHSTRNDX=2]]
41 EPhEntSize: [[PHENTSIZE=56]]
47 ## Override different fields to check the output produced.
49 ## Override the e_shoff field.
50 # RUN: yaml2obj --docnum=2 %s -DSHOFF=3 -o %t2
51 # RUN: llvm-readelf --file-headers %t2 | FileCheck %s --check-prefix=SHOFF
53 # SHOFF: Start of section headers: 3 (bytes into file)
55 ## Override the e_shnum field.
56 # RUN: yaml2obj --docnum=2 %s -DSHNUM=2 -o %t3
57 # RUN: llvm-readelf --file-headers %t3 | FileCheck %s --check-prefix=SHNUM
59 # SHNUM: Number of section headers: 2{{$}}
61 ## Override the e_shstrndx field.
62 # RUN: yaml2obj --docnum=2 %s -DSHSTRNDX=4 -o %t4
63 # RUN: llvm-readelf --file-headers %t4 | FileCheck %s --check-prefix=SHSTRNDX
65 # SHSTRNDX: Section header string table index: 4{{$}}
67 ## Override the e_shentsize field.
68 ## Check the result using raw output from 'od' because llvm-readelf
69 ## is unable to dump such headers.
71 # RUN: yaml2obj --docnum=2 %s -DSHENTSIZE=1 -o %t5
72 # RUN: od -A n -t x1 -v -j 0x3a -N 1 %t5 | FileCheck %s --check-prefix=NEWSIZE
73 # RUN: od -A n -t x1 -v -j 0x3a -N 1 %t-default | FileCheck %s --check-prefix=OLDSIZE
77 ## Override the e_phoff field.
78 # RUN: yaml2obj --docnum=2 %s -DPHOFF=3 -o %t6
79 # RUN: llvm-readelf --file-headers %t6 | FileCheck %s --check-prefix=PHOFF
81 # PHOFF: Start of program headers: 3 (bytes into file){{$}}
83 ## Override the e_phnum field.
84 # RUN: yaml2obj --docnum=2 %s -DPHNUM=1 -o %t7
85 # RUN: llvm-readelf --file-headers %t7 | FileCheck %s --check-prefix=PHNUM
87 # PHNUM: Number of program headers: 1{{$}}
89 ## Override the e_phentsize field.
90 # RUN: yaml2obj --docnum=2 %s -DPHENTSIZE=1 -o %t8
91 # RUN: llvm-readelf --file-headers %t8 | FileCheck %s --check-prefix=PHENTSIZE
93 # PHENTSIZE: Size of program headers: 1 (bytes)