177 lines · yaml
1## Check that yaml2obj is able to produce an object from YAML2## containing sections with duplicate names (but different name suffixes).3 4# RUN: yaml2obj --docnum=1 %s -o %t15# RUN: llvm-readelf -S %t1 | FileCheck %s --check-prefix=CASE16 7# CASE1: [Nr] Name Type8# CASE1: [ 1] .foo1 PROGBITS9# CASE1-NEXT: [ 2] .foo PROGBITS10# CASE1-NEXT: [ 3] .foo PROGBITS11# CASE1-NEXT: [ 4] .foo2 PROGBITS12# CASE1-NEXT: [ 5] .foo2 ( PROGBITS13# CASE1-NEXT: [ 6] .foo2 ) PROGBITS14# CASE1-NEXT: [ 7] .foo2 PROGBITS15 16--- !ELF17FileHeader:18 Class: ELFCLASS6419 Data: ELFDATA2LSB20 Type: ET_REL21Sections:22 - Name: .foo123 Type: SHT_PROGBITS24 - Name: .foo25 Type: SHT_PROGBITS26 - Name: '.foo (1)'27 Type: SHT_PROGBITS28 - Name: .foo229 Type: SHT_PROGBITS30 - Name: '.foo2 ('31 Type: SHT_PROGBITS32 - Name: '.foo2 )'33 Type: SHT_PROGBITS34 - Name: '.foo2 ()'35 Type: SHT_PROGBITS36 37## Check that yaml2obj reports an error in case we have38## sections with equal names and suffixes.39 40# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=CASE241# CASE2: error: repeated section/fill name: '.foo (1)' at YAML section/fill number 242# CASE2: error: repeated section/fill name: '.foo (1)' at YAML section/fill number 343 44--- !ELF45FileHeader:46 Class: ELFCLASS6447 Data: ELFDATA2LSB48 Type: ET_REL49Sections:50 - Name: '.foo (1)'51 Type: SHT_PROGBITS52 - Name: '.foo (1)'53 Type: SHT_PROGBITS54 - Name: '.foo (1)'55 Type: SHT_PROGBITS56 57## Check that yaml2obj reports an error in case we have58## symbols without suffixes in the names and their59## names are equal.60 61# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=CASE362# CASE3: error: repeated section/fill name: '.foo' at YAML section/fill number 263 64--- !ELF65FileHeader:66 Class: ELFCLASS6467 Data: ELFDATA2LSB68 Type: ET_REL69Sections:70 - Name: .foo71 Type: SHT_PROGBITS72 - Name: .foo73 Type: SHT_PROGBITS74 75## Check that yaml2obj can produce an object when symbols are defined76## relative to sections with duplicate names (but different name suffixes).77 78# RUN: yaml2obj --docnum=4 %s -o %t479# RUN: llvm-readobj -s -t %t4 | FileCheck %s --check-prefix=CASE480 81# CASE4: Section {82# CASE4: Index: 183# CASE4-NEXT: Name: .foo84# CASE4: Index: 285# CASE4-NEXT: Name: .foo86 87# CASE4: Symbol {88# CASE4: Name: foo89# CASE4-NEXT: Value:90# CASE4-NEXT: Size:91# CASE4-NEXT: Binding:92# CASE4-NEXT: Type:93# CASE4-NEXT: Other:94# CASE4-NEXT: Section: .foo (0x1)95# CASE4: Name: bar96# CASE4-NEXT: Value:97# CASE4-NEXT: Size:98# CASE4-NEXT: Binding:99# CASE4-NEXT: Type:100# CASE4-NEXT: Other:101# CASE4-NEXT: Section: .foo (0x2)102 103--- !ELF104FileHeader:105 Class: ELFCLASS64106 Data: ELFDATA2LSB107 Type: ET_REL108Sections:109 - Name: .foo110 Type: SHT_PROGBITS111 - Name: '.foo (1)'112 Type: SHT_PROGBITS113Symbols:114 - Name: foo115 Section: .foo116 - Name: bar117 Section: '.foo (1)'118 119## Check that yaml2obj can produce SHT_GROUP sections that120## reference sections and symbols with name suffixes.121 122# RUN: yaml2obj --docnum=5 %s -o %t5123# RUN: llvm-readobj --section-groups %t5 | FileCheck %s --check-prefix=CASE5124 125# CASE5: Groups {126# CASE5-NEXT: Group {127# CASE5-NEXT: Name: .group (1)128# CASE5-NEXT: Index: 1129# CASE5-NEXT: Link: 5130# CASE5-NEXT: Info: 1131# CASE5-NEXT: Type: COMDAT (0x1)132# CASE5-NEXT: Signature: foo133# CASE5-NEXT: Section(s) in group [134# CASE5-NEXT: .text.foo (2)135# CASE5-NEXT: ]136# CASE5-NEXT: }137# CASE5-NEXT: Group {138# CASE5-NEXT: Name: .group (1)139# CASE5-NEXT: Index: 3140# CASE5-NEXT: Link: 5141# CASE5-NEXT: Info: 2142# CASE5-NEXT: Type: COMDAT (0x1)143# CASE5-NEXT: Signature: foo144# CASE5-NEXT: Section(s) in group [145# CASE5-NEXT: .text.foo (4)146# CASE5-NEXT: ]147# CASE5-NEXT: }148# CASE5-NEXT: }149 150--- !ELF151FileHeader:152 Class: ELFCLASS64153 Data: ELFDATA2LSB154 Type: ET_REL155Sections:156 - Name: .group157 Type: SHT_GROUP158 Info: foo159 Members:160 - SectionOrType: GRP_COMDAT161 - SectionOrType: .text.foo162 - Name: .text.foo163 Type: SHT_PROGBITS164 - Name: '.group (1)'165 Type: SHT_GROUP166 Info: 'foo (1)'167 Members:168 - SectionOrType: GRP_COMDAT169 - SectionOrType: '.text.foo (1)'170 - Name: '.text.foo (1)'171 Type: SHT_PROGBITS172Symbols:173 - Name: foo174 Section: .text.foo175 - Name: 'foo (1)'176 Section: '.text.foo (1)'177