1## Check that yaml2obj is able to produce an object from YAML 2## containing sections with duplicate names (but different name suffixes). 3 4# RUN: yaml2obj --docnum=1 %s -o %t1 5# RUN: llvm-readelf -sections %t1 | FileCheck %s --check-prefix=CASE1 6 7# CASE1: [Nr] Name Type 8# CASE1: [ 1] .foo1 PROGBITS 9# CASE1-NEXT: [ 2] .foo PROGBITS 10# CASE1-NEXT: [ 3] .foo PROGBITS 11# CASE1-NEXT: [ 4] .foo2 PROGBITS 12# CASE1-NEXT: [ 5] .foo2 ( PROGBITS 13# CASE1-NEXT: [ 6] .foo2 ) PROGBITS 14# CASE1-NEXT: [ 7] .foo2 PROGBITS 15 16--- !ELF 17FileHeader: 18 Class: ELFCLASS64 19 Data: ELFDATA2LSB 20 Type: ET_REL 21Sections: 22 - Name: .foo1 23 Type: SHT_PROGBITS 24 - Name: .foo 25 Type: SHT_PROGBITS 26 - Name: '.foo (1)' 27 Type: SHT_PROGBITS 28 - Name: .foo2 29 Type: SHT_PROGBITS 30 - Name: '.foo2 (' 31 Type: SHT_PROGBITS 32 - Name: '.foo2 )' 33 Type: SHT_PROGBITS 34 - Name: '.foo2 ()' 35 Type: SHT_PROGBITS 36 37## Check that yaml2obj reports an error in case we have 38## sections with equal names and suffixes. 39 40# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=CASE2 41# CASE2: error: repeated section/fill name: '.foo (1)' at YAML section/fill number 2 42# CASE2: error: repeated section/fill name: '.foo (1)' at YAML section/fill number 3 43 44--- !ELF 45FileHeader: 46 Class: ELFCLASS64 47 Data: ELFDATA2LSB 48 Type: ET_REL 49Sections: 50 - Name: '.foo (1)' 51 Type: SHT_PROGBITS 52 - Name: '.foo (1)' 53 Type: SHT_PROGBITS 54 - Name: '.foo (1)' 55 Type: SHT_PROGBITS 56 57## Check that yaml2obj reports an error in case we have 58## symbols without suffixes in the names and their 59## names are equal. 60 61# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=CASE3 62# CASE3: error: repeated section/fill name: '.foo' at YAML section/fill number 2 63 64--- !ELF 65FileHeader: 66 Class: ELFCLASS64 67 Data: ELFDATA2LSB 68 Type: ET_REL 69Sections: 70 - Name: .foo 71 Type: SHT_PROGBITS 72 - Name: .foo 73 Type: SHT_PROGBITS 74 75## Check that yaml2obj can produce an object when symbols are defined 76## relative to sections with duplicate names (but different name suffixes). 77 78# RUN: yaml2obj --docnum=4 %s -o %t4 79# RUN: llvm-readobj -s -t %t4 | FileCheck %s --check-prefix=CASE4 80 81# CASE4: Section { 82# CASE4: Index: 1 83# CASE4-NEXT: Name: .foo 84# CASE4: Index: 2 85# CASE4-NEXT: Name: .foo 86 87# CASE4: Symbol { 88# CASE4: Name: foo 89# 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: bar 96# 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--- !ELF 104FileHeader: 105 Class: ELFCLASS64 106 Data: ELFDATA2LSB 107 Type: ET_REL 108Sections: 109 - Name: .foo 110 Type: SHT_PROGBITS 111 - Name: '.foo (1)' 112 Type: SHT_PROGBITS 113Symbols: 114 - Name: foo 115 Section: .foo 116 - Name: bar 117 Section: '.foo (1)' 118 119## Check that yaml2obj can produce SHT_GROUP sections that 120## reference sections and symbols with name suffixes. 121 122# RUN: yaml2obj --docnum=5 %s -o %t5 123# RUN: llvm-readobj --elf-section-groups %t5 | FileCheck %s --check-prefix=CASE5 124 125# CASE5: Groups { 126# CASE5-NEXT: Group { 127# CASE5-NEXT: Name: .group (1) 128# CASE5-NEXT: Index: 1 129# CASE5-NEXT: Link: 5 130# CASE5-NEXT: Info: 1 131# CASE5-NEXT: Type: COMDAT (0x1) 132# CASE5-NEXT: Signature: foo 133# 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: 3 140# CASE5-NEXT: Link: 5 141# CASE5-NEXT: Info: 2 142# CASE5-NEXT: Type: COMDAT (0x1) 143# CASE5-NEXT: Signature: foo 144# CASE5-NEXT: Section(s) in group [ 145# CASE5-NEXT: .text.foo (4) 146# CASE5-NEXT: ] 147# CASE5-NEXT: } 148# CASE5-NEXT: } 149 150--- !ELF 151FileHeader: 152 Class: ELFCLASS64 153 Data: ELFDATA2LSB 154 Type: ET_REL 155Sections: 156 - Name: .group 157 Type: SHT_GROUP 158 Info: foo 159 Members: 160 - SectionOrType: GRP_COMDAT 161 - SectionOrType: .text.foo 162 - Name: .text.foo 163 Type: SHT_PROGBITS 164 - Name: '.group (1)' 165 Type: SHT_GROUP 166 Info: 'foo (1)' 167 Members: 168 - SectionOrType: GRP_COMDAT 169 - SectionOrType: '.text.foo (1)' 170 - Name: '.text.foo (1)' 171 Type: SHT_PROGBITS 172Symbols: 173 - Name: foo 174 Section: .text.foo 175 - Name: 'foo (1)' 176 Section: '.text.foo (1)' 177