[llvm-readobj][ELF] New -mips-plt-got command line option to output

MIPS GOT section.

Patch reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211150 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan
2014-06-18 08:47:09 +00:00
parent 02b4e6e7ab
commit 42469f61f5
6 changed files with 547 additions and 0 deletions

View File

@ -135,6 +135,11 @@ namespace opts {
cl::desc("Display the ARM attributes section"));
cl::alias ARMAttributesShort("-a", cl::desc("Alias for --arm-attributes"),
cl::aliasopt(ARMAttributes));
// -mips-plt-got
cl::opt<bool>
MipsPLTGOT("mips-plt-got",
cl::desc("Display the MIPS GOT and PLT GOT sections"));
} // namespace opts
static int ReturnValue = EXIT_SUCCESS;
@ -177,6 +182,18 @@ static void reportError(StringRef Input, StringRef Message) {
ReturnValue = EXIT_FAILURE;
}
static bool isMipsArch(unsigned Arch) {
switch (Arch) {
case llvm::Triple::mips:
case llvm::Triple::mipsel:
case llvm::Triple::mips64:
case llvm::Triple::mips64el:
return true;
default:
return false;
}
}
/// @brief Creates an format-specific object file dumper.
static std::error_code createDumper(const ObjectFile *Obj, StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result) {
@ -234,6 +251,9 @@ static void dumpObject(const ObjectFile *Obj) {
if (Obj->getArch() == llvm::Triple::arm && Obj->isELF())
if (opts::ARMAttributes)
Dumper->printAttributes();
if (isMipsArch(Obj->getArch()) && Obj->isELF())
if (opts::MipsPLTGOT)
Dumper->printMipsPLTGOT();
}