brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 03df36b Raw
94 lines · yaml
1## In this test case we check that we can override the default values for2## ELF header fields in the YAML.3 4## First we check the default values.5 6# RUN: yaml2obj %s -o %t-default7# RUN: llvm-readelf --file-headers %t-default | FileCheck %s --check-prefix=DEFAULT8 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:         213# DEFAULT: Size of section headers:           64 (bytes)14# DEFAULT: Number of section headers:         315# DEFAULT: Section header string table index: 216 17--- !ELF18FileHeader:19  Class: ELFCLASS6420  Data:  ELFDATA2LSB21  Type:  ET_REL22ProgramHeaders:23  - Type: PT_LOAD24  - Type: PT_LOAD25 26## Check we can override all default values using the same values27## and that this does not change the output.28# RUN: yaml2obj --docnum=2 %s -o %t-default-override29# RUN: cmp %t-default %t-default-override30 31--- !ELF32FileHeader:33  Class:      ELFCLASS6434  Data:       ELFDATA2LSB35  Type:       ET_REL36  EShEntSize: [[SHENTSIZE=64]]37  EShOff:     [[SHOFF=200]]38  EShNum:     [[SHNUM=3]]39  EShStrNdx:  [[SHSTRNDX=2]]40  EPhOff:     [[PHOFF=64]]41  EPhEntSize: [[PHENTSIZE=56]]42  EPhNum:     [[PHNUM=2]]43ProgramHeaders:44  - Type: PT_LOAD45  - Type: PT_LOAD46 47## Override different fields to check the output produced.48 49## Override the e_shoff field.50# RUN: yaml2obj --docnum=2 %s -DSHOFF=3 -o %t251# RUN: llvm-readelf --file-headers %t2 | FileCheck %s --check-prefix=SHOFF52 53# SHOFF: Start of section headers: 3 (bytes into file)54 55## Override the e_shnum field.56# RUN: yaml2obj --docnum=2 %s -DSHNUM=2 -o %t357# RUN: llvm-readelf --file-headers %t3 | FileCheck %s --check-prefix=SHNUM58 59# SHNUM: Number of section headers: 2{{$}}60 61## Override the e_shstrndx field.62# RUN: yaml2obj --docnum=2 %s -DSHSTRNDX=4 -o %t463# RUN: llvm-readelf --file-headers %t4 | FileCheck %s --check-prefix=SHSTRNDX64 65# SHSTRNDX: Section header string table index: 4{{$}}66 67## Override the e_shentsize field.68## Check the result using raw output from 'od' because llvm-readelf69## is unable to dump such headers.70 71# RUN: yaml2obj --docnum=2 %s -DSHENTSIZE=1 -o %t572# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t5 | FileCheck %s --check-prefix=NEWSIZE73# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t-default | FileCheck %s --check-prefix=OLDSIZE74# NEWSIZE: 0175# OLDSIZE: 4076 77## Override the e_phoff field.78# RUN: yaml2obj --docnum=2 %s -DPHOFF=3 -o %t679# RUN: llvm-readelf --file-headers %t6 | FileCheck %s --check-prefix=PHOFF80 81# PHOFF: Start of program headers: 3 (bytes into file){{$}}82 83## Override the e_phnum field.84# RUN: yaml2obj --docnum=2 %s -DPHNUM=1 -o %t785# RUN: llvm-readelf --file-headers %t7 | FileCheck %s --check-prefix=PHNUM86 87# PHNUM: Number of program headers: 1{{$}}88 89## Override the e_phentsize field.90# RUN: yaml2obj --docnum=2 %s -DPHENTSIZE=1 -o %t891# RUN: llvm-readelf --file-headers %t8 | FileCheck %s --check-prefix=PHENTSIZE92 93# PHENTSIZE: Size of program headers: 1 (bytes)94