1## Check the values of sh_info fields set by default for 2## explicitly listed .dynstr, .dynsym, .strtab and .symtab 3## sections. 4## 5## For symbol table sections, sh_info has a value which is 6## one greater than the symbol table index of the last 7## local symbol. 8## 9## sh_info isn't set for string table sections. 10 11# RUN: yaml2obj --docnum=1 %s -o %t 12# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=CASE1 13 14# CASE1: Name: .symtab 15# CASE1: Info: 16# CASE1-SAME: 2 17# CASE1: Name: .strtab 18# CASE1: Info: 19# CASE1-SAME: 0 20# CASE1: Name: .dynsym 21# CASE1: Info: 22# CASE1-SAME: 1 23# CASE1: Name: .dynstr 24# CASE1: Info: 25# CASE1-SAME: 0 26 27--- !ELF 28FileHeader: 29 Class: ELFCLASS64 30 Data: ELFDATA2LSB 31 Type: ET_DYN 32Sections: 33 - Name: .symtab 34 Type: SHT_SYMTAB 35 - Name: .strtab 36 Type: SHT_STRTAB 37 - Name: .dynsym 38 Type: SHT_DYNSYM 39 - Name: .dynstr 40 Type: SHT_STRTAB 41Symbols: 42 - Name: local 43 - Name: global1 44 Binding: STB_GLOBAL 45DynamicSymbols: 46 - Name: global2 47 Binding: STB_GLOBAL 48 49## In the case when these sections are not defined in YAML, the 50## behavior is the same as when we define them, but do not set the Info. 51 52# RUN: yaml2obj --docnum=2 %s -o %t 53# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=CASE2 54 55# CASE2: Name: .dynsym 56# CASE2-NOT: Info: 57# CASE2: Info: 1{{$}} 58# CASE2: Name: .dynstr 59# CASE2-NOT: Info: 60# CASE2: Info: 0{{$}} 61# CASE2: Name: .symtab 62# CASE2-NOT: Info: 63# CASE2: Info: 2{{$}} 64# CASE2: Name: .strtab 65# CASE2-NOT: Info: 66# CASE2: Info: 0{{$}} 67 68--- !ELF 69FileHeader: 70 Class: ELFCLASS64 71 Data: ELFDATA2LSB 72 Type: ET_DYN 73Symbols: 74 - Name: local 75 - Name: global1 76 Binding: STB_GLOBAL 77DynamicSymbols: 78 - Name: global2 79 Binding: STB_GLOBAL 80 81## Check we are able to set any sh_info explicitly. 82 83# RUN: yaml2obj --docnum=3 %s -o %t 84# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=CASE3 85 86# CASE3: Name: .dynstr 87# CASE3: Info: 88# CASE3-SAME: 10 89# CASE3: Name: .dynsym 90# CASE3: Info: 91# CASE3-SAME: 11 92# CASE3: Name: .strtab 93# CASE3: Info: 94# CASE3-SAME: 12 95# CASE3: Name: .symtab 96# CASE3: Info: 97# CASE3-SAME: 13 98 99--- !ELF 100FileHeader: 101 Class: ELFCLASS64 102 Data: ELFDATA2LSB 103 Type: ET_DYN 104Sections: 105 - Name: .dynstr 106 Type: SHT_STRTAB 107 Info: 10 108 - Name: .dynsym 109 Type: SHT_DYNSYM 110 Info: 11 111 - Name: .strtab 112 Type: SHT_STRTAB 113 Info: 12 114 - Name: .symtab 115 Type: SHT_SYMTAB 116 Info: 13 117Symbols: 118 - Name: local 119 - Name: global1 120 Binding: STB_GLOBAL 121DynamicSymbols: 122 - Name: global2 123 Binding: STB_GLOBAL 124