summaryrefslogtreecommitdiff
path: root/tools/llvm-objdump/ELFDump.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2013-01-15 07:44:25 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2013-01-15 07:44:25 +0000
commitac97f5ce486d1ca2967607028eacddd860aaddd0 (patch)
tree4a08e2f3f6154b0b9ccf6487a63e9f6ef3e5f668 /tools/llvm-objdump/ELFDump.cpp
parentb5f8cd5bb04df52c05cbd1eddf081e6d9cf9cd64 (diff)
downloadllvm-ac97f5ce486d1ca2967607028eacddd860aaddd0.tar.gz
llvm-ac97f5ce486d1ca2967607028eacddd860aaddd0.tar.bz2
llvm-ac97f5ce486d1ca2967607028eacddd860aaddd0.tar.xz
[Object][ELF] Simplify ELFObjectFile by using ELFType.
This simplifies the usage and implementation of ELFObjectFile by using ELFType to replace: <endianness target_endianness, std::size_t max_alignment, bool is64Bits> This does complicate the base ELF types as they must now use template template parameters to partially specialize for the 32 and 64bit cases. However these are only defined once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump/ELFDump.cpp')
-rw-r--r--tools/llvm-objdump/ELFDump.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/llvm-objdump/ELFDump.cpp b/tools/llvm-objdump/ELFDump.cpp
index a635fefc3b..b96d5ba11a 100644
--- a/tools/llvm-objdump/ELFDump.cpp
+++ b/tools/llvm-objdump/ELFDump.cpp
@@ -22,10 +22,10 @@
using namespace llvm;
using namespace llvm::object;
-template<endianness target_endianness, std::size_t max_alignment, bool is64Bits>
+template<class ELFT>
void printProgramHeaders(
- const ELFObjectFile<target_endianness, max_alignment, is64Bits> *o) {
- typedef ELFObjectFile<target_endianness, max_alignment, is64Bits> ELFO;
+ const ELFObjectFile<ELFT> *o) {
+ typedef ELFObjectFile<ELFT> ELFO;
outs() << "Program Header:\n";
for (typename ELFO::Elf_Phdr_Iter pi = o->begin_program_headers(),
pe = o->end_program_headers();
@@ -44,7 +44,7 @@ void printProgramHeaders(
outs() << " UNKNOWN ";
}
- const char *Fmt = is64Bits ? "0x%016" PRIx64 " " : "0x%08" PRIx64 " ";
+ const char *Fmt = ELFT::Is64Bits ? "0x%016" PRIx64 " " : "0x%08" PRIx64 " ";
outs() << "off "
<< format(Fmt, (uint64_t)pi->p_offset)
@@ -68,22 +68,22 @@ void printProgramHeaders(
void llvm::printELFFileHeader(const object::ObjectFile *Obj) {
// Little-endian 32-bit
- if (const ELFObjectFile<support::little, 4, false> *ELFObj =
- dyn_cast<ELFObjectFile<support::little, 4, false> >(Obj))
+ if (const ELFObjectFile<ELFType<support::little, 4, false> > *ELFObj =
+ dyn_cast<ELFObjectFile<ELFType<support::little, 4, false> > >(Obj))
printProgramHeaders(ELFObj);
// Big-endian 32-bit
- if (const ELFObjectFile<support::big, 4, false> *ELFObj =
- dyn_cast<ELFObjectFile<support::big, 4, false> >(Obj))
+ if (const ELFObjectFile<ELFType<support::big, 4, false> > *ELFObj =
+ dyn_cast<ELFObjectFile<ELFType<support::big, 4, false> > >(Obj))
printProgramHeaders(ELFObj);
// Little-endian 64-bit
- if (const ELFObjectFile<support::little, 8, true> *ELFObj =
- dyn_cast<ELFObjectFile<support::little, 8, true> >(Obj))
+ if (const ELFObjectFile<ELFType<support::little, 8, true> > *ELFObj =
+ dyn_cast<ELFObjectFile<ELFType<support::little, 8, true> > >(Obj))
printProgramHeaders(ELFObj);
// Big-endian 64-bit
- if (const ELFObjectFile<support::big, 8, true> *ELFObj =
- dyn_cast<ELFObjectFile<support::big, 8, true> >(Obj))
+ if (const ELFObjectFile<ELFType<support::big, 8, true> > *ELFObj =
+ dyn_cast<ELFObjectFile<ELFType<support::big, 8, true> > >(Obj))
printProgramHeaders(ELFObj);
}