1## Check that llvm-readelf and llvm-readobj can 2## dump SHT_GROUP sections properly. 3 4# RUN: yaml2obj %s -o %t.o 5# RUN: llvm-readobj -g %t.o | FileCheck %s 6# RUN: llvm-readobj --elf-section-groups %t.o | FileCheck %s 7# RUN: llvm-readobj --elf-section-groups %t.o --elf-output-style=JSON --pretty-print | FileCheck %s --check-prefix=JSON 8# RUN: llvm-readelf -g %t.o | FileCheck --check-prefix=GNU %s 9 10# CHECK: Groups { 11# CHECK-NEXT: Group { 12# CHECK-NEXT: Name: .group 13# CHECK-NEXT: Index: 1 14# CHECK-NEXT: Link: 7 15# CHECK-NEXT: Info: 1 16# CHECK-NEXT: Type: COMDAT 17# CHECK-NEXT: Signature: foo 18# CHECK-NEXT: Section(s) in group [ 19# CHECK-NEXT: .text.foo 20# CHECK-NEXT: .rela.text.foo 21# CHECK-NEXT: ] 22# CHECK-NEXT: } 23# CHECK-NEXT: Group { 24# CHECK-NEXT: Name: .group1 25# CHECK-NEXT: Index: 2 26# CHECK-NEXT: Link: 7 27# CHECK-NEXT: Info: 2 28# CHECK-NEXT: Type: COMDAT 29# CHECK-NEXT: Signature: bar 30# CHECK-NEXT: Section(s) in group [ 31# CHECK-NEXT: .text.bar 32# CHECK-NEXT: .rela.text.bar 33# CHECK-NEXT: ] 34# CHECK-NEXT: } 35 36# GNU: COMDAT group section [ 1] `.group' [foo] contains 2 sections: 37# GNU-NEXT: [Index] Name 38# GNU-NEXT: [ 3] .text.foo 39# GNU-NEXT: [ 4] .rela.text.foo 40# GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections: 41# GNU-NEXT: [Index] Name 42# GNU-NEXT: [ 5] .text.bar 43# GNU-NEXT: [ 6] .rela.text.bar 44 45# JSON: "Groups": { 46# JSON-NEXT: "Group": { 47# JSON-NEXT: "Name": { 48# JSON-NEXT: "Name": ".group", 49# JSON-NEXT: "Value": 16 50# JSON-NEXT: }, 51# JSON-NEXT: "Index": 1, 52# JSON-NEXT: "Link": 7, 53# JSON-NEXT: "Info": 1, 54# JSON-NEXT: "Type": { 55# JSON-NEXT: "Name": "COMDAT", 56# JSON-NEXT: "Value": 1 57# JSON-NEXT: }, 58# JSON-NEXT: "Signature": "foo", 59# JSON-NEXT: "GroupSections": [ 60# JSON-NEXT: { 61# JSON-NEXT: "Name": ".text.foo", 62# JSON-NEXT: "Index": 3 63# JSON-NEXT: }, 64# JSON-NEXT: { 65# JSON-NEXT: "Name": ".rela.text.foo", 66# JSON-NEXT: "Index": 4 67# JSON-NEXT: } 68# JSON-NEXT: ] 69# JSON-NEXT: }, 70# JSON-NEXT: "Group": { 71# JSON-NEXT: "Name": { 72# JSON-NEXT: "Name": ".group1", 73# JSON-NEXT: "Value": 64 74# JSON-NEXT: }, 75# JSON-NEXT: "Index": 2, 76# JSON-NEXT: "Link": 7, 77# JSON-NEXT: "Info": 2, 78# JSON-NEXT: "Type": { 79# JSON-NEXT: "Name": "COMDAT", 80# JSON-NEXT: "Value": 1 81# JSON-NEXT: }, 82# JSON-NEXT: "Signature": "bar", 83# JSON-NEXT: "GroupSections": [ 84# JSON-NEXT: { 85# JSON-NEXT: "Name": ".text.bar", 86# JSON-NEXT: "Index": 5 87# JSON-NEXT: }, 88# JSON-NEXT: { 89# JSON-NEXT: "Name": ".rela.text.bar", 90# JSON-NEXT: "Index": 6 91# JSON-NEXT: } 92# JSON-NEXT: ] 93# JSON-NEXT: } 94# JSON-NEXT: } 95 96--- !ELF 97FileHeader: 98 Class: ELFCLASS64 99 Data: ELFDATA2LSB 100 Type: ET_REL 101Sections: 102 - Name: .group 103 Type: SHT_GROUP 104 Link: [[SYMTAB1=.symtab]] 105 Info: foo 106 Members: 107 - SectionOrType: GRP_COMDAT 108 - SectionOrType: .text.foo 109 - SectionOrType: [[MEMBER1=.rela.text.foo]] 110 ShSize: [[SECSIZE1=<none>]] 111 ShName: [[GROUP1SHNAME=<none>]] 112 - Name: .group1 113 Type: SHT_GROUP 114 Link: [[SYMTAB2=.symtab]] 115 Info: bar 116 Members: 117 - SectionOrType: GRP_COMDAT 118 - SectionOrType: [[MEMBER2=.text.bar]] 119 - SectionOrType: .rela.text.bar 120 ShSize: [[SECSIZE2=<none>]] 121 - Name: .text.foo 122 Type: SHT_PROGBITS 123 - Name: .rela.text.foo 124 Type: SHT_RELA 125 Link: .symtab 126 Info: .text.foo 127 - Name: .text.bar 128 Type: SHT_PROGBITS 129 ShName: [[TEXTBARSHNAME=<none>]] 130 - Name: .rela.text.bar 131 Type: SHT_RELA 132 Link: .symtab 133 Info: .text.bar 134 - Name: .symtab 135 Type: SHT_SYMTAB 136 Link: [[SYMTABLINK=.strtab]] 137 - Name: .strtab 138 Type: SHT_STRTAB 139 Content: [[STRTABCONTENT=<none>]] 140Symbols: 141 - Name: foo 142 Section: .text.foo 143 StName: [[SYM1STNAME=<none>]] 144 - Name: bar 145 Section: .text.bar 146 StName: [[SYM2STNAME=<none>]] 147 148## Check that we report a warning and continue dumping when a section is included 149## in two group sections at the same time. 150 151# RUN: yaml2obj %s -DMEMBER2=.text.foo -o %t.dup.o 152# RUN: llvm-readobj --section-groups %t.dup.o 2>&1 | FileCheck %s -DFILE=%t.dup.o --check-prefix=DUP-LLVM 153# RUN: llvm-readelf --section-groups %t.dup.o 2>&1 | FileCheck %s -DFILE=%t.dup.o --check-prefix=DUP-GNU 154 155# DUP-LLVM: Group { 156# DUP-LLVM-NEXT: Name: .group 157# DUP-LLVM-NEXT: Index: 1 158# DUP-LLVM-NEXT: Link: 7 159# DUP-LLVM-NEXT: Info: 1 160# DUP-LLVM-NEXT: Type: COMDAT 161# DUP-LLVM-NEXT: Signature: foo 162# DUP-LLVM-NEXT: Section(s) in group [ 163# DUP-LLVM-NEXT: .text.foo (3) 164# DUP-LLVM-NEXT: .rela.text.foo (4) 165# DUP-LLVM-NEXT: ] 166# DUP-LLVM-NEXT: } 167# DUP-LLVM: Group { 168# DUP-LLVM-NEXT: Name: .group1 169# DUP-LLVM-NEXT: Index: 2 170# DUP-LLVM-NEXT: Link: 7 171# DUP-LLVM-NEXT: Info: 2 172# DUP-LLVM-NEXT: Type: COMDAT 173# DUP-LLVM-NEXT: Signature: bar 174# DUP-LLVM-NEXT: Section(s) in group [ 175# DUP-LLVM-NEXT: warning: '[[FILE]]': section with index 3, included in the group section with index 1, was also found in the group section with index 2 176# DUP-LLVM-NEXT: .text.foo (3) 177# DUP-LLVM-NEXT: .rela.text.bar (6) 178# DUP-LLVM-NEXT: ] 179# DUP-LLVM-NEXT: } 180 181# DUP-GNU: COMDAT group section [ 1] `.group' [foo] contains 2 sections: 182# DUP-GNU-NEXT: [Index] Name 183# DUP-GNU-NEXT: [ 3] .text.foo 184# DUP-GNU-NEXT: [ 4] .rela.text.foo 185 186# DUP-GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections: 187# DUP-GNU-NEXT: [Index] Name 188# DUP-GNU-NEXT: warning: '[[FILE]]': section with index 3, included in the group section with index 1, was also found in the group section with index 2 189# DUP-GNU-NEXT: [ 3] .text.foo 190# DUP-GNU-NEXT: [ 6] .rela.text.bar 191 192## Check what we do when we are unable to dump the signature symbol name. 193## In this case the index of the string table section, linked to the symbol table used by a group section, 194## is broken (section does not exist). 195## Check we report a warning in this case. Check we don't print the same warning message twice. 196 197# RUN: yaml2obj %s -DSYMTABLINK=0xFF -o %t.symtab.o 198# RUN: llvm-readobj --section-groups %t.symtab.o 2>&1 | \ 199# RUN: FileCheck -DFILE=%t.symtab.o %s --check-prefix=SYMTAB-LLVM --implicit-check-not=warning: 200# RUN: llvm-readelf --section-groups %t.symtab.o 2>&1 | \ 201# RUN: FileCheck -DFILE=%t.symtab.o %s --check-prefix=SYMTAB-GNU --implicit-check-not=warning: 202 203# SYMTAB-LLVM: Groups { 204# SYMTAB-LLVM-NEXT: warning: '[[FILE]]': unable to get the string table for SHT_SYMTAB section with index 7: invalid section index: 255 205# SYMTAB-LLVM-NEXT: Group { 206# SYMTAB-LLVM-NEXT: Name: .group (16) 207# SYMTAB-LLVM-NEXT: Index: 1 208# SYMTAB-LLVM-NEXT: Link: 7 209# SYMTAB-LLVM-NEXT: Info: 1 210# SYMTAB-LLVM-NEXT: Type: COMDAT (0x1) 211# SYMTAB-LLVM-NEXT: Signature: <?> 212# SYMTAB-LLVM-NEXT: Section(s) in group [ 213# SYMTAB-LLVM-NEXT: .text.foo (3) 214# SYMTAB-LLVM-NEXT: .rela.text.foo (4) 215# SYMTAB-LLVM-NEXT: ] 216# SYMTAB-LLVM-NEXT: } 217# SYMTAB-LLVM-NEXT: Group { 218# SYMTAB-LLVM-NEXT: Name: .group1 (64) 219# SYMTAB-LLVM-NEXT: Index: 2 220# SYMTAB-LLVM-NEXT: Link: 7 221# SYMTAB-LLVM-NEXT: Info: 2 222# SYMTAB-LLVM-NEXT: Type: COMDAT (0x1) 223# SYMTAB-LLVM-NEXT: Signature: <?> 224# SYMTAB-LLVM-NEXT: Section(s) in group [ 225# SYMTAB-LLVM-NEXT: .text.bar (5) 226# SYMTAB-LLVM-NEXT: .rela.text.bar (6) 227# SYMTAB-LLVM-NEXT: ] 228# SYMTAB-LLVM-NEXT: } 229# SYMTAB-LLVM-NEXT: } 230 231# SYMTAB-GNU: warning: '[[FILE]]': unable to get the string table for SHT_SYMTAB section with index 7: invalid section index: 255 232# SYMTAB-GNU-EMPTY: 233# SYMTAB-GNU-NEXT: COMDAT group section [ 1] `.group' [<?>] contains 2 sections: 234# SYMTAB-GNU-NEXT: [Index] Name 235# SYMTAB-GNU-NEXT: [ 3] .text.foo 236# SYMTAB-GNU-NEXT: [ 4] .rela.text.foo 237# SYMTAB-GNU-EMPTY: 238# SYMTAB-GNU-NEXT: COMDAT group section [ 2] `.group1' [<?>] contains 2 sections: 239# SYMTAB-GNU-NEXT: [Index] Name 240# SYMTAB-GNU-NEXT: [ 5] .text.bar 241# SYMTAB-GNU-NEXT: [ 6] .rela.text.bar 242 243## This tests the behavior for two more cases when we are unable to dump the signature symbol name. 244## In the first case we link the group section to the section with index 255, which does not exist. 245## We check that a warning is reported when we are unable to locate the symbol table. 246## In the second case we link the SHT_GROUP section to itself. This documents that we don't check the 247## type of the linked section (we assume it is the symbol table) and checks that we report a warning 248## when we are unable to read a signature symbol. 249 250# RUN: yaml2obj %s -DSYMTAB1=0xFF -DSYMTAB2=0x1 -o %t.symtab2.o 251# RUN: llvm-readobj --section-groups %t.symtab2.o 2>&1 | \ 252# RUN: FileCheck -DFILE=%t.symtab2.o %s --check-prefix=SIGNATURE-LLVM --implicit-check-not=warning: 253# RUN: llvm-readelf --section-groups %t.symtab2.o 2>&1 | \ 254# RUN: FileCheck -DFILE=%t.symtab2.o %s --check-prefix=SIGNATURE-GNU --implicit-check-not=warning: 255 256# SIGNATURE: Groups { 257# SIGNATURE-LLVM: warning: '[[FILE]]': unable to get the symbol table for SHT_GROUP section with index 1: invalid section index: 255 258# SIGNATURE-LLVM: warning: '[[FILE]]': unable to get the signature symbol for SHT_GROUP section with index 2: section [index 1] has invalid sh_entsize: expected 24, but got 4 259# SIGNATURE-LLVM: Group { 260# SIGNATURE-LLVM: Name: .group (16) 261# SIGNATURE-LLVM: Index: 1 262# SIGNATURE-LLVM: Link: 255 263# SIGNATURE-LLVM: Info: 1 264# SIGNATURE-LLVM: Type: COMDAT (0x1) 265# SIGNATURE-LLVM: Signature: <?> 266# SIGNATURE-LLVM: Section(s) in group [ 267# SIGNATURE-LLVM: .text.foo (3) 268# SIGNATURE-LLVM: .rela.text.foo (4) 269# SIGNATURE-LLVM: ] 270# SIGNATURE-LLVM: } 271# SIGNATURE-LLVM: Group { 272# SIGNATURE-LLVM: Name: .group1 (64) 273# SIGNATURE-LLVM: Index: 2 274# SIGNATURE-LLVM: Link: 1 275# SIGNATURE-LLVM: Info: 2 276# SIGNATURE-LLVM: Type: COMDAT (0x1) 277# SIGNATURE-LLVM: Signature: <?> 278# SIGNATURE-LLVM: Section(s) in group [ 279# SIGNATURE-LLVM: .text.bar (5) 280# SIGNATURE-LLVM: .rela.text.bar (6) 281# SIGNATURE-LLVM: ] 282# SIGNATURE-LLVM: } 283# SIGNATURE-LLVM: } 284 285# SIGNATURE-GNU: warning: '[[FILE]]': unable to get the symbol table for SHT_GROUP section with index 1: invalid section index: 255 286# SIGNATURE-GNU-NEXT: warning: '[[FILE]]': unable to get the signature symbol for SHT_GROUP section with index 2: section [index 1] has invalid sh_entsize: expected 24, but got 4 287# SIGNATURE-GNU-EMPTY: 288# SIGNATURE-GNU-NEXT: COMDAT group section [ 1] `.group' [<?>] contains 2 sections: 289# SIGNATURE-GNU-NEXT: [Index] Name 290# SIGNATURE-GNU-NEXT: [ 3] .text.foo 291# SIGNATURE-GNU-NEXT: [ 4] .rela.text.foo 292# SIGNATURE-GNU-EMPTY: 293# SIGNATURE-GNU-NEXT: COMDAT group section [ 2] `.group1' [<?>] contains 2 sections: 294# SIGNATURE-GNU-NEXT: [Index] Name 295# SIGNATURE-GNU-NEXT: [ 5] .text.bar 296# SIGNATURE-GNU-NEXT: [ 6] .rela.text.bar 297 298## Check we report a warning when the content of the group section is empty or can't be read. 299## In both cases we are unable to read the section group flag and dump it as 0. 300 301# RUN: yaml2obj %s -DSECSIZE1=0x0 -DSECSIZE2=0x1 -o %t.secsize.o 302# RUN: llvm-readobj --section-groups %t.secsize.o 2>&1 | \ 303# RUN: FileCheck -DFILE=%t.secsize.o %s --check-prefix=CONTENT-LLVM --implicit-check-not=warning: 304# RUN: llvm-readelf --section-groups %t.secsize.o 2>&1 | \ 305# RUN: FileCheck -DFILE=%t.secsize.o %s --check-prefix=CONTENT-GNU --implicit-check-not=warning: 306 307# CONTENT-LLVM: Groups { 308# CONTENT-LLVM-NEXT: warning: '[[FILE]]': unable to read the section group flag from the SHT_GROUP section with index 1: the section is empty 309# CONTENT-LLVM-NEXT: warning: '[[FILE]]': unable to get the content of the SHT_GROUP section with index 2: section [index 2] has an invalid sh_size (1) which is not a multiple of its sh_entsize (4) 310# CONTENT-LLVM-NEXT: Group { 311# CONTENT-LLVM-NEXT: Name: .group (16) 312# CONTENT-LLVM-NEXT: Index: 1 313# CONTENT-LLVM-NEXT: Link: 7 314# CONTENT-LLVM-NEXT: Info: 1 315# CONTENT-LLVM-NEXT: Type: (unknown) (0x0) 316# CONTENT-LLVM-NEXT: Signature: foo 317# CONTENT-LLVM-NEXT: Section(s) in group [ 318# CONTENT-LLVM-NEXT: ] 319# CONTENT-LLVM-NEXT: } 320# CONTENT-LLVM-NEXT: Group { 321# CONTENT-LLVM-NEXT: Name: .group1 (64) 322# CONTENT-LLVM-NEXT: Index: 2 323# CONTENT-LLVM-NEXT: Link: 7 324# CONTENT-LLVM-NEXT: Info: 2 325# CONTENT-LLVM-NEXT: Type: (unknown) (0x0) 326# CONTENT-LLVM-NEXT: Signature: bar 327# CONTENT-LLVM-NEXT: Section(s) in group [ 328# CONTENT-LLVM-NEXT: ] 329# CONTENT-LLVM-NEXT: } 330# CONTENT-LLVM-NEXT: } 331 332# CONTENT-GNU: warning: '[[FILE]]': unable to read the section group flag from the SHT_GROUP section with index 1: the section is empty 333# CONTENT-GNU: warning: '[[FILE]]': unable to get the content of the SHT_GROUP section with index 2: section [index 2] has an invalid sh_size (1) which is not a multiple of its sh_entsize (4) 334# CONTENT-GNU-EMPTY: 335# CONTENT-GNU-NEXT: (unknown) group section [ 1] `.group' [foo] contains 0 sections: 336# CONTENT-GNU-NEXT: [Index] Name 337# CONTENT-GNU-EMPTY: 338# CONTENT-GNU-NEXT: (unknown) group section [ 2] `.group1' [bar] contains 0 sections: 339# CONTENT-GNU-NEXT: [Index] Name 340 341## Check that we emit a warning when we are unable to read the group section name or the name of a member. 342 343# RUN: yaml2obj %s -DGROUP1SHNAME=0xAAAA -DTEXTBARSHNAME=0xBBBB -o %t.name.o 344# RUN: llvm-readobj --section-groups %t.name.o 2>&1 | \ 345# RUN: FileCheck -DFILE=%t.name.o %s --check-prefix=NAME-LLVM --implicit-check-not=warning: 346# RUN: llvm-readelf --section-groups %t.name.o 2>&1 | \ 347# RUN: FileCheck -DFILE=%t.name.o %s --check-prefix=NAME-GNU --implicit-check-not=warning: 348 349# NAME-LLVM: Groups { 350# NAME-LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_GROUP section with index 1: a section [index 1] has an invalid sh_name (0xaaaa) offset which goes past the end of the section name string table 351# NAME-LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_PROGBITS section with index 5: a section [index 5] has an invalid sh_name (0xbbbb) offset which goes past the end of the section name string table 352# NAME-LLVM-NEXT: Group { 353# NAME-LLVM-NEXT: Name: <?> (43690) 354# NAME-LLVM-NEXT: Index: 1 355# NAME-LLVM-NEXT: Link: 7 356# NAME-LLVM-NEXT: Info: 1 357# NAME-LLVM-NEXT: Type: COMDAT (0x1) 358# NAME-LLVM-NEXT: Signature: foo 359# NAME-LLVM-NEXT: Section(s) in group [ 360# NAME-LLVM-NEXT: .text.foo (3) 361# NAME-LLVM-NEXT: .rela.text.foo (4) 362# NAME-LLVM-NEXT: ] 363# NAME-LLVM-NEXT: } 364# NAME-LLVM-NEXT: Group { 365# NAME-LLVM-NEXT: Name: .group1 (64) 366# NAME-LLVM-NEXT: Index: 2 367# NAME-LLVM-NEXT: Link: 7 368# NAME-LLVM-NEXT: Info: 2 369# NAME-LLVM-NEXT: Type: COMDAT (0x1) 370# NAME-LLVM-NEXT: Signature: bar 371# NAME-LLVM-NEXT: Section(s) in group [ 372# NAME-LLVM-NEXT: <?> (5) 373# NAME-LLVM-NEXT: .rela.text.bar (6) 374# NAME-LLVM-NEXT: ] 375# NAME-LLVM-NEXT: } 376# NAME-LLVM-NEXT: } 377 378# NAME-GNU: warning: '[[FILE]]': unable to get the name of SHT_GROUP section with index 1: a section [index 1] has an invalid sh_name (0xaaaa) offset which goes past the end of the section name string table 379# NAME-GNU-NEXT: warning: '[[FILE]]': unable to get the name of SHT_PROGBITS section with index 5: a section [index 5] has an invalid sh_name (0xbbbb) offset which goes past the end of the section name string table 380# NAME-GNU-EMPTY: 381# NAME-GNU-NEXT: COMDAT group section [ 1] `<?>' [foo] contains 2 sections: 382# NAME-GNU-NEXT: [Index] Name 383# NAME-GNU-NEXT: [ 3] .text.foo 384# NAME-GNU-NEXT: [ 4] .rela.text.foo 385# NAME-GNU-EMPTY: 386# NAME-GNU-NEXT: COMDAT group section [ 2] `.group1' [bar] contains 2 sections: 387# NAME-GNU-NEXT: [Index] Name 388# NAME-GNU-NEXT: [ 5] <?> 389# NAME-GNU-NEXT: [ 6] .rela.text.bar 390 391## Check we report a warning then the section index of a section group member is invalid. 392 393# RUN: yaml2obj %s -DMEMBER1=0xEE -DMEMBER2=0xFF -o %t.member.index.o 394# RUN: llvm-readobj --section-groups %t.member.index.o 2>&1 | \ 395# RUN: FileCheck -DFILE=%t.member.index.o %s --check-prefix=MEMBER-LLVM --implicit-check-not=warning: 396# RUN: llvm-readelf --section-groups %t.member.index.o 2>&1 | \ 397# RUN: FileCheck -DFILE=%t.member.index.o %s --check-prefix=MEMBER-GNU --implicit-check-not=warning: 398 399# MEMBER-LLVM: Groups { 400# MEMBER-LLVM-NEXT: warning: '[[FILE]]': unable to get the section with index 238 when dumping the SHT_GROUP section with index 1: invalid section index: 238 401# MEMBER-LLVM-NEXT: warning: '[[FILE]]': unable to get the section with index 255 when dumping the SHT_GROUP section with index 2: invalid section index: 255 402# MEMBER-LLVM-NEXT: Group { 403# MEMBER-LLVM-NEXT: Name: .group (16) 404# MEMBER-LLVM-NEXT: Index: 1 405# MEMBER-LLVM-NEXT: Link: 7 406# MEMBER-LLVM-NEXT: Info: 1 407# MEMBER-LLVM-NEXT: Type: COMDAT (0x1) 408# MEMBER-LLVM-NEXT: Signature: foo 409# MEMBER-LLVM-NEXT: Section(s) in group [ 410# MEMBER-LLVM-NEXT: .text.foo (3) 411# MEMBER-LLVM-NEXT: <?> (238) 412# MEMBER-LLVM-NEXT: ] 413# MEMBER-LLVM-NEXT: } 414# MEMBER-LLVM-NEXT: Group { 415# MEMBER-LLVM-NEXT: Name: .group1 (64) 416# MEMBER-LLVM-NEXT: Index: 2 417# MEMBER-LLVM-NEXT: Link: 7 418# MEMBER-LLVM-NEXT: Info: 2 419# MEMBER-LLVM-NEXT: Type: COMDAT (0x1) 420# MEMBER-LLVM-NEXT: Signature: bar 421# MEMBER-LLVM-NEXT: Section(s) in group [ 422# MEMBER-LLVM-NEXT: <?> (255) 423# MEMBER-LLVM-NEXT: .rela.text.bar (6) 424# MEMBER-LLVM-NEXT: ] 425# MEMBER-LLVM-NEXT: } 426# MEMBER-LLVM-NEXT: } 427 428# MEMBER-GNU: warning: '[[FILE]]': unable to get the section with index 238 when dumping the SHT_GROUP section with index 1: invalid section index: 238 429# MEMBER-GNU-NEXT: warning: '[[FILE]]': unable to get the section with index 255 when dumping the SHT_GROUP section with index 2: invalid section index: 255 430# MEMBER-GNU-EMPTY: 431# MEMBER-GNU-NEXT: COMDAT group section [ 1] `.group' [foo] contains 2 sections: 432# MEMBER-GNU-NEXT: [Index] Name 433# MEMBER-GNU-NEXT: [ 3] .text.foo 434# MEMBER-GNU-NEXT: [ 238] <?> 435# MEMBER-GNU-EMPTY: 436# MEMBER-GNU-NEXT: COMDAT group section [ 2] `.group1' [bar] contains 2 sections: 437# MEMBER-GNU-NEXT: [Index] Name 438# MEMBER-GNU-NEXT: [ 255] <?> 439# MEMBER-GNU-NEXT: [ 6] .rela.text.bar 440 441## Check warnings that are reported when the st_name field of the signature symbol goes past the end of the string table. 442 443## We set the content of the string table to '0061626300' ('\0abc\0') to fixup the size of the string table. 444## This makes it easier to test the boundary conditions. 445# RUN: yaml2obj %s -DSTRTABCONTENT="0061626300" -DSYM1STNAME=4 -DSYM2STNAME=5 -o %t.signame.o 446# RUN: llvm-readobj --section-groups %t.signame.o 2>&1 | \ 447# RUN: FileCheck -DFILE=%t.signame.o %s --check-prefixes=SIGNAME1-WARN,SIGNAME1-LLVM --implicit-check-not=warning: 448# RUN: llvm-readelf --section-groups %t.signame.o 2>&1 | \ 449# RUN: FileCheck -DFILE=%t.signame.o %s --check-prefixes=SIGNAME1-WARN,SIGNAME1-GNU --implicit-check-not=warning: 450 451# SIGNAME1-WARN: warning: '[[FILE]]': unable to get the name of the symbol with index 2: st_name (0x5) is past the end of the string table of size 0x5 452 453# SIGNAME1-LLVM: Signature: {{$}} 454# SIGNAME1-LLVM: Signature: <?> 455 456# SIGNAME1-GNU: COMDAT group section [ 1] `.group' [] contains 2 sections: 457# SIGNAME1-GNU: COMDAT group section [ 2] `.group1' [<?>] contains 2 sections: 458 459## Check we report a warning when the string table that contains the signature symbol name is not null-terminated. 460 461# RUN: yaml2obj %s -DSTRTABCONTENT="0061626361" -DSYM1STNAME=4 -DSYM2STNAME=5 -o %t.signame2.o 462# RUN: llvm-readobj --section-groups %t.signame2.o 2>&1 | \ 463# RUN: FileCheck -DFILE=%t.signame2.o %s --check-prefixes=SIGNAME2-WARN,SIGNAME2-LLVM --implicit-check-not=warning: 464# RUN: llvm-readelf --section-groups %t.signame2.o 2>&1 | \ 465# RUN: FileCheck -DFILE=%t.signame2.o %s --check-prefixes=SIGNAME2-WARN,SIGNAME2-GNU --implicit-check-not=warning: 466 467# SIGNAME2-WARN: warning: '[[FILE]]': unable to get the string table for SHT_SYMTAB section with index 7: SHT_STRTAB string table section [index 8] is non-null terminated 468 469# SIGNAME2-LLVM: Signature: <?> 470# SIGNAME2-LLVM: Signature: <?> 471 472# SIGNAME2-GNU: COMDAT group section [ 1] `.group' [<?>] contains 2 sections: 473# SIGNAME2-GNU: COMDAT group section [ 2] `.group1' [<?>] contains 2 sections: 474