//===- ELFObjectFile.cpp - ELF object file implementation -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the ELFObjectFile class.
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <limits>
#include <utility>
using namespace llvm;
using namespace object;
// Templates to choose Elf_Addr and Elf_Off depending on is64Bits.
namespace {
template<support::endianness target_endianness>
struct ELFDataTypeTypedefHelperCommon {
typedef support::detail::packed_endian_specific_integral
<uint16_t, target_endianness, support::aligned> Elf_Half;
typedef support::detail::packed_endian_specific_integral
<uint32_t, target_endianness, support::aligned> Elf_Word;
typedef support::detail::packed_endian_specific_integral
<int32_t, target_endianness, support::aligned> Elf_Sword;
typedef support::detail::packed_endian_specific_integral
<uint64_t, target_endianness, support::aligned> Elf_Xword;
typedef support::detail::packed_endian_specific_integral
<int64_t, target_endianness, support::aligned> Elf_Sxword;
};
}
namespace {
template<support::endianness target_endianness, bool is64Bits>
struct ELFDataTypeTypedefHelper;
/// ELF 32bit types.
template<support::endianness target_endianness>
struct ELFDataTypeTypedefHelper<target_endianness, false>