mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[llvm-readobj] Replace arch-specific ObjDumper methods by the single printArchSpecificInfo
Initially llvm-readobj supports multiple command line options like `--arm-attributes` and `--mips-plt-got` for display ELF arch-specific information. Now all these options are superseded by the `--arch-specific` one. It makes sense to have a single `printArchSpecificInfo` method in the base `ObjDumper`, and hide all ELF/target specific details in the `ELFDumper::printArchSpecificInfo` override. Differential Revision: https://reviews.llvm.org/D68385 llvm-svn: 373731
This commit is contained in:
parent
bae3718e6a
commit
861303204d
@ -173,11 +173,7 @@ public:
|
||||
void printVersionInfo() override;
|
||||
void printGroupSections() override;
|
||||
|
||||
void printAttributes() override;
|
||||
void printMipsPLTGOT() override;
|
||||
void printMipsABIFlags() override;
|
||||
void printMipsReginfo() override;
|
||||
void printMipsOptions() override;
|
||||
void printArchSpecificInfo() override;
|
||||
|
||||
void printStackMap() const override;
|
||||
|
||||
@ -218,6 +214,12 @@ private:
|
||||
S->sh_entsize, ObjF->getFileName()});
|
||||
}
|
||||
|
||||
void printAttributes();
|
||||
void printMipsPLTGOT();
|
||||
void printMipsABIFlags();
|
||||
void printMipsReginfo();
|
||||
void printMipsOptions();
|
||||
|
||||
std::pair<const Elf_Phdr *, const Elf_Shdr *>
|
||||
findDynamic(const ELFFile<ELFT> *Obj);
|
||||
void loadDynamicTable(const ELFFile<ELFT> *Obj);
|
||||
@ -2210,6 +2212,23 @@ template <typename ELFT> void ELFDumper<ELFT>::printLoadName() {
|
||||
W.printString("LoadName", SOName);
|
||||
}
|
||||
|
||||
template <class ELFT> void ELFDumper<ELFT>::printArchSpecificInfo() {
|
||||
const ELFFile<ELFT> *Obj = ObjF->getELFFile();
|
||||
switch (Obj->getHeader()->e_machine) {
|
||||
case EM_ARM:
|
||||
printAttributes();
|
||||
break;
|
||||
case EM_MIPS:
|
||||
printMipsABIFlags();
|
||||
printMipsOptions();
|
||||
printMipsReginfo();
|
||||
printMipsPLTGOT();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ELFT> void ELFDumper<ELFT>::printAttributes() {
|
||||
W.startLine() << "Attributes not implemented.\n";
|
||||
}
|
||||
|
@ -69,15 +69,7 @@ public:
|
||||
virtual void printNotes() {}
|
||||
virtual void printELFLinkerOptions() {}
|
||||
virtual void printStackSizes() {}
|
||||
|
||||
// Only implemented for ARM ELF at this time.
|
||||
virtual void printAttributes() { }
|
||||
|
||||
// Only implemented for MIPS ELF at this time.
|
||||
virtual void printMipsPLTGOT() { }
|
||||
virtual void printMipsABIFlags() { }
|
||||
virtual void printMipsReginfo() { }
|
||||
virtual void printMipsOptions() { }
|
||||
virtual void printArchSpecificInfo() { }
|
||||
|
||||
// Only implemented for PE/COFF.
|
||||
virtual void printCOFFImports() { }
|
||||
|
@ -397,17 +397,6 @@ void reportWarning(Error Err, StringRef Input) {
|
||||
|
||||
} // namespace llvm
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
namespace {
|
||||
struct ReadObjTypeTableBuilder {
|
||||
ReadObjTypeTableBuilder()
|
||||
@ -502,16 +491,8 @@ static void dumpObject(const ObjectFile *Obj, ScopedPrinter &Writer,
|
||||
if (Obj->isELF()) {
|
||||
if (opts::ELFLinkerOptions)
|
||||
Dumper->printELFLinkerOptions();
|
||||
if (opts::ArchSpecificInfo) {
|
||||
if (Obj->getArch() == llvm::Triple::arm)
|
||||
Dumper->printAttributes();
|
||||
else if (isMipsArch(Obj->getArch())) {
|
||||
Dumper->printMipsABIFlags();
|
||||
Dumper->printMipsOptions();
|
||||
Dumper->printMipsReginfo();
|
||||
Dumper->printMipsPLTGOT();
|
||||
}
|
||||
}
|
||||
if (opts::ArchSpecificInfo)
|
||||
Dumper->printArchSpecificInfo();
|
||||
if (opts::SectionGroups)
|
||||
Dumper->printGroupSections();
|
||||
if (opts::HashHistogram)
|
||||
|
Loading…
x
Reference in New Issue
Block a user