mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
[Object] Split the ELF interface into 3 parts.
* ELFTypes.h contains template magic for defining types based on endianess, size, and alignment. * ELFFile.h defines the ELFFile class which provides low level ELF specific access. * ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188022 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm-objdump.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
#include "llvm/Object/ELFObjectFile.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@ -21,10 +21,8 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
|
||||
template<class ELFT>
|
||||
void printProgramHeaders(
|
||||
const ELFObjectFile<ELFT> *o) {
|
||||
typedef ELFObjectFile<ELFT> ELFO;
|
||||
template <class ELFT> void printProgramHeaders(const ELFFile<ELFT> *o) {
|
||||
typedef ELFFile<ELFT> ELFO;
|
||||
outs() << "Program Header:\n";
|
||||
for (typename ELFO::Elf_Phdr_Iter pi = o->begin_program_headers(),
|
||||
pe = o->end_program_headers();
|
||||
@ -80,17 +78,17 @@ void printProgramHeaders(
|
||||
void llvm::printELFFileHeader(const object::ObjectFile *Obj) {
|
||||
// Little-endian 32-bit
|
||||
if (const ELF32LEObjectFile *ELFObj = dyn_cast<ELF32LEObjectFile>(Obj))
|
||||
printProgramHeaders(ELFObj);
|
||||
printProgramHeaders(ELFObj->getELFFile());
|
||||
|
||||
// Big-endian 32-bit
|
||||
if (const ELF32BEObjectFile *ELFObj = dyn_cast<ELF32BEObjectFile>(Obj))
|
||||
printProgramHeaders(ELFObj);
|
||||
printProgramHeaders(ELFObj->getELFFile());
|
||||
|
||||
// Little-endian 64-bit
|
||||
if (const ELF64LEObjectFile *ELFObj = dyn_cast<ELF64LEObjectFile>(Obj))
|
||||
printProgramHeaders(ELFObj);
|
||||
printProgramHeaders(ELFObj->getELFFile());
|
||||
|
||||
// Big-endian 64-bit
|
||||
if (const ELF64BEObjectFile *ELFObj = dyn_cast<ELF64BEObjectFile>(Obj))
|
||||
printProgramHeaders(ELFObj);
|
||||
printProgramHeaders(ELFObj->getELFFile());
|
||||
}
|
||||
|
Reference in New Issue
Block a user