1 ## Check that obj2yaml is able to dump a normal object which
2 ## contains the SHT_SYMTAB_SHNDX section and symbols with
3 ## section index == SHN_XINDEX.
5 # RUN: yaml2obj --docnum=1 %s -o %t1
6 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=CASE1
9 # CASE1-NEXT: FileHeader:
10 # CASE1-NEXT: Class: ELFCLASS64
11 # CASE1-NEXT: Data: ELFDATA2LSB
12 # CASE1-NEXT: Type: ET_REL
13 # CASE1-NEXT: Machine: EM_X86_64
14 # CASE1-NEXT: Sections:
15 # CASE1-NEXT: - Name: bar
16 # CASE1-NEXT: Type: SHT_PROGBITS
17 # CASE1-NEXT: - Name: .symtab_shndx
18 # CASE1-NEXT: Type: SHT_SYMTAB_SHNDX
19 # CASE1-NEXT: Link: .symtab
20 # CASE1-NEXT: EntSize: 0x0000000000000004
21 # CASE1-NEXT: Entries: [ 0, 1, 2 ]
22 # CASE1-NEXT: Symbols:
23 # CASE1-NEXT: - Name: bar
24 # CASE1-NEXT: Type: STT_SECTION
25 # CASE1-NEXT: Index: SHN_XINDEX
26 # CASE1-NEXT: - Name: .symtab_shndx
27 # CASE1-NEXT: Type: STT_SECTION
28 # CASE1-NEXT: Index: SHN_XINDEX
41 Type: SHT_SYMTAB_SHNDX
50 ## Check that yaml2obj is unable to dump an object, which has
51 ## symbols with section index == SHN_XINDEX, but no SHT_SYMTAB_SHNDX section.
53 # RUN: yaml2obj --docnum=2 %s -o %t2
54 # RUN: not obj2yaml %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=CASE2
56 # CASE2: Error reading file: [[FILE]]: extended symbol index (1) is past the end of the SHT_SYMTAB_SHNDX section of size 0
68 ## Check that yaml2obj is unable to dump an object, which has symbols with
69 ## section index == SHN_XINDEX, but SHT_SYMTAB_SHNDX table contains invalid indices
70 ## that are larger than total number of the sections.
72 # RUN: yaml2obj --docnum=3 %s -o %t3
73 # RUN: not obj2yaml %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=CASE3
75 # CASE3: Error reading file: [[FILE]]: invalid section index: 254
87 Type: SHT_SYMTAB_SHNDX
94 ## Check that yaml2obj is unable to dump an object, which has symbols with
95 ## section index == SHN_XINDEX, but SHT_SYMTAB_SHNDX table contains more
96 ## entries than the number of symbols in .symtab.
98 # RUN: yaml2obj --docnum=4 %s -o %t4
99 # RUN: not obj2yaml %t4 2>&1 | FileCheck %s -DFILE=%t4 --check-prefix=CASE4
101 ## FIXME: The error message below needs rewording. Size should not be equal to the number of symbols.
102 ## CASE4: Error reading file: [[FILE]]: SHT_SYMTAB_SHNDX section has sh_size (48) which is not equal to the number of symbols (3)
113 - Name: .symtab_shndx
114 Type: SHT_SYMTAB_SHNDX
121 ## ELF gABI allows having multiple SHT_SYMTAB_SHNDX sections.
122 ## We only support having one associated with .symtab now.
124 # RUN: yaml2obj --docnum=5 %s -o %t5
125 # RUN: not obj2yaml %t5 2>&1 | FileCheck %s -DFILE=%t5 --check-prefix=CASE5
127 # CASE5: Error reading file: [[FILE]]: multiple SHT_SYMTAB_SHNDX sections are not supported
136 - Name: .symtab_shndx1
137 Type: SHT_SYMTAB_SHNDX
141 - Name: .symtab_shndx2
142 Type: SHT_SYMTAB_SHNDX
147 ## Check that yaml2obj can't dump the object if SHT_SYMTAB_SHNDX is
148 ## not associated with a SHT_SYMTAB section (this case is illegal).
150 # RUN: yaml2obj --docnum=6 %s -o %t6
151 # RUN: not obj2yaml %t6 2>&1 | FileCheck %s -DFILE=%t6 --check-prefix=CASE6
153 # CASE6: Error reading file: [[FILE]]: SHT_SYMTAB_SHNDX section is linked with SHT_PROGBITS section (expected SHT_SYMTAB/SHT_DYNSYM)
162 - Name: .symtab_shndx
163 Type: SHT_SYMTAB_SHNDX
169 ## Check that yaml2obj can't dump the object if SHT_SYMTAB_SHNDX is
170 ## associated with a SHT_DYNSYM section (not implemented yet).
172 # RUN: yaml2obj --docnum=7 %s -o %t7
173 # RUN: not obj2yaml %t7 2>&1 | FileCheck %s -DFILE=%t7 --check-prefix=CASE7
175 # CASE7: Error reading file: [[FILE]]: only SHT_SYMTAB_SHNDX associated with SHT_SYMTAB are supported
184 - Name: .symtab_shndx
185 Type: SHT_SYMTAB_SHNDX