# GNU: Section header string table index: 255
# GNU-NEXT: There are 3 section headers, starting at offset 0x58:
# GNU: Section Headers:
-# GNU-NEXT: [Nr] Name
-# GNU-NEXT: error: '[[FILE]]': section header string table index 255 does not exist
+# GNU-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
+# GNU-NEXT: warning: '[[FILE]]': section header string table index 255 does not exist
+# GNU-NEXT: [ 0] <no-strings> NULL 0000000000000000 000000 000000 00 0 0 0
+# GNU-NEXT: [ 1] <no-strings> STRTAB 0000000000000000 000040 000001 00 0 0 1
+# GNU-NEXT: [ 2] <no-strings> STRTAB 0000000000000000 000041 000013 00 0 0 1
+# GNU-NEXT: Key to Flags:
+# GNU: Section to Segment mapping:
+# GNU-NEXT: Segment Sections...
+# GNU-NEXT: error: '[[FILE]]': section header string table index 255 does not exist
# LLVM: ElfHeader {
# LLVM: StringTableSectionIndex: 255
# RUN: yaml2obj --docnum=2 %s -o %t2
-# RUN: not llvm-readelf --file-headers --sections %t2 2>&1 | \
+# RUN: llvm-readelf --file-headers --sections %t2 2>&1 | \
# RUN: FileCheck %s -DFILE=%t2 --check-prefix=GNU2
# GNU2: Number of section headers: 0
# GNU2: Section header string table index: 65535 (corrupt: out of range)
# GNU2-EMPTY:
# GNU2-NEXT: Section Headers:
# GNU2-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
-# GNU2-NEXT: error: '[[FILE]]': e_shstrndx == SHN_XINDEX, but the section header table is empty
+# GNU2-NEXT: warning: '[[FILE]]': e_shstrndx == SHN_XINDEX, but the section header table is empty
+# GNU2-NEXT: Key to Flags:
# RUN: llvm-readobj --file-headers --sections %t2 | \
# RUN: FileCheck %s --check-prefix=LLVM2 --implicit-check-not="warning:"
printField(F);
OS << "\n";
- const ELFObjectFile<ELFT> *ElfObj = this->dumper()->getElfObject();
- StringRef SecStrTable = unwrapOrError<StringRef>(
- ElfObj->getFileName(),
- Obj->getSectionStringTable(Sections, this->dumper()->WarningHandler));
+ StringRef SecStrTable;
+ if (Expected<StringRef> SecStrTableOrErr =
+ Obj->getSectionStringTable(Sections, this->dumper()->WarningHandler))
+ SecStrTable = *SecStrTableOrErr;
+ else
+ this->reportUniqueWarning(SecStrTableOrErr.takeError());
+
size_t SectionIndex = 0;
for (const Elf_Shdr &Sec : Sections) {
Fields[0].Str = to_string(SectionIndex);
Fields[1].Str = "<no-strings>";
else
Fields[1].Str = std::string(unwrapOrError<StringRef>(
- ElfObj->getFileName(), Obj->getSectionName(&Sec, SecStrTable)));
+ this->FileName, Obj->getSectionName(&Sec, SecStrTable)));
Fields[2].Str =
getSectionTypeString(Obj->getHeader()->e_machine, Sec.sh_type);
Fields[3].Str =