brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.1 KiB · 7f37847 Raw
192 lines · yaml
1## Check we are able to dump SHT_GNU_verneed sections properly.2## Check that we link the SHT_GNU_verneed section to3## the `.dynstr` section by default.4## Check that we set the value of `sh_info` field to the number5## of version dependencies by default.6 7# RUN: yaml2obj --docnum=1 %s -o %t18# RUN: llvm-readobj -V %t1 | FileCheck %s9# RUN: llvm-readelf --sections %t1 | \10# RUN:   FileCheck %s -DLINK=3 -DINFO=2 --check-prefix=FIELDS11 12# FIELDS: [Nr] Name           Type    {{.*}} Flg Lk       Inf      Al13# FIELDS: [ 1] .gnu.version_r VERNEED {{.*}}   A [[LINK]] [[INFO]] 414# FIELDS: [ 3] .dynstr15 16# CHECK:      VersionRequirements [17# CHECK-NEXT:   Dependency {18# CHECK-NEXT:     Version: 119# CHECK-NEXT:     Count: 220# CHECK-NEXT:     FileName: dso.so.021# CHECK-NEXT:     Entries [22# CHECK-NEXT:       Entry {23# CHECK-NEXT:         Hash: 193724# CHECK-NEXT:         Flags [ (0xA)25# CHECK-NEXT:           Weak (0x2)26# CHECK-NEXT:         ]27# CHECK-NEXT:         Index: 328# CHECK-NEXT:         Name: v129# CHECK-NEXT:       }30# CHECK-NEXT:       Entry {31# CHECK-NEXT:         Hash: 193832# CHECK-NEXT:         Flags [ (0xB)33# CHECK-NEXT:           Base (0x1)34# CHECK-NEXT:           Weak (0x2)35# CHECK-NEXT:         ]36# CHECK-NEXT:         Index: 437# CHECK-NEXT:         Name: v238# CHECK-NEXT:       }39# CHECK-NEXT:     ]40# CHECK-NEXT:   }41# CHECK-NEXT:   Dependency {42# CHECK-NEXT:     Version: 143# CHECK-NEXT:     Count: 144# CHECK-NEXT:     FileName: dso.so.145# CHECK-NEXT:     Entries [46# CHECK-NEXT:       Entry {47# CHECK-NEXT:         Hash: 193948# CHECK-NEXT:         Flags [ (0xC)49# CHECK-NEXT:           Info (0x4)50# CHECK-NEXT:         ]51# CHECK-NEXT:         Index: 252# CHECK-NEXT:         Name: v353# CHECK-NEXT:       }54# CHECK-NEXT:     ]55# CHECK-NEXT:   }56# CHECK-NEXT: ]57 58--- !ELF59FileHeader:60  Class: ELFCLASS6461  Data:  ELFDATA2LSB62  Type:  ET_EXEC63  Entry: 0x000000000020100064Sections:65  - Name:         .gnu.version_r66    Type:         SHT_GNU_verneed67    Flags:        [ SHF_ALLOC ]68    Address:      0x000000000020025069    AddressAlign: 0x000000000000000470    Info:         [[INFO=<none>]]71    Link:         [[LINK=<none>]]72    Dependencies:73      - Version:         174        File:            dso.so.075        Entries:76          - Name:            v177            Hash:            193778            Flags:           1079            Other:           380          - Name:            v281            Hash:            193882            Flags:           1183            Other:           484      - Version:         185        File:            dso.so.186        Entries:87          - Name:            v388            Hash:            193989            Flags:           1290            Other:           291DynamicSymbols:92  - Name:    f193    Binding: STB_GLOBAL94 95## Check that we are able to set sh_info and sh_link fields to arbitrary values.96 97# RUN: yaml2obj --docnum=1 -DINFO=123 -DLINK=234 %s -o %t1.fields98# RUN: llvm-readelf --sections %t1.fields | \99# RUN:   FileCheck %s -DINFO=123 -DLINK=234 --check-prefix=FIELDS100 101## Check we can omit "Content", "Size" and "Dependencies" fields to102## produce an empty SHT_GNU_verneed section.103## Check we set the sh_link field to 0 when there is no .dynstr section.104 105# RUN: yaml2obj --docnum=2 %s -o %t3106# RUN: llvm-readelf --sections %t3 | FileCheck %s --check-prefix=NO-PROPS107 108# NO-PROPS: [Nr] Name           Type    Address          Off    Size   ES Flg Lk Inf109# NO-PROPS: [ 1] .gnu.version_r VERNEED 0000000000000000 000040 000000 00   A 0  0110 111--- !ELF112FileHeader:113  Class: ELFCLASS64114  Data:  ELFDATA2LSB115  Type:  ET_EXEC116Sections:117  - Name:         .gnu.version_r118    Type:         SHT_GNU_verneed119    Flags:        [ SHF_ALLOC ]120    Size:         [[SIZE=<none>]]121    Content:      [[CONTENT=<none>]]122    Dependencies: [[DEPS=<none>]]123 124## Check we can use the "Content" key with the "Size" key when the size is greater125## than or equal to the content size.126 127# RUN: not yaml2obj --docnum=2 -DCONTENT="'00'" -DSIZE=0 %s 2>&1 | \128# RUN:   FileCheck %s --check-prefix=CONTENT-SIZE-ERR129 130# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size131 132# RUN: yaml2obj --docnum=2 -DCONTENT="'00'" -DSIZE=1 %s -o %t.cont.size.eq.o133# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \134# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="00"135 136# RUN: yaml2obj --docnum=2 -DCONTENT="'00'" -DSIZE=2 %s -o %t.cont.size.gr.o137# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \138# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0000"139 140# CHECK-CONTENT:      Name: .gnu.version_r141# CHECK-CONTENT:      SectionData (142# CHECK-CONTENT-NEXT:   0000: [[DATA]] |143# CHECK-CONTENT-NEXT: )144 145## Check we can use the "Size" key alone to create the section.146 147# RUN: yaml2obj --docnum=2 -DSIZE=3 %s -o %t.size.o148# RUN: llvm-readobj --sections --section-data %t.size.o | \149# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="000000"150 151## Check we can use the "Content" key alone to create the section.152 153# RUN: yaml2obj --docnum=2 -DCONTENT="'112233'" %s -o %t.content.o154# RUN: llvm-readobj --sections --section-data %t.content.o | \155# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="112233"156 157## Check we can't use the "Dependencies" key together with the "Content" or "Size" keys.158 159# RUN: not yaml2obj --docnum=2 -DSIZE=0 -DDEPS="[]" %s 2>&1 | \160# RUN:   FileCheck %s --check-prefix=DEPS-ERR161# RUN: not yaml2obj --docnum=2 -DCONTENT="'00'" -DDEPS="[]" %s 2>&1 | \162# RUN:   FileCheck %s --check-prefix=DEPS-ERR163 164# DEPS-ERR: error: "Dependencies" cannot be used with "Content" or "Size"165 166## Check we set the sh_link field to 0 when the .dynstr section is excluded167## from the section header table.168 169# RUN: yaml2obj --docnum=3 %s -o %t3170# RUN: llvm-readelf --sections %t3 | FileCheck %s --check-prefix=EXCLUDED171 172# EXCLUDED: [Nr] Name           {{.*}} ES Flg Lk Inf173# EXCLUDED: [ 1] .gnu.version_r {{.*}} 00     0   0174 175--- !ELF176FileHeader:177  Class: ELFCLASS64178  Data:  ELFDATA2LSB179  Type:  ET_DYN180Sections:181  - Name: .gnu.version_r182    Type: SHT_GNU_verneed183  - Name: .dynstr184    Type: SHT_STRTAB185  - Type: SectionHeaderTable186    Sections:187      - Name: .gnu.version_r188      - Name: .strtab189      - Name: .shstrtab190    Excluded:191      - Name: .dynstr192