474 lines · plain
1## Check that llvm-readelf and llvm-readobj can2## dump SHT_GROUP sections properly.3 4# RUN: yaml2obj %s -o %t.o5# RUN: llvm-readobj -g %t.o | FileCheck %s6# RUN: llvm-readobj --elf-section-groups %t.o | FileCheck %s7# RUN: llvm-readobj --elf-section-groups %t.o --elf-output-style=JSON --pretty-print | FileCheck %s --check-prefix=JSON8# RUN: llvm-readelf -g %t.o | FileCheck --check-prefix=GNU %s9 10# CHECK: Groups {11# CHECK-NEXT: Group {12# CHECK-NEXT: Name: .group13# CHECK-NEXT: Index: 114# CHECK-NEXT: Link: 715# CHECK-NEXT: Info: 116# CHECK-NEXT: Type: COMDAT17# CHECK-NEXT: Signature: foo18# CHECK-NEXT: Section(s) in group [19# CHECK-NEXT: .text.foo20# CHECK-NEXT: .rela.text.foo21# CHECK-NEXT: ]22# CHECK-NEXT: }23# CHECK-NEXT: Group {24# CHECK-NEXT: Name: .group125# CHECK-NEXT: Index: 226# CHECK-NEXT: Link: 727# CHECK-NEXT: Info: 228# CHECK-NEXT: Type: COMDAT29# CHECK-NEXT: Signature: bar30# CHECK-NEXT: Section(s) in group [31# CHECK-NEXT: .text.bar32# CHECK-NEXT: .rela.text.bar33# CHECK-NEXT: ]34# CHECK-NEXT: }35 36# GNU: COMDAT group section [ 1] `.group' [foo] contains 2 sections:37# GNU-NEXT: [Index] Name38# GNU-NEXT: [ 3] .text.foo39# GNU-NEXT: [ 4] .rela.text.foo40# GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections:41# GNU-NEXT: [Index] Name42# GNU-NEXT: [ 5] .text.bar43# GNU-NEXT: [ 6] .rela.text.bar44 45# JSON: "Groups": {46# JSON-NEXT: "Group": {47# JSON-NEXT: "Name": {48# JSON-NEXT: "Name": ".group",49# JSON-NEXT: "Value": 1650# 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": 157# JSON-NEXT: },58# JSON-NEXT: "Signature": "foo",59# JSON-NEXT: "GroupSections": [60# JSON-NEXT: {61# JSON-NEXT: "Name": ".text.foo",62# JSON-NEXT: "Index": 363# JSON-NEXT: },64# JSON-NEXT: {65# JSON-NEXT: "Name": ".rela.text.foo",66# JSON-NEXT: "Index": 467# 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": 6474# 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": 181# JSON-NEXT: },82# JSON-NEXT: "Signature": "bar",83# JSON-NEXT: "GroupSections": [84# JSON-NEXT: {85# JSON-NEXT: "Name": ".text.bar",86# JSON-NEXT: "Index": 587# JSON-NEXT: },88# JSON-NEXT: {89# JSON-NEXT: "Name": ".rela.text.bar",90# JSON-NEXT: "Index": 691# JSON-NEXT: }92# JSON-NEXT: ]93# JSON-NEXT: }94# JSON-NEXT: }95 96--- !ELF97FileHeader:98 Class: ELFCLASS6499 Data: ELFDATA2LSB100 Type: ET_REL101Sections:102 - Name: .group103 Type: SHT_GROUP104 Link: [[SYMTAB1=.symtab]]105 Info: foo106 Members:107 - SectionOrType: GRP_COMDAT108 - SectionOrType: .text.foo109 - SectionOrType: [[MEMBER1=.rela.text.foo]]110 ShSize: [[SECSIZE1=<none>]]111 ShName: [[GROUP1SHNAME=<none>]]112 - Name: .group1113 Type: SHT_GROUP114 Link: [[SYMTAB2=.symtab]]115 Info: bar116 Members:117 - SectionOrType: GRP_COMDAT118 - SectionOrType: [[MEMBER2=.text.bar]]119 - SectionOrType: .rela.text.bar120 ShSize: [[SECSIZE2=<none>]]121 - Name: .text.foo122 Type: SHT_PROGBITS123 - Name: .rela.text.foo124 Type: SHT_RELA125 Link: .symtab126 Info: .text.foo127 - Name: .text.bar128 Type: SHT_PROGBITS129 ShName: [[TEXTBARSHNAME=<none>]]130 - Name: .rela.text.bar131 Type: SHT_RELA132 Link: .symtab133 Info: .text.bar134 - Name: .symtab135 Type: SHT_SYMTAB136 Link: [[SYMTABLINK=.strtab]]137 - Name: .strtab138 Type: SHT_STRTAB139 Content: [[STRTABCONTENT=<none>]]140Symbols:141 - Name: foo142 Section: .text.foo143 StName: [[SYM1STNAME=<none>]]144 - Name: bar145 Section: .text.bar146 StName: [[SYM2STNAME=<none>]]147 148## Check that we report a warning and continue dumping when a section is included149## in two group sections at the same time.150 151# RUN: yaml2obj %s -DMEMBER2=.text.foo -o %t.dup.o152# RUN: llvm-readobj --section-groups %t.dup.o 2>&1 | FileCheck %s -DFILE=%t.dup.o --check-prefix=DUP-LLVM153# RUN: llvm-readelf --section-groups %t.dup.o 2>&1 | FileCheck %s -DFILE=%t.dup.o --check-prefix=DUP-GNU154 155# DUP-LLVM: Group {156# DUP-LLVM-NEXT: Name: .group157# DUP-LLVM-NEXT: Index: 1158# DUP-LLVM-NEXT: Link: 7159# DUP-LLVM-NEXT: Info: 1160# DUP-LLVM-NEXT: Type: COMDAT161# DUP-LLVM-NEXT: Signature: foo162# 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: .group1169# DUP-LLVM-NEXT: Index: 2170# DUP-LLVM-NEXT: Link: 7171# DUP-LLVM-NEXT: Info: 2172# DUP-LLVM-NEXT: Type: COMDAT173# DUP-LLVM-NEXT: Signature: bar174# 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 2176# 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] Name183# DUP-GNU-NEXT: [ 3] .text.foo184# DUP-GNU-NEXT: [ 4] .rela.text.foo185 186# DUP-GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections:187# DUP-GNU-NEXT: [Index] Name188# 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 2189# DUP-GNU-NEXT: [ 3] .text.foo190# DUP-GNU-NEXT: [ 6] .rela.text.bar191 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.o198# 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: 255205# SYMTAB-LLVM-NEXT: Group {206# SYMTAB-LLVM-NEXT: Name: .group (16)207# SYMTAB-LLVM-NEXT: Index: 1208# SYMTAB-LLVM-NEXT: Link: 7209# SYMTAB-LLVM-NEXT: Info: 1210# 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: 2220# SYMTAB-LLVM-NEXT: Link: 7221# SYMTAB-LLVM-NEXT: Info: 2222# 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: 255232# SYMTAB-GNU-EMPTY:233# SYMTAB-GNU-NEXT: COMDAT group section [ 1] `.group' [<?>] contains 2 sections:234# SYMTAB-GNU-NEXT: [Index] Name235# SYMTAB-GNU-NEXT: [ 3] .text.foo236# SYMTAB-GNU-NEXT: [ 4] .rela.text.foo237# SYMTAB-GNU-EMPTY:238# SYMTAB-GNU-NEXT: COMDAT group section [ 2] `.group1' [<?>] contains 2 sections:239# SYMTAB-GNU-NEXT: [Index] Name240# SYMTAB-GNU-NEXT: [ 5] .text.bar241# SYMTAB-GNU-NEXT: [ 6] .rela.text.bar242 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 the247## type of the linked section (we assume it is the symbol table) and checks that we report a warning248## when we are unable to read a signature symbol.249 250# RUN: yaml2obj %s -DSYMTAB1=0xFF -DSYMTAB2=0x1 -o %t.symtab2.o251# 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: 255258# 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 4259# SIGNATURE-LLVM: Group {260# SIGNATURE-LLVM: Name: .group (16)261# SIGNATURE-LLVM: Index: 1262# SIGNATURE-LLVM: Link: 255263# SIGNATURE-LLVM: Info: 1264# 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: 2274# SIGNATURE-LLVM: Link: 1275# SIGNATURE-LLVM: Info: 2276# 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: 255286# 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 4287# SIGNATURE-GNU-EMPTY:288# SIGNATURE-GNU-NEXT: COMDAT group section [ 1] `.group' [<?>] contains 2 sections:289# SIGNATURE-GNU-NEXT: [Index] Name290# SIGNATURE-GNU-NEXT: [ 3] .text.foo291# SIGNATURE-GNU-NEXT: [ 4] .rela.text.foo292# SIGNATURE-GNU-EMPTY:293# SIGNATURE-GNU-NEXT: COMDAT group section [ 2] `.group1' [<?>] contains 2 sections:294# SIGNATURE-GNU-NEXT: [Index] Name295# SIGNATURE-GNU-NEXT: [ 5] .text.bar296# SIGNATURE-GNU-NEXT: [ 6] .rela.text.bar297 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.o302# 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 empty309# 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: 1313# CONTENT-LLVM-NEXT: Link: 7314# CONTENT-LLVM-NEXT: Info: 1315# CONTENT-LLVM-NEXT: Type: (unknown) (0x0)316# CONTENT-LLVM-NEXT: Signature: foo317# 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: 2323# CONTENT-LLVM-NEXT: Link: 7324# CONTENT-LLVM-NEXT: Info: 2325# CONTENT-LLVM-NEXT: Type: (unknown) (0x0)326# CONTENT-LLVM-NEXT: Signature: bar327# 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 empty333# 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] Name337# CONTENT-GNU-EMPTY:338# CONTENT-GNU-NEXT: (unknown) group section [ 2] `.group1' [bar] contains 0 sections:339# CONTENT-GNU-NEXT: [Index] Name340 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.o344# 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 table351# 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 table352# NAME-LLVM-NEXT: Group {353# NAME-LLVM-NEXT: Name: <?> (43690)354# NAME-LLVM-NEXT: Index: 1355# NAME-LLVM-NEXT: Link: 7356# NAME-LLVM-NEXT: Info: 1357# NAME-LLVM-NEXT: Type: COMDAT (0x1)358# NAME-LLVM-NEXT: Signature: foo359# 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: 2367# NAME-LLVM-NEXT: Link: 7368# NAME-LLVM-NEXT: Info: 2369# NAME-LLVM-NEXT: Type: COMDAT (0x1)370# NAME-LLVM-NEXT: Signature: bar371# 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 table379# 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 table380# NAME-GNU-EMPTY:381# NAME-GNU-NEXT: COMDAT group section [ 1] `<?>' [foo] contains 2 sections:382# NAME-GNU-NEXT: [Index] Name383# NAME-GNU-NEXT: [ 3] .text.foo384# NAME-GNU-NEXT: [ 4] .rela.text.foo385# NAME-GNU-EMPTY:386# NAME-GNU-NEXT: COMDAT group section [ 2] `.group1' [bar] contains 2 sections:387# NAME-GNU-NEXT: [Index] Name388# NAME-GNU-NEXT: [ 5] <?>389# NAME-GNU-NEXT: [ 6] .rela.text.bar390 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.o394# 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: 238401# 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: 255402# MEMBER-LLVM-NEXT: Group {403# MEMBER-LLVM-NEXT: Name: .group (16)404# MEMBER-LLVM-NEXT: Index: 1405# MEMBER-LLVM-NEXT: Link: 7406# MEMBER-LLVM-NEXT: Info: 1407# MEMBER-LLVM-NEXT: Type: COMDAT (0x1)408# MEMBER-LLVM-NEXT: Signature: foo409# 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: 2417# MEMBER-LLVM-NEXT: Link: 7418# MEMBER-LLVM-NEXT: Info: 2419# MEMBER-LLVM-NEXT: Type: COMDAT (0x1)420# MEMBER-LLVM-NEXT: Signature: bar421# 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: 238429# 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: 255430# MEMBER-GNU-EMPTY:431# MEMBER-GNU-NEXT: COMDAT group section [ 1] `.group' [foo] contains 2 sections:432# MEMBER-GNU-NEXT: [Index] Name433# MEMBER-GNU-NEXT: [ 3] .text.foo434# 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] Name438# MEMBER-GNU-NEXT: [ 255] <?>439# MEMBER-GNU-NEXT: [ 6] .rela.text.bar440 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.o446# 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 0x5452 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.o462# 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 terminated468 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