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