brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.5 KiB · cd087e4 Raw
313 lines · yaml
1## Check how yaml2obj produces SHT_HASH sections.2 3## Check we can describe a SHT_HASH section using the "Content" tag.4## Check default values of section fields.5 6# RUN: yaml2obj --docnum=1 %s -o %t17# RUN: llvm-readobj --sections --section-data %t1 | \8# RUN:   FileCheck %s -DENTSIZE=4 --check-prefix=CONTENT9 10# CONTENT:      Name: .hash11# CONTENT-NEXT: Type: SHT_HASH12# CONTENT-NEXT: Flags [13# CONTENT-NEXT: ]14# CONTENT-NEXT: Address: 0x015# CONTENT-NEXT: Offset: 0x4416# CONTENT-NEXT: Size: 2017# CONTENT-NEXT: Link: 118# CONTENT-NEXT: Info: 019# CONTENT-NEXT: AddressAlignment: 020# CONTENT-NEXT: EntrySize: [[ENTSIZE]]{{$}}21# CONTENT-NEXT: SectionData (22# CONTENT-NEXT:   0000: 01000000 02000000 03000000 0400000023# CONTENT-NEXT:   0010: 0500000024# CONTENT-NEXT: )25 26--- !ELF27FileHeader:28  Class: ELFCLASS3229  Data:  ELFDATA2LSB30  Type:  ET_DYN31Sections:32## SHT_HASH is linked to dynamic symbol table by default.33  - Name: .dynsym34    Type: SHT_DYNSYM35  - Name:    .hash36    Type:    SHT_HASH37    Content: '0100000002000000030000000400000005000000'38    EntSize: [[ENTSIZE=<none>]]39 40## Check we can set an arbitrary entry size for the SHT_HASH section.41 42# RUN: yaml2obj --docnum=1 -DENTSIZE=0xFF %s -o %t1.entsize43# RUN: llvm-readobj --sections --section-data %t1.entsize | \44# RUN:   FileCheck %s -DENTSIZE=255 --check-prefix=CONTENT45 46## Check we can describe a SHT_HASH section using "Bucket" and "Chain" tags.47 48# RUN: yaml2obj --docnum=2 %s -o %t249# RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s --check-prefix=BUCKET-CHAIN50 51# BUCKET-CHAIN:      Name: .hash52# BUCKET-CHAIN:      Size:53# BUCKET-CHAIN-SAME: 2854# BUCKET-CHAIN:      Link:55# BUCKET-CHAIN-SAME: 056# BUCKET-CHAIN:      SectionData (57# BUCKET-CHAIN-NEXT:   0000: 02000000 03000000 01000000 02000000  |58# BUCKET-CHAIN-NEXT:   0010: 03000000 04000000 05000000           |59# BUCKET-CHAIN-NEXT: )60 61--- !ELF62FileHeader:63  Class: ELFCLASS3264  Data:  ELFDATA2LSB65  Type:  ET_DYN66Sections:67  - Name:   .hash68    Type:   SHT_HASH69    Bucket: [ 1, 2 ]70    Chain:  [ 3, 4, 5 ]71 72## Check we can't use "Content" and "Bucket" tags together.73 74# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-BUCKET75 76# CONTENT-BUCKET: "Bucket" and "Chain" cannot be used with "Content" or "Size"77 78--- !ELF79FileHeader:80  Class: ELFCLASS3281  Data:  ELFDATA2LSB82  Type:  ET_DYN83Sections:84  - Name:   .hash85    Type:   SHT_HASH86    Bucket: [ 1 ]87    Content: '00'88 89## Check we can't use "Content" and "Chain" tags together.90 91# RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-CHAIN92 93# CONTENT-CHAIN: "Chain" cannot be used with "Content" or "Size"94 95--- !ELF96FileHeader:97  Class: ELFCLASS3298  Data:  ELFDATA2LSB99  Type:  ET_DYN100Sections:101  - Name:   .hash102    Type:   SHT_HASH103    Chain:  [ 1 ]104    Content: '00'105 106## Check we can't use "Bucket" without "Chain".107 108# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=NO-BUCKET-OR-CHAIN109 110# NO-BUCKET-OR-CHAIN: error: "Bucket" and "Chain" must be used together111 112--- !ELF113FileHeader:114  Class: ELFCLASS32115  Data:  ELFDATA2LSB116  Type:  ET_DYN117Sections:118  - Name:   .hash119    Type:   SHT_HASH120    Bucket: [ 1 ]121 122## Check we can't use "Chain" without "Bucket".123 124# RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=NO-BUCKET-OR-CHAIN125 126--- !ELF127FileHeader:128  Class: ELFCLASS32129  Data:  ELFDATA2LSB130  Type:  ET_DYN131Sections:132  - Name:  .hash133    Type:  SHT_HASH134    Chain: [ 1 ]135 136## Check we emit an empty section if neither "Bucket", "Chain",137## "Content" nor "Size" were set.138 139# RUN: yaml2obj --docnum=7 %s -o %t7140# RUN: llvm-readelf --sections %t7 | FileCheck %s --check-prefix=NO-TAGS141 142# NO-TAGS: [Nr] Name  Type Address  Off    Size143# NO-TAGS: [ 1] .hash HASH 00000000 000034 000000144 145--- !ELF146FileHeader:147  Class: ELFCLASS32148  Data:  ELFDATA2LSB149  Type:  ET_DYN150Sections:151  - Name:  .hash152    Type:  SHT_HASH153 154## Check we can set any sh_link value with use of the "Link" tag.155 156# RUN: yaml2obj --docnum=8 %s -o %t8157# RUN: llvm-readobj --sections %t8 | FileCheck %s --check-prefix=LINK158 159# LINK:      Name: .hash1160# LINK:      Link:161# LINK-SAME: 123162 163# LINK:      Name: .hash2164# LINK:      Link:165# LINK-SAME: 1166 167--- !ELF168FileHeader:169  Class: ELFCLASS32170  Data:  ELFDATA2LSB171  Type:  ET_DYN172Sections:173  - Name: .hash1174    Type: SHT_HASH175    Content: ""176    Link: 123177  - Name: .hash2178    Type: SHT_HASH179    Content: ""180    Link: .hash1181## SHT_HASH is linked to dynamic symbol table by default if it exists.182  - Name: .dynsym183    Type: SHT_DYNSYM184 185## Check we can use only "Size" to create a SHT_HASH section.186 187# RUN: yaml2obj --docnum=9 %s -o %t9188# RUN: llvm-readobj --sections --section-data %t9 | FileCheck %s --check-prefix=SIZE189 190# SIZE:      Name: .hash191# SIZE:      Size:192# SIZE-SAME: 17193# SIZE:      SectionData (194# SIZE-NEXT:  0000: 00000000 00000000 00000000 00000000  |195# SIZE-NEXT:  0010: 00                                   |196# SIZE-NEXT: )197 198--- !ELF199FileHeader:200  Class: ELFCLASS64201  Data:  ELFDATA2LSB202  Type:  ET_EXEC203Sections:204  - Name: .hash205    Type: SHT_HASH206    Size: 0x11207 208## Check we can use "Size" and "Content" together to create a SHT_HASH section.209 210# RUN: yaml2obj --docnum=10 %s -o %t10211# RUN: llvm-readobj --sections --section-data %t10 | FileCheck %s --check-prefix=SIZE-CONTENT212 213# SIZE-CONTENT:      Name: .hash214# SIZE-CONTENT:      Size:215# SIZE-CONTENT-SAME: 5216# SIZE-CONTENT:      SectionData (217# SIZE-CONTENT-NEXT:  0000: 11223300 00 |218# SIZE-CONTENT-NEXT: )219 220--- !ELF221FileHeader:222  Class: ELFCLASS64223  Data:  ELFDATA2LSB224  Type:  ET_EXEC225Sections:226  - Name: .hash227    Type: SHT_HASH228    Size: 0x5229    Content: "112233"230 231## Check that when "Size" and "Content" are used together, the size232## must be greater than or equal to the content size.233 234# RUN: not yaml2obj --docnum=11 %s 2>&1 | FileCheck %s --check-prefix=SIZE-CONTENT-ERR235 236# SIZE-CONTENT-ERR: error: Section size must be greater than or equal to the content size237 238--- !ELF239FileHeader:240  Class: ELFCLASS64241  Data:  ELFDATA2LSB242  Type:  ET_EXEC243Sections:244  - Name: .hash245    Type: SHT_HASH246    Size: 0x1247    Content: "1122"248 249## Check we can't use "Size" and "Bucket" tags together.250 251# RUN: not yaml2obj --docnum=12 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-BUCKET252 253--- !ELF254FileHeader:255  Class: ELFCLASS64256  Data:  ELFDATA2LSB257  Type:  ET_EXEC258Sections:259  - Name: .hash260    Type: SHT_HASH261    Size: 0x1262    Bucket: [ 1 ]263 264## Check we can't use "Size" and "Chain" tags together.265 266# RUN: not yaml2obj --docnum=13 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-CHAIN267 268--- !ELF269FileHeader:270  Class: ELFCLASS64271  Data:  ELFDATA2LSB272  Type:  ET_EXEC273Sections:274  - Name: .hash275    Type: SHT_HASH276    Size: 0x1277    Chain: [ 1 ]278 279## Check we can override "nbucket" and "nchain" values of a SHT_HASH section using "NBucket"280## and "NChain" tags. Check that the section size is unaffected when we do this.281 282# RUN: yaml2obj --docnum=14 %s -o %t14283# RUN: llvm-readobj --sections --section-data %t14 | FileCheck %s --check-prefix=OVERRIDE284 285# OVERRIDE:      Name: .hash286# OVERRIDE-NEXT: Type: SHT_HASH287# OVERRIDE-NEXT: Flags [288# OVERRIDE-NEXT: ]289# OVERRIDE-NEXT: Address: 0x0290# OVERRIDE-NEXT: Offset: 0x34291# OVERRIDE-NEXT: Size: 28292# OVERRIDE-NEXT: Link: 0293# OVERRIDE-NEXT: Info: 0294# OVERRIDE-NEXT: AddressAlignment: 0295# OVERRIDE-NEXT: EntrySize: 4296# OVERRIDE-NEXT: SectionData (297# OVERRIDE-NEXT:   0000: AA000000 BB000000 01000000 02000000298# OVERRIDE-NEXT:   0010: 03000000 04000000 05000000299# OVERRIDE-NEXT: )300 301--- !ELF302FileHeader:303  Class: ELFCLASS32304  Data:  ELFDATA2LSB305  Type:  ET_DYN306Sections:307  - Name:   .hash308    Type:   SHT_HASH309    Bucket: [ 1, 2 ]310    Chain:  [ 3, 4, 5 ]311    NBucket: 0xAA312    NChain:  0xBB313