brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 4be29c2 Raw
204 lines · yaml
1## Check we are able to produce a valid SHT_GNU_versym2## section from its description.3 4# RUN: yaml2obj --docnum=1 %s -o %t15# RUN: llvm-readobj -V %t1 | FileCheck %s6 7# CHECK:      VersionSymbols [8# CHECK-NEXT:   Symbol {9# CHECK-NEXT:     Version: 010# CHECK-NEXT:     Name:11# CHECK-NEXT:   }12# CHECK-NEXT:   Symbol {13# CHECK-NEXT:     Version: 314# CHECK-NEXT:     Name: f1@v115# CHECK-NEXT:   }16# CHECK-NEXT:   Symbol {17# CHECK-NEXT:     Version: 418# CHECK-NEXT:     Name: f2@v219# CHECK-NEXT:   }20# CHECK-NEXT: ]21# CHECK-NEXT: VersionDefinitions [22# CHECK-NEXT: ]23# CHECK-NEXT: VersionRequirements [24# CHECK-NEXT:   Dependency {25# CHECK-NEXT:     Version: 126# CHECK-NEXT:     Count: 227# CHECK-NEXT:     FileName: dso.so.028# CHECK-NEXT:     Entries [29# CHECK-NEXT:       Entry {30# CHECK-NEXT:         Hash: 193731# CHECK-NEXT:         Flags [ (0x0)32# CHECK-NEXT:         ]33# CHECK-NEXT:         Index: 334# CHECK-NEXT:         Name: v135# CHECK-NEXT:       }36# CHECK-NEXT:       Entry {37# CHECK-NEXT:         Hash: 193838# CHECK-NEXT:         Flags [ (0x0)39# CHECK-NEXT:         ]40# CHECK-NEXT:         Index: 441# CHECK-NEXT:         Name: v242# CHECK-NEXT:       }43# CHECK-NEXT:     ]44# CHECK-NEXT:   }45# CHECK-NEXT: ]46 47--- !ELF48FileHeader:49  Class: ELFCLASS6450  Data:  ELFDATA2LSB51  Type:  ET_EXEC52  Entry: 0x000000000020100053Sections:54  - Name:            .gnu.version55    Type:            SHT_GNU_versym56    Flags:           [ SHF_ALLOC ]57    Address:         0x000000000020021058    AddressAlign:    0x000000000000000259    EntSize:         0x000000000000000260    Entries:         [ 0, 3, 4 ]61  - Name:            .gnu.version_r62    Type:            SHT_GNU_verneed63    Flags:           [ SHF_ALLOC ]64    Address:         0x000000000020025065    AddressAlign:    0x000000000000000466    Dependencies:67      - Version:         168        File:            dso.so.069        Entries:70          - Name:            v171            Hash:            193772            Flags:           073            Other:           374          - Name:            v275            Hash:            193876            Flags:           077            Other:           478DynamicSymbols:79  - Name:    f180    Binding: STB_GLOBAL81  - Name:    f282    Binding: STB_GLOBAL83...84 85## Check we are able to set custom sh_entsize field for SHT_GNU_versym section.86## Check we link the SHT_GNU_versym section to the .dynsym section by default.87 88# RUN: yaml2obj --docnum=2 %s -o %t289# RUN: llvm-readelf -S %t2 | FileCheck %s -DLINK=2 --check-prefix=FIELDS90 91# FIELDS: Section Headers:92# FIELDS:   [Nr] Name         Type   Address          Off    Size   ES Flg Lk93# FIELDS:   [ 1] .gnu.version VERSYM 0000000000000000 000040 000000 03     [[LINK]]94# FIELDS:   [ 2] .dynsym      DYNSYM 0000000000000000 000040 000018 18   A 395 96--- !ELF97FileHeader:98  Class: ELFCLASS6499  Data:  ELFDATA2LSB100  OSABI: ELFOSABI_FREEBSD101  Type:  ET_DYN102Sections:103  - Name:    .gnu.version104    Type:    SHT_GNU_versym105    EntSize: 0x0000000000000003106    Entries: [ ]107    Link:    [[LINK=<none>]]108## Needed to emit the .dynsym section.109DynamicSymbols: []110 111## Check we are able to set the sh_link field to an arbitrary value.112 113# RUN: yaml2obj --docnum=2 -DLINK=0xff %s -o %t2.link114# RUN: llvm-readelf -S %t2.link | FileCheck %s -DLINK=255 --check-prefix=FIELDS115 116## Check we can use the "Content" key with the "Size" key when the size is greater117## than or equal to the content size.118## Also, check that we set the sh_link field to 0 when there is no .dynsym section.119 120# RUN: not yaml2obj --docnum=3 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \121# RUN:   FileCheck %s --check-prefix=CONTENT-SIZE-ERR122 123# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size124 125--- !ELF126FileHeader:127  Class: ELFCLASS64128  Data:  ELFDATA2LSB129  Type:  ET_DYN130Sections:131  - Name:    .gnu.version132    Type:    SHT_GNU_versym133    Size:    [[SIZE=<none>]]134    Content: [[CONTENT=<none>]]135    Entries: [[ENTRIES=<none>]]136 137# RUN: yaml2obj --docnum=3 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o138# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \139# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"140 141# RUN: yaml2obj --docnum=3 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o142# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \143# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"144 145# CHECK-CONTENT:        Name: .gnu.version146# CHECK-CONTENT-NEXT:   Type: SHT_GNU_versym (0x6FFFFFFF)147# CHECK-CONTENT-NEXT:   Flags [ (0x0)148# CHECK-CONTENT-NEXT:   ]149# CHECK-CONTENT-NEXT:   Address:150# CHECK-CONTENT-NEXT:   Offset:151# CHECK-CONTENT-NEXT:   Size:152# CHECK-CONTENT-NEXT:   Link: 0153# CHECK-CONTENT:        SectionData (154# CHECK-CONTENT-NEXT:   0000: [[DATA]] |155# CHECK-CONTENT-NEXT: )156 157## Check we can use the "Size" key alone to create the section.158 159# RUN: yaml2obj --docnum=3 -DSIZE=3 %s -o %t.size.o160# RUN: llvm-readobj --sections --section-data %t.size.o | \161# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="000000"162 163## Check we can use the "Content" key alone to create the section.164 165# RUN: yaml2obj --docnum=3 -DCONTENT="'112233'" %s -o %t.content.o166# RUN: llvm-readobj --sections --section-data %t.content.o | \167# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="112233"168 169## Check we can't use the "Entries" key together with the "Content" or "Size" keys.170 171# RUN: not yaml2obj --docnum=3 -DSIZE=0 -DENTRIES="[]" %s 2>&1 | \172# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR173# RUN: not yaml2obj --docnum=3 -DCONTENT="'00'" -DENTRIES="[]" %s 2>&1 | \174# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR175 176# ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"177 178## Check we set the sh_link field to 0 when the .dynsym section is excluded179## from the section header table.180 181# RUN: yaml2obj --docnum=4 %s -o %t4182# RUN: llvm-readelf --sections %t4 | FileCheck %s --check-prefix=EXCLUDED183 184# EXCLUDED: [Nr] Name         {{.*}} ES Flg Lk Inf185# EXCLUDED: [ 1] .gnu.version {{.*}} 02     0   0186 187--- !ELF188FileHeader:189  Class: ELFCLASS64190  Data:  ELFDATA2LSB191  Type:  ET_DYN192Sections:193  - Name: .gnu.version194    Type: SHT_GNU_versym195  - Name: .dynsym196    Type: SHT_DYNSYM197  - Type: SectionHeaderTable198    Sections:199      - Name: .gnu.version200      - Name: .strtab201      - Name: .shstrtab202    Excluded:203      - Name: .dynsym204