69 lines · yaml
1## Check how "Content", "Size" and "Entries" keys can be used to2## describe a content for relocations sections.3 4## Check we can use the "Content" key alone.5 6# RUN: yaml2obj -DCONTENT="01234567" %s -o %t1.content7# RUN: llvm-readobj --sections --section-data %t1.content | \8# RUN: FileCheck %s --check-prefix=RAW -DDATA="01234567"9 10# RAW: Name: .dynamic11# RAW: EntrySize:12# RAW-SAME: 255{{$}}13# RAW: SectionData (14# RAW-NEXT: 0000: [[DATA]] |15# RAW-NEXT: )16 17--- !ELF18FileHeader:19 Class: ELFCLASS6420 Data: ELFDATA2LSB21 Type: ET_EXEC22Sections:23 - Name: .dynamic24 Type: SHT_DYNAMIC25 EntSize: 0xff26 Content: [[CONTENT=<none>]]27 Size: [[SIZE=<none>]]28 Entries: [[ENTRIES=<none>]]29 30## Check we can use the "Size" key alone.31 32# RUN: yaml2obj -DSIZE=3 %s -o %t1.size33# RUN: llvm-readobj --sections --section-data %t1.size | \34# RUN: FileCheck %s --check-prefix=RAW -DDATA="000000"35 36## Check we can use the "Content" key with the "Size" key when the size is greater37## than or equal to the content size.38 39# RUN: not yaml2obj -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \40# RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR41 42# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size43 44# RUN: yaml2obj -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o45# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \46# RUN: FileCheck %s --check-prefix=RAW -DDATA="0011"47 48# RUN: yaml2obj -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o49# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \50# RUN: FileCheck %s --check-prefix=RAW -DDATA="001100"51 52## Check we can't use the "Entries" key together with the "Content" or "Size" keys.53 54# RUN: not yaml2obj -DSIZE=0 -DENTRIES="[]" %s 2>&1 | \55# RUN: FileCheck %s --check-prefix=ENT-ERR56# RUN: not yaml2obj -DCONTENT="'00'" -DENTRIES="[]" %s 2>&1 | \57# RUN: FileCheck %s --check-prefix=ENT-ERR58 59# ENT-ERR: error: "Entries" cannot be used with "Content" or "Size"60 61## Check we create an empty section when none of "Size", "Content" or "Entries" are specified.62 63# RUN: yaml2obj %s -o %t.empty.o64# RUN: llvm-readelf --sections --section-data %t.empty.o | \65# RUN: FileCheck %s --check-prefix=EMPTY-SEC66 67# EMPTY-SEC: [Nr] Name Type Address Off Size68# EMPTY-SEC: [ 1] .dynamic DYNAMIC 0000000000000000 000040 00000069