brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 12b6904 Raw
92 lines · yaml
1## Check we are able to describe the content of a section2## using the ContentArray key.3 4## Check we are able to use ContentArray to create multi-line descriptions5## of section contents with comments on the same line.6# RUN: yaml2obj --docnum=1 %s -o %t17# RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s8 9# CHECK:      Section {10# CHECK:        Index: 111# CHECK-NEXT:   Name: .foo12# CHECK-NEXT:   Type: SHT_PROGBITS13# CHECK-NEXT:   Flags [14# CHECK-NEXT:   ]15# CHECK-NEXT:   Address: 0x016# CHECK-NEXT:   Offset: 0x4017# CHECK-NEXT:   Size: 1618# CHECK-NEXT:   Link: 019# CHECK-NEXT:   Info: 020# CHECK-NEXT:   AddressAlignment: 021# CHECK-NEXT:   EntrySize: 022# CHECK-NEXT:   SectionData (23# CHECK-NEXT:     0000: 11223344 55667788 99AABBCC DDEEFF0024# CHECK-NEXT:   )25# CHECK-NEXT: }26 27--- !ELF28FileHeader:29  Class: ELFCLASS6430  Data:  ELFDATA2LSB31  Type:  ET_DYN32Sections:33  - Name:         .foo34    Type:         SHT_PROGBITS35    ContentArray: [ 0x11, 0x22, 0x33, 0x44,                                ## .long 1122334436                    0x55, 0x66,                                            ## .short 5566.37                    0x77,                                                  ## .byte 0x7738                    0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00 ] ## .quad 0x8899aabbccddeeff0039 40## Check we do not allow using 'Content' and 'ContentArray' at the same time.41# RUN: not yaml2obj --docnum=2 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=BOTH42# BOTH: error: Content and ContentArray can't be used together43 44--- !ELF45FileHeader:46  Class: ELFCLASS6447  Data:  ELFDATA2LSB48  Type:  ET_DYN49Sections:50  - Name:         .foo51    Type:         SHT_PROGBITS52    Content:      [ 0x0 ]53    ContentArray: [ 0x1 ]54 55## Check how the "Size" and the "ContentArray" keys can be used together.56 57## Case A: check that we report an error when the the value of "Size" is less than the content size.58# RUN: not yaml2obj --docnum=3 -DSIZE=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=SIZE-LESS59# SIZE-LESS: error: Section size must be greater than or equal to the content size60 61--- !ELF62FileHeader:63  Class: ELFCLASS6464  Data:  ELFDATA2LSB65  Type:  ET_DYN66Sections:67  - Name:         .foo68    Type:         SHT_PROGBITS69    ContentArray: [ 0x11, 0x22 ]70    Size:         [[SIZE]]71 72## Case B: check we are able to produce an output when the value of "Size" is equal73##         to the content size. In this case the "Size" key has no effect.74# RUN: yaml2obj --docnum=3 -DSIZE=2 %s -o %t3.eq75# RUN: llvm-readobj --sections --section-data %t3.eq | FileCheck %s --check-prefix=SIZE-EQ76 77# SIZE-EQ:      Name: .foo78# SIZE-EQ:      SectionData (79# SIZE-EQ-NEXT:   0000: 1122 |80# SIZE-EQ-NEXT: )81 82## Case C: check we are able to produce an output when the value of "Size" is greater83##         than the content size. In this case zeroes are added as padding after the84##         specified content.85# RUN: yaml2obj --docnum=3 -DSIZE=3 %s -o %t4.gr86# RUN: llvm-readobj --sections --section-data %t4.gr | FileCheck %s --check-prefix=SIZE-GR87 88# SIZE-GR:      Name: .foo89# SIZE-GR:      SectionData (90# SIZE-GR-NEXT:   0000: 112200 |91# SIZE-GR-NEXT: )92