[PATCH] D71017: [llvm-readelf/llvm-readobj] - Remove getSecTypeName() helper.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 00:05:18 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe00e5d3347a3: [llvm-readelf/llvm-readobj] - Remove getSecTypeName() helper. (authored by grimar).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71017/new/
https://reviews.llvm.org/D71017
Files:
llvm/tools/llvm-readobj/ELFDumper.cpp
Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -344,16 +344,6 @@
getVersionDependencies(const Elf_Shdr *Sec) const;
};
-static StringRef getSecTypeName(unsigned Type) {
- if (Type == ELF::SHT_GNU_versym)
- return "SHT_GNU_versym";
- if (Type == ELF::SHT_GNU_verdef)
- return "SHT_GNU_verdef";
- if (Type == ELF::SHT_GNU_verneed)
- return "SHT_GNU_verneed";
- llvm_unreachable("unexpected section type");
-}
-
template <class ELFT>
static Expected<StringRef> getLinkAsStrtab(const ELFFile<ELFT> *Obj,
const typename ELFT::Shdr *Sec,
@@ -362,15 +352,17 @@
Obj->getSection(Sec->sh_link);
if (!StrTabSecOrErr)
return createError("invalid section linked to " +
- getSecTypeName(Sec->sh_type) + " section with index " +
- Twine(SecNdx) + ": " +
+ object::getELFSectionTypeName(
+ Obj->getHeader()->e_machine, Sec->sh_type) +
+ " section with index " + Twine(SecNdx) + ": " +
toString(StrTabSecOrErr.takeError()));
Expected<StringRef> StrTabOrErr = Obj->getStringTable(*StrTabSecOrErr);
if (!StrTabOrErr)
return createError("invalid string table linked to " +
- getSecTypeName(Sec->sh_type) + " section with index " +
- Twine(SecNdx) + ": " +
+ object::getELFSectionTypeName(
+ Obj->getHeader()->e_machine, Sec->sh_type) +
+ " section with index " + Twine(SecNdx) + ": " +
toString(StrTabOrErr.takeError()));
return *StrTabOrErr;
}
@@ -3997,8 +3989,10 @@
else
this->reportUniqueWarning(
createError("invalid section linked to " +
- getSecTypeName(Sec->sh_type) + " section with index " +
- Twine(SecNdx) + ": " + toString(SymTabOrErr.takeError())));
+ object::getELFSectionTypeName(Obj->getHeader()->e_machine,
+ Sec->sh_type) +
+ " section with index " + Twine(SecNdx) + ": " +
+ toString(SymTabOrErr.takeError())));
OS << " Addr: " << format_hex_no_prefix(Sec->sh_addr, 16)
<< " Offset: " << format_hex(Sec->sh_offset, 8)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71017.232267.patch
Type: text/x-patch
Size: 2516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191205/b7a60b99/attachment.bin>
More information about the llvm-commits
mailing list