brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · 29d0a4b Raw
140 lines · yaml
1## Check we are able to produce a valid SHT_LLVM_LINKER_OPTIONS2## section from its description.3 4## Check we can use "Options", "Size" and "Content" alone to describe the data.5 6# RUN: yaml2obj --docnum=1 %s -o %t17# RUN: llvm-readobj --string-dump .linker-options1 --sections --section-data %t1 \8# RUN:   | FileCheck %s --check-prefix=OPTIONS9 10# OPTIONS:        Name: .linker-options111# OPTIONS-NEXT:   Type: SHT_LLVM_LINKER_OPTIONS12# OPTIONS-NEXT:   Flags [13# OPTIONS-NEXT:   ]14# OPTIONS-NEXT:   Address: 0x015# OPTIONS-NEXT:   Offset: 0x4016# OPTIONS-NEXT:   Size: 3417# OPTIONS-NEXT:   Link: 018# OPTIONS-NEXT:   Info: 019# OPTIONS-NEXT:   AddressAlignment: 020# OPTIONS-NEXT:   EntrySize: 021 22# OPTIONS:      Name: .linker-options223# OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS24# OPTIONS:      SectionData (25# OPTIONS-NEXT:   0000: 00112233 |26# OPTIONS-NEXT: )27 28# OPTIONS:      Name: .linker-options329# OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS30# OPTIONS:      SectionData (31# OPTIONS-NEXT:   0000: 00000000 |32# OPTIONS-NEXT: )33 34# OPTIONS:      String dump of section '.linker-options1':35# OPTIONS-NEXT: [     0] option 036# OPTIONS-NEXT: [     9] value 037# OPTIONS-NEXT: [    11] option 138# OPTIONS-NEXT: [    1a] value 139 40--- !ELF41FileHeader:42  Class: ELFCLASS6443  Data:  ELFDATA2LSB44  Type:  ET_REL45Sections:46  - Name: .linker-options147    Type: SHT_LLVM_LINKER_OPTIONS48    Options:49      - Name:  option 050        Value: value 051      - Name:  option 152        Value: value 153  - Name: .linker-options254    Type: SHT_LLVM_LINKER_OPTIONS55    Content: "00112233"56  - Name: .linker-options357    Type: SHT_LLVM_LINKER_OPTIONS58    Size: 459 60## Check that "Value" and "Name" fields are mandatory when using "Options" key.61 62# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=NOVALUE63# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=NONAME64 65# NOVALUE: error: missing required key 'Value'66# NONAME: error: missing required key 'Name'67 68--- !ELF69FileHeader:70  Class: ELFCLASS6471  Data:  ELFDATA2LSB72  Type:  ET_REL73Sections:74  - Name: .linker-options75    Type: SHT_LLVM_LINKER_OPTIONS76    Options:77      - Name: name78 79--- !ELF80FileHeader:81  Class: ELFCLASS6482  Data:  ELFDATA2LSB83  Type:  ET_REL84Sections:85  - Name: .linker-options86    Type: SHT_LLVM_LINKER_OPTIONS87    Options:88      - Value: value89 90## Check we can't use "Options" or "Size" keys together with the "Content" key.91 92# RUN: not yaml2obj %s -DOPTIONS="[]" -DCONTENT="''" --docnum=4 2>&1 | \93# RUN:   FileCheck %s --check-prefix=TOGETHER94 95# RUN: not yaml2obj %s -DOPTIONS="[]" -DSIZE="0" --docnum=4 2>&1 | \96# RUN:   FileCheck %s --check-prefix=TOGETHER97 98# TOGETHER: error: "Options" cannot be used with "Content" or "Size"99 100--- !ELF101FileHeader:102  Class: ELFCLASS64103  Data:  ELFDATA2LSB104  Type:  ET_REL105Sections:106  - Name:    .linker-options107    Type:    SHT_LLVM_LINKER_OPTIONS108    Options: [[OPTIONS=<none>]]109    Content: [[CONTENT=<none>]]110    Size:    [[SIZE=<none>]]111 112## Check we can omit "Options", "Content" and "Size" keys. This produces an empty section.113 114# RUN: yaml2obj %s --docnum=4 2>&1 -o %t5115# RUN: llvm-readelf --sections %t5 | FileCheck %s --check-prefix=NONE116 117# NONE: [Nr] Name            Type                Address          Off    Size118# NONE: [ 1] .linker-options LLVM_LINKER_OPTIONS 0000000000000000 000040 000000119 120## Check we can use the "Content" key with the "Size" key when the size is greater121## than or equal to the content size.122 123# RUN: not yaml2obj --docnum=4 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \124# RUN:   FileCheck %s --check-prefix=CONTENT-SIZE-ERR125 126# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size127 128# RUN: yaml2obj --docnum=4 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o129# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \130# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"131 132# CHECK-CONTENT:      Name: .linker-options (1)133# CHECK-CONTENT:      SectionData (134# CHECK-CONTENT-NEXT:   0000: [[DATA]] |135# CHECK-CONTENT-NEXT: )136 137# RUN: yaml2obj --docnum=4 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o138# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \139# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"140