1## Check we do not fail to dump the section headers when
2## a .shstrtab section does not have a SHT_STRTAB type.
3
4## Check we report only one warning for the issue for each input object.
5
6# RUN: yaml2obj %s -o %t1
7# RUN: llvm-readobj -S %t1 2>&1 | FileCheck %s -DFILE=%t1 --implicit-check-not warning --check-prefix LLVM
8# RUN: llvm-readelf -S %t1 2>&1 | FileCheck %s -DFILE=%t1 --implicit-check-not warning --check-prefix GNU
9
10# LLVM: warning: '[[FILE]]': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS
11# LLVM:  Section {
12# LLVM:    Name: .shstrtab
13# LLVM:    Type: SHT_PROGBITS
14
15# GNU: Section Headers:
16# GNU:   [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
17# GNU: warning: '[[FILE]]': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS
18# GNU:   [ 1] .shstrtab         PROGBITS        0000000000000000 000040 000013 00 0   0  0
19
20## Test we report multiple identical warnings (one for each object) when dumping an archive.
21
22# RUN: rm -f %t.a
23# RUN: cp %t1 %t2
24# RUN: llvm-ar rc %t.a %t1 %t2 %t1
25# RUN: llvm-readobj -S %t.a 2>&1 | FileCheck %s --implicit-check-not warning --check-prefix WARNINGS
26# RUN: llvm-readelf -S %t.a 2>&1 | FileCheck %s --implicit-check-not warning --check-prefix WARNINGS
27
28# WARNINGS: warning: '{{.*}}1': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS
29# WARNINGS: warning: '{{.*}}2': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS
30# WARNINGS: warning: '{{.*}}1': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS
31
32## Test we report the warning for each input file specified on the command line.
33
34# RUN: llvm-readobj -S %t1 %t2 %t1 2>&1 | FileCheck %s --implicit-check-not warning --check-prefix WARNINGS
35# RUN: llvm-readelf -S %t1 %t2 %t1 2>&1 | FileCheck %s --implicit-check-not warning --check-prefix WARNINGS
36
37--- !ELF
38FileHeader:
39  Class: ELFCLASS64
40  Data:  ELFDATA2LSB
41  Type:  ET_DYN
42Sections:
43  - Name: .shstrtab
44    Type: SHT_PROGBITS
45