[PATCH] D53730: [llvm-readobj] Fix minor segment type dumping bugs
Ryan Prichard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 13:54:59 PDT 2018
rprichard created this revision.
Herald added subscribers: llvm-commits, atanasyan, kristof.beyls, arichardson, javed.absar, sdardis.
Add missing breaks. Several functions used nested switch statements,
where the outer switch branches based on the architecture, and the inner
switch handles architecture-specific types. If the type isn't
architecture-specific, break out to the generic types rather than fall
through.
getElfPtType: For GNU-style output, llvm-readobj prints
"<unknown>: 0xnnnnnnnn" for an unrecognized segment type, unless the
architecture is EM_ARM, EM_MIPS, or EM_MIPS_RS3_LE, in which case it
prints "". This behavior appears accidental, so instead, always print
the "<unknown>: 0xnnnnnnnn" string.
Repository:
rL LLVM
https://reviews.llvm.org/D53730
Files:
tools/llvm-readobj/ELFDumper.cpp
Index: tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- tools/llvm-readobj/ELFDumper.cpp
+++ tools/llvm-readobj/ELFDumper.cpp
@@ -1167,14 +1167,16 @@
switch (Type) {
LLVM_READOBJ_ENUM_CASE(ELF, PT_ARM_EXIDX);
}
+ break;
case ELF::EM_MIPS:
case ELF::EM_MIPS_RS3_LE:
switch (Type) {
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_REGINFO);
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_RTPROC);
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_OPTIONS);
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_ABIFLAGS);
}
+ break;
}
switch (Type) {
@@ -1221,7 +1223,7 @@
case ELF::EM_ARM:
if (Type == ELF::PT_ARM_EXIDX)
return "EXIDX";
- return "";
+ break;
case ELF::EM_MIPS:
case ELF::EM_MIPS_RS3_LE:
switch (Type) {
@@ -1234,7 +1236,7 @@
case PT_MIPS_ABIFLAGS:
return "ABIFLAGS";
}
- return "";
+ break;
}
}
return std::string("<unknown>: ") + to_string(format_hex(Type, 1));
@@ -1611,29 +1613,32 @@
case EM_HEXAGON:
switch (Type) {
#define HEXAGON_DYNAMIC_TAG(name, value) \
- case DT_##name: \
- return #name;
+ case DT_##name: \
+ return #name;
#include "llvm/BinaryFormat/DynamicTags.def"
#undef HEXAGON_DYNAMIC_TAG
}
+ break;
case EM_MIPS:
switch (Type) {
#define MIPS_DYNAMIC_TAG(name, value) \
- case DT_##name: \
- return #name;
+ case DT_##name: \
+ return #name;
#include "llvm/BinaryFormat/DynamicTags.def"
#undef MIPS_DYNAMIC_TAG
}
+ break;
- case EM_PPC64:
- switch(Type) {
+ case EM_PPC64:
+ switch(Type) {
#define PPC64_DYNAMIC_TAG(name, value) \
case DT_##name: \
return #name;
#include "llvm/BinaryFormat/DynamicTags.def"
#undef PPC64_DYNAMIC_TAG
}
+ break;
}
#undef DYNAMIC_TAG
switch (Type) {
@@ -2792,11 +2797,13 @@
case SHT_ARM_OVERLAYSECTION:
return "ARM_OVERLAYSECTION";
}
+ break;
case EM_X86_64:
switch (Type) {
case SHT_X86_64_UNWIND:
return "X86_64_UNWIND";
}
+ break;
case EM_MIPS:
case EM_MIPS_RS3_LE:
switch (Type) {
@@ -2809,6 +2816,7 @@
case SHT_MIPS_DWARF:
return "SHT_MIPS_DWARF";
}
+ break;
}
switch (Type) {
case SHT_NULL:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53730.171191.patch
Type: text/x-patch
Size: 2734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181025/b60fafd1/attachment.bin>
More information about the llvm-commits
mailing list