1 ## Check that yaml2obj is able to produce output
2 ## when a symbol with section index SHN_XINDEX is used,
3 ## but no SHT_SYMTAB_SHNDX section is defined.
5 # RUN: yaml2obj --docnum=1 %s -o %t1
6 # RUN: not llvm-readobj --symbols 2>&1 %t1 | FileCheck -DFILE=%t1 %s --check-prefix=CASE1
8 # CASE1: error: '[[FILE]]': extended symbol index (1) is past the end of the SHT_SYMTAB_SHNDX section of size 0
23 ## Check that yaml2obj keeps the SHT_SYMTAB_SHNDX section in the output
24 ## even when symbol's section index value is low enough to not require the extended symtab.
25 ## Also, check that symbols in .symtab still have the SHN_XINDEX index.
27 # RUN: yaml2obj --docnum=2 %s -o %t2
28 # RUN: llvm-readobj --sections --symbols --section-data 2>&1 %t2 | FileCheck %s --check-prefix=CASE2
31 # CASE2: Name: .symtab_shndx (1)
32 # CASE2-NEXT: Type: SHT_SYMTAB_SHNDX (0x12)
34 # CASE2: Name: .symtab
35 # CASE2: SectionData (
36 # CASE2-NEXT: 0000: 00000000 00000000 00000000 00000000
37 # CASE2-NEXT: 0010: 00000000 00000000 00000000 0300FFFF
38 ## ^-- 0xFFFF here is a SHN_XINDEX.
39 # CASE2-NEXT: 0020: 00000000 00000000 00000000 00000000
43 # CASE2: Name: bar (0)
44 # CASE2-NEXT: Value: 0x0
46 # CASE2-NEXT: Binding: Local (0x0)
47 # CASE2-NEXT: Type: Section (0x3)
48 # CASE2-NEXT: Other: 0
49 # CASE2-NEXT: Section: bar (0x1)
62 Type: SHT_SYMTAB_SHNDX
69 ## Check that yaml2obj allows producing broken SHT_SYMTAB_SHNDX section
70 ## content (in the case below it contains 0xff as an index of a section,
71 ## which is larger than the total number of sections in the file).
73 # RUN: yaml2obj --docnum=3 %s -o %t3
74 # RUN: not llvm-readobj --symbols 2>&1 %t3 | FileCheck %s -DFILE=%t3 --check-prefix=CASE3
76 # CASE3: error: '[[FILE]]': invalid section index: 255
88 Type: SHT_SYMTAB_SHNDX
95 ## Check that yaml2obj reports an error if a symbol index does not fit into 2 bytes.
97 # RUN: not yaml2obj --docnum=4 %s -o %t4 2>&1 | FileCheck %s --check-prefix=CASE4
99 # CASE4: error: out of range hex16 number
111 ## Check we can set a custom sh_entsize for SHT_SYMTAB_SHNDX section.
113 # RUN: yaml2obj --docnum=5 %s -o %t5
114 # RUN: not llvm-readelf -S 2>&1 %t5 | FileCheck %s -DFILE=%t5 --check-prefix=CASE5
116 # CASE5: error: '[[FILE]]': section [index 1] has an invalid sh_entsize: 2
125 - Name: .symtab_shndx
126 Type: SHT_SYMTAB_SHNDX