aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Object
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-03-23 12:10:34 -0700
committerStephen Hines <srhines@google.com>2015-03-23 12:10:34 -0700
commitebe69fe11e48d322045d5949c83283927a0d790b (patch)
treec92f1907a6b8006628a4b01615f38264d29834ea /lib/Object
parentb7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff)
downloadexternal_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip
external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz
external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/Archive.cpp72
-rw-r--r--lib/Object/Binary.cpp1
-rw-r--r--lib/Object/CMakeLists.txt3
-rw-r--r--lib/Object/COFFObjectFile.cpp33
-rw-r--r--lib/Object/ELF.cpp756
-rw-r--r--lib/Object/ELFYAML.cpp409
-rw-r--r--lib/Object/IRObjectFile.cpp22
-rw-r--r--lib/Object/MachOObjectFile.cpp175
-rw-r--r--lib/Object/MachOUniversal.cpp26
-rw-r--r--lib/Object/ObjectFile.cpp1
-rw-r--r--lib/Object/SymbolicFile.cpp5
11 files changed, 322 insertions, 1181 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index d169dbe..43b0771 100644
--- a/lib/Object/Archive.cpp
+++ b/lib/Object/Archive.cpp
@@ -22,6 +22,7 @@ using namespace llvm;
using namespace object;
static const char *const Magic = "!<arch>\n";
+static const char *const ThinMagic = "!<thin>\n";
void Archive::anchor() { }
@@ -86,7 +87,10 @@ Archive::Child::Child(const Archive *Parent, const char *Start)
const ArchiveMemberHeader *Header =
reinterpret_cast<const ArchiveMemberHeader *>(Start);
- Data = StringRef(Start, sizeof(ArchiveMemberHeader) + Header->getSize());
+ uint64_t Size = sizeof(ArchiveMemberHeader);
+ if (!Parent->IsThin || Header->getName() == "/" || Header->getName() == "//")
+ Size += Header->getSize();
+ Data = StringRef(Start, Size);
// Setup StartOfFile and PaddingBytes.
StartOfFile = sizeof(ArchiveMemberHeader);
@@ -100,6 +104,16 @@ Archive::Child::Child(const Archive *Parent, const char *Start)
}
}
+uint64_t Archive::Child::getSize() const {
+ if (Parent->IsThin)
+ return getHeader()->getSize();
+ return Data.size() - StartOfFile;
+}
+
+uint64_t Archive::Child::getRawSize() const {
+ return getHeader()->getSize();
+}
+
Archive::Child Archive::Child::getNext() const {
size_t SpaceToSkip = Data.size();
// If it's odd, add 1 to make it even.
@@ -115,6 +129,13 @@ Archive::Child Archive::Child::getNext() const {
return Child(Parent, NextLoc);
}
+uint64_t Archive::Child::getChildOffset() const {
+ const char *a = Parent->Data.getBuffer().data();
+ const char *c = Data.data();
+ uint64_t offset = c - a;
+ return offset;
+}
+
ErrorOr<StringRef> Archive::Child::getName() const {
StringRef name = getRawName();
// Check if it's a special name.
@@ -141,7 +162,7 @@ ErrorOr<StringRef> Archive::Child::getName() const {
return object_error::parse_failed;
// GNU long file names end with a /.
- if (Parent->kind() == K_GNU) {
+ if (Parent->kind() == K_GNU || Parent->kind() == K_MIPS64) {
StringRef::size_type End = StringRef(addr).find('/');
return StringRef(addr, End);
}
@@ -186,9 +207,13 @@ ErrorOr<std::unique_ptr<Archive>> Archive::create(MemoryBufferRef Source) {
Archive::Archive(MemoryBufferRef Source, std::error_code &ec)
: Binary(Binary::ID_Archive, Source), SymbolTable(child_end()) {
+ StringRef Buffer = Data.getBuffer();
// Check for sufficient magic.
- if (Data.getBufferSize() < 8 ||
- StringRef(Data.getBufferStart(), 8) != Magic) {
+ if (Buffer.startswith(ThinMagic)) {
+ IsThin = true;
+ } else if (Buffer.startswith(Magic)) {
+ IsThin = false;
+ } else {
ec = object_error::invalid_file_type;
return;
}
@@ -248,8 +273,16 @@ Archive::Archive(MemoryBufferRef Source, std::error_code &ec)
return;
}
- if (Name == "/") {
+ // MIPS 64-bit ELF archives use a special format of a symbol table.
+ // This format is marked by `ar_name` field equals to "/SYM64/".
+ // For detailed description see page 96 in the following document:
+ // http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
+
+ bool has64SymTable = false;
+ if (Name == "/" || Name == "/SYM64/") {
SymbolTable = i;
+ if (Name == "/SYM64/")
+ has64SymTable = true;
++i;
if (i == e) {
@@ -260,7 +293,7 @@ Archive::Archive(MemoryBufferRef Source, std::error_code &ec)
}
if (Name == "//") {
- Format = K_GNU;
+ Format = has64SymTable ? K_MIPS64 : K_GNU;
StringTable = i;
++i;
FirstRegular = i;
@@ -269,7 +302,7 @@ Archive::Archive(MemoryBufferRef Source, std::error_code &ec)
}
if (Name[0] != '/') {
- Format = K_GNU;
+ Format = has64SymTable ? K_MIPS64 : K_GNU;
FirstRegular = i;
ec = object_error::success;
return;
@@ -323,11 +356,18 @@ StringRef Archive::Symbol::getName() const {
ErrorOr<Archive::child_iterator> Archive::Symbol::getMember() const {
const char *Buf = Parent->SymbolTable->getBuffer().begin();
- const char *Offsets = Buf + 4;
+ const char *Offsets = Buf;
+ if (Parent->kind() == K_MIPS64)
+ Offsets += sizeof(uint64_t);
+ else
+ Offsets += sizeof(uint32_t);
uint32_t Offset = 0;
if (Parent->kind() == K_GNU) {
- Offset = *(reinterpret_cast<const support::ubig32_t*>(Offsets)
- + SymbolIndex);
+ Offset =
+ *(reinterpret_cast<const support::ubig32_t *>(Offsets) + SymbolIndex);
+ } else if (Parent->kind() == K_MIPS64) {
+ Offset =
+ *(reinterpret_cast<const support::ubig64_t *>(Offsets) + SymbolIndex);
} else if (Parent->kind() == K_BSD) {
// The SymbolIndex is an index into the ranlib structs that start at
// Offsets (the first uint32_t is the number of bytes of the ranlib
@@ -341,8 +381,8 @@ ErrorOr<Archive::child_iterator> Archive::Symbol::getMember() const {
uint32_t MemberCount = *reinterpret_cast<const support::ulittle32_t*>(Buf);
// Skip offsets.
- Buf += sizeof(support::ulittle32_t)
- + (MemberCount * sizeof(support::ulittle32_t));
+ Buf += sizeof(support::ulittle32_t) +
+ (MemberCount * sizeof(support::ulittle32_t));
uint32_t SymbolCount = *reinterpret_cast<const support::ulittle32_t*>(Buf);
@@ -424,6 +464,9 @@ Archive::symbol_iterator Archive::symbol_begin() const {
uint32_t symbol_count = 0;
symbol_count = *reinterpret_cast<const support::ubig32_t*>(buf);
buf += sizeof(uint32_t) + (symbol_count * (sizeof(uint32_t)));
+ } else if (kind() == K_MIPS64) {
+ uint64_t symbol_count = *reinterpret_cast<const support::ubig64_t *>(buf);
+ buf += sizeof(uint64_t) + (symbol_count * (sizeof(uint64_t)));
} else if (kind() == K_BSD) {
// The __.SYMDEF or "__.SYMDEF SORTED" member starts with a uint32_t
// which is the number of bytes of ranlib structs that follow. The ranlib
@@ -461,6 +504,8 @@ Archive::symbol_iterator Archive::symbol_end() const {
uint32_t symbol_count = 0;
if (kind() == K_GNU) {
symbol_count = *reinterpret_cast<const support::ubig32_t*>(buf);
+ } else if (kind() == K_MIPS64) {
+ symbol_count = *reinterpret_cast<const support::ubig64_t*>(buf);
} else if (kind() == K_BSD) {
symbol_count = (*reinterpret_cast<const support::ulittle32_t *>(buf)) /
(sizeof(uint32_t) * 2);
@@ -470,8 +515,7 @@ Archive::symbol_iterator Archive::symbol_end() const {
buf += 4 + (member_count * 4); // Skip offsets.
symbol_count = *reinterpret_cast<const support::ulittle32_t*>(buf);
}
- return symbol_iterator(
- Symbol(this, symbol_count, 0));
+ return symbol_iterator(Symbol(this, symbol_count, 0));
}
Archive::child_iterator Archive::findSym(StringRef name) const {
diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp
index c56eeb1..a2b167a 100644
--- a/lib/Object/Binary.cpp
+++ b/lib/Object/Binary.cpp
@@ -58,6 +58,7 @@ ErrorOr<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
case sys::fs::file_magic::macho_bundle:
case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
case sys::fs::file_magic::macho_dsym_companion:
+ case sys::fs::file_magic::macho_kext_bundle:
case sys::fs::file_magic::coff_object:
case sys::fs::file_magic::coff_import_library:
case sys::fs::file_magic::pecoff_executable:
diff --git a/lib/Object/CMakeLists.txt b/lib/Object/CMakeLists.txt
index 5b08e42..37add22 100644
--- a/lib/Object/CMakeLists.txt
+++ b/lib/Object/CMakeLists.txt
@@ -14,4 +14,7 @@ add_llvm_library(LLVMObject
ObjectFile.cpp
RecordStreamer.cpp
SymbolicFile.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/Object
)
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index d5ff7d6..cde6fdc 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/lib/Object/COFFObjectFile.cpp
@@ -362,39 +362,11 @@ bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const {
return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
}
-bool COFFObjectFile::isSectionRequiredForExecution(DataRefImpl Ref) const {
- // Sections marked 'Info', 'Remove', or 'Discardable' aren't required for
- // execution.
- const coff_section *Sec = toSec(Ref);
- return !(Sec->Characteristics &
- (COFF::IMAGE_SCN_LNK_INFO | COFF::IMAGE_SCN_LNK_REMOVE |
- COFF::IMAGE_SCN_MEM_DISCARDABLE));
-}
-
bool COFFObjectFile::isSectionVirtual(DataRefImpl Ref) const {
const coff_section *Sec = toSec(Ref);
return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
}
-bool COFFObjectFile::isSectionZeroInit(DataRefImpl Ref) const {
- const coff_section *Sec = toSec(Ref);
- return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
-}
-
-bool COFFObjectFile::isSectionReadOnlyData(DataRefImpl Ref) const {
- const coff_section *Sec = toSec(Ref);
- // Check if it's any sort of data section.
- if (!(Sec->Characteristics & (COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)))
- return false;
- // If it's writable or executable or contains code, it isn't read-only data.
- if (Sec->Characteristics &
- (COFF::IMAGE_SCN_CNT_CODE | COFF::IMAGE_SCN_MEM_EXECUTE |
- COFF::IMAGE_SCN_MEM_WRITE))
- return false;
- return true;
-}
-
bool COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef,
DataRefImpl SymbRef) const {
const coff_section *Sec = toSec(SecRef);
@@ -414,7 +386,8 @@ static uint32_t getNumberOfRelocations(const coff_section *Sec,
if (getObject(FirstReloc, M, reinterpret_cast<const coff_relocation*>(
base + Sec->PointerToRelocations)))
return 0;
- return FirstReloc->VirtualAddress;
+ // -1 to exclude this first relocation entry.
+ return FirstReloc->VirtualAddress - 1;
}
return Sec->NumberOfRelocations;
}
@@ -1060,7 +1033,7 @@ symbol_iterator COFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const {
else if (SymbolTable32)
Ref.p = reinterpret_cast<uintptr_t>(SymbolTable32 + R->SymbolTableIndex);
else
- return symbol_end();
+ llvm_unreachable("no symbol table pointer!");
return symbol_iterator(SymbolRef(Ref, this));
}
diff --git a/lib/Object/ELF.cpp b/lib/Object/ELF.cpp
index 11099bd..398e9e4 100644
--- a/lib/Object/ELF.cpp
+++ b/lib/Object/ELF.cpp
@@ -12,716 +12,71 @@
namespace llvm {
namespace object {
-#define LLVM_ELF_SWITCH_RELOC_TYPE_NAME(enum) \
- case ELF::enum: \
- return #enum; \
+#define ELF_RELOC(name, value) \
+ case ELF::name: \
+ return #name; \
StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type) {
switch (Machine) {
case ELF::EM_X86_64:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_PC32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_PLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_JUMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTPCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_32S);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_PC16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_PC8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_DTPMOD64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_DTPOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_TPOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_TLSGD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_TLSLD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_DTPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTTPOFF);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_TPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_PC64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTPC32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOT64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTPCREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTPC64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTPLT64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_PLTOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_SIZE32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_SIZE64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_GOTPC32_TLSDESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_TLSDESC_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_TLSDESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_X86_64_IRELATIVE);
+#include "llvm/Support/ELFRelocs/x86_64.def"
default:
break;
}
break;
case ELF::EM_386:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_PC32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_GOT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_PLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_JUMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_GOTOFF);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_GOTPC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_32PLT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_TPOFF);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_IE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GOTIE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LDM);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_PC16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_PC8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GD_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GD_PUSH);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GD_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GD_POP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LDM_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LDM_PUSH);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LDM_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LDM_POP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LDO_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_IE_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_LE_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_DTPMOD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_DTPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_TPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_GOTDESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_DESC_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_TLS_DESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_386_IRELATIVE);
+#include "llvm/Support/ELFRelocs/i386.def"
default:
break;
}
break;
case ELF::EM_MIPS:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_REL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_26);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_LITERAL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GOT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PC16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_CALL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GPREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_SHIFT5);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_SHIFT6);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GOT_DISP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GOT_PAGE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GOT_OFST);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GOT_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GOT_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_SUB);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_INSERT_A);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_INSERT_B);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_DELETE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_HIGHER);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_HIGHEST);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_CALL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_CALL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_SCN_DISP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_REL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_ADD_IMMEDIATE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PJUMP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_RELGOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_JALR);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_DTPMOD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_DTPREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_DTPMOD64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_DTPREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_GD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_LDM);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_DTPREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_DTPREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_GOTTPREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_TPREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_TPREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_TPREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_TLS_TPREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PC21_S2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PC26_S2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PC18_S3);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PC19_S2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PCHI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PCLO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS16_GOT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS16_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS16_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_JUMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_26_S1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_GOT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_PC16_S1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_CALL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_GOT_DISP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_GOT_PAGE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_GOT_OFST);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_TLS_GD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_TLS_LDM);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_TLS_DTPREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_TLS_DTPREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_TLS_TPREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MICROMIPS_TLS_TPREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_NUM);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_MIPS_PC32);
+#include "llvm/Support/ELFRelocs/Mips.def"
default:
break;
}
break;
case ELF::EM_AARCH64:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ABS64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ABS32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ABS16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_PREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_PREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_PREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G1_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G2_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_UABS_G3);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_SABS_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_SABS_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_MOVW_SABS_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LD_PREL_LO19);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ADR_PREL_LO21);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ADR_PREL_PG_HI21);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ADD_ABS_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST8_ABS_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TSTBR14);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_CONDBR19);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_JUMP26);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_CALL26);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST16_ABS_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST32_ABS_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST64_ABS_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST128_ABS_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_GOTREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_GOTREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ADR_GOT_PAGE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LD64_GOT_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_MOVW_DTPREL_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_MOVW_DTPREL_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_MOVW_DTPREL_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_ADD_DTPREL_HI12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_ADD_DTPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST8_DTPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST16_DTPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST32_DTPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST64_DTPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_MOVW_TPREL_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_MOVW_TPREL_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_MOVW_TPREL_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_ADD_TPREL_HI12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_ADD_TPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST8_TPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST16_TPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST32_TPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST64_TPREL_LO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_ADR_PAGE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_LD64_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_ADD_LO12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_JUMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLS_DTPREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLS_DTPMOD64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLS_TPREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_IRELATIVE);
+#include "llvm/Support/ELFRelocs/AArch64.def"
default:
break;
}
break;
case ELF::EM_ARM:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PC24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ABS32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_REL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_PC_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ABS16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ABS12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_ABS5);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ABS8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_SBREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_PC8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_BREL_ADJ);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_DESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_SWI8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_XPC25);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_XPC22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_DTPMOD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_DTPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_TPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_JUMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOTOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_BASE_PREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOT_BREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_JUMP24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_JUMP24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_BASE_ABS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PCREL_7_0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PCREL_15_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PCREL_23_15);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_SBREL_11_0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SBREL_19_12_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SBREL_27_20_CK);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TARGET1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_SBREL31);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_V4BX);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TARGET2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PREL31);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVW_ABS_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVT_ABS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVW_PREL_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVT_PREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVW_ABS_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVT_ABS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVW_PREL_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVT_PREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_JUMP19);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_JUMP6);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_ALU_PREL_11_0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_PC12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ABS32_NOI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_REL32_NOI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PC_G0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PC_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PC_G1_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PC_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_PC_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_PC_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_PC_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDRS_PC_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDRS_PC_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDRS_PC_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDC_PC_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDC_PC_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDC_PC_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SB_G0_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SB_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SB_G1_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SB_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ALU_SB_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_SB_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_SB_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDR_SB_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDRS_SB_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDRS_SB_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDRS_SB_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDC_SB_G0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDC_SB_G1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_LDC_SB_G2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVW_BREL_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVT_BREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_MOVW_BREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVW_BREL_NC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVT_BREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_MOVW_BREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_GOTDESC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_DESCSEQ);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_TLS_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PLT32_ABS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOT_ABS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOT_PREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOT_BREL12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOTOFF12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GOTRELAX);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GNU_VTENTRY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_GNU_VTINHERIT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_JUMP11);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_JUMP8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_GD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_LDM32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_LDO32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_IE32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_LE32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_LDO12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_LE12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_TLS_IE12GP);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_3);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_4);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_5);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_6);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_7);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_9);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_11);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_13);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_14);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_PRIVATE_15);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_ME_TOO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_TLS_DESCSEQ16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_ARM_THM_TLS_DESCSEQ32);
+#include "llvm/Support/ELFRelocs/ARM.def"
default:
break;
}
break;
case ELF::EM_HEXAGON:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B22_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B15_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B7_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GPREL16_0);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GPREL16_1);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GPREL16_2);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GPREL16_3);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_HL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B13_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B9_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B32_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B22_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B15_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B13_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B9_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_B7_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_12_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_11_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_10_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_9_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_8_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_7_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_32_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_JMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_PLT_B22_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOTREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOTREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOTREL_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPMOD_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_PLT_B22_PCREL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_LO16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_HI16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_6_PCREL_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOTREL_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOTREL_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOTREL_11_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GOT_11_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_DTPREL_11_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_GD_GOT_11_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_IE_GOT_11_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_32_6_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_16_X);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_HEX_TPREL_11_X);
+#include "llvm/Support/ELFRelocs/Hexagon.def"
default:
break;
}
break;
case ELF::EM_PPC:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR14);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR14_BRTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_ADDR14_BRNTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL14);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL14_BRTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL14_BRNTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_PLTREL24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TLS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPMOD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TPREL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TPREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPREL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPREL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSGD16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSGD16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSGD16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSGD16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSLD16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSLD16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSLD16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TLSLD16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TPREL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_TPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_DTPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_DTPREL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_DTPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT_DTPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TLSGD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TLSLD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL16_HA);
+#include "llvm/Support/ELFRelocs/PowerPC.def"
default:
break;
}
break;
case ELF::EM_PPC64:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR14);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR14_BRTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR14_BRNTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL24);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL14);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL14_BRTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL14_BRNTAKEN);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_HIGHER);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_HIGHERA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_HIGHEST);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_HIGHESTA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_ADDR16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TOC16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TLS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPMOD64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSGD16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSGD16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSGD16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSGD16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSLD16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSLD16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSLD16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TLSLD16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TPREL16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TPREL16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_TPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_DTPREL16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_DTPREL16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_DTPREL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_GOT_DTPREL16_HA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_HIGHER);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_HIGHERA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_HIGHEST);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TPREL16_HIGHESTA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_LO_DS);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_HIGHER);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_HIGHERA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_HIGHEST);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_DTPREL16_HIGHESTA);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TLSGD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_TLSLD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL16_LO);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL16_HI);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC64_REL16_HA);
+#include "llvm/Support/ELFRelocs/PowerPC64.def"
default:
break;
}
break;
case ELF::EM_S390:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PC32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOT12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_JMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTOFF);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPC);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PC16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PC16DBL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLT16DBL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PC32DBL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLT32DBL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPCDBL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PC64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOT64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLT64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTENT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTOFF16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPLT12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPLT16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPLT64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPLTENT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLTOFF16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLTOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_PLTOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LOAD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GDCALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LDCALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GD64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GOTIE12);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GOTIE32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GOTIE64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LDM32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LDM64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_IE32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_IE64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_IEENT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LE32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LE64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LDO32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_LDO64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_DTPMOD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_DTPOFF);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_TPOFF);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_20);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOT20);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_GOTPLT20);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_TLS_GOTIE20);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_390_IRELATIVE);
+#include "llvm/Support/ELFRelocs/SystemZ.def"
default:
break;
}
@@ -730,90 +85,7 @@ StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type) {
case ELF::EM_SPARC32PLUS:
case ELF::EM_SPARCV9:
switch (Type) {
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_NONE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP8);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP30);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HI22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_13);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LO10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOT10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOT13);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOT22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WPLT30);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_COPY);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GLOB_DAT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_JMP_SLOT);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_RELATIVE);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_UA32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HIPLT22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LOPLT10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PCPLT32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PCPLT22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PCPLT10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_11);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_OLO10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HH22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HM10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LM22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC_HH22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC_HM10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PC_LM22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_WDISP19);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_7);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_5);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_6);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_DISP64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_PLT64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_HIX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_LOX10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_H44);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_M44);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_L44);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_REGISTER);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_UA64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_UA16);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_HI22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_LO10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_ADD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_GD_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_HI22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_LO10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_ADD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDM_CALL);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDO_HIX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDO_LOX10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LDO_ADD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_HI22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_LO10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_LD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_LDX);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_IE_ADD);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LE_HIX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_LE_LOX10);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPMOD32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPMOD64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_DTPOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_TPOFF32);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_TLS_TPOFF64);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_HIX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_LOX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_OP_HIX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_OP_LOX22);
- LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_SPARC_GOTDATA_OP);
+#include "llvm/Support/ELFRelocs/Sparc.def"
default:
break;
}
@@ -824,7 +96,7 @@ StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type) {
return "Unknown";
}
-#undef LLVM_ELF_SWITCH_RELOC_TYPE_NAME
+#undef ELF_RELOC
} // end namespace object
} // end namespace llvm
diff --git a/lib/Object/ELFYAML.cpp b/lib/Object/ELFYAML.cpp
index f513c11..cce05cf 100644
--- a/lib/Object/ELFYAML.cpp
+++ b/lib/Object/ELFYAML.cpp
@@ -30,6 +30,7 @@ ScalarEnumerationTraits<ELFYAML::ELF_ET>::enumeration(IO &IO,
ECase(ET_DYN)
ECase(ET_CORE)
#undef ECase
+ IO.enumFallback<Hex16>(Value);
}
void
@@ -414,354 +415,44 @@ void ScalarBitSetTraits<ELFYAML::ELF_STO>::bitset(IO &IO,
#undef BCaseMask
}
+void ScalarEnumerationTraits<ELFYAML::ELF_RSS>::enumeration(
+ IO &IO, ELFYAML::ELF_RSS &Value) {
+#define ECase(X) IO.enumCase(Value, #X, ELF::X);
+ ECase(RSS_UNDEF)
+ ECase(RSS_GP)
+ ECase(RSS_GP0)
+ ECase(RSS_LOC)
+#undef ECase
+}
+
void ScalarEnumerationTraits<ELFYAML::ELF_REL>::enumeration(
IO &IO, ELFYAML::ELF_REL &Value) {
const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
assert(Object && "The IO context is not initialized");
-#define ECase(X) IO.enumCase(Value, #X, ELF::X);
+#define ELF_RELOC(X, Y) IO.enumCase(Value, #X, ELF::X);
switch (Object->Header.Machine) {
case ELF::EM_X86_64:
- ECase(R_X86_64_NONE)
- ECase(R_X86_64_64)
- ECase(R_X86_64_PC32)
- ECase(R_X86_64_GOT32)
- ECase(R_X86_64_PLT32)
- ECase(R_X86_64_COPY)
- ECase(R_X86_64_GLOB_DAT)
- ECase(R_X86_64_JUMP_SLOT)
- ECase(R_X86_64_RELATIVE)
- ECase(R_X86_64_GOTPCREL)
- ECase(R_X86_64_32)
- ECase(R_X86_64_32S)
- ECase(R_X86_64_16)
- ECase(R_X86_64_PC16)
- ECase(R_X86_64_8)
- ECase(R_X86_64_PC8)
- ECase(R_X86_64_DTPMOD64)
- ECase(R_X86_64_DTPOFF64)
- ECase(R_X86_64_TPOFF64)
- ECase(R_X86_64_TLSGD)
- ECase(R_X86_64_TLSLD)
- ECase(R_X86_64_DTPOFF32)
- ECase(R_X86_64_GOTTPOFF)
- ECase(R_X86_64_TPOFF32)
- ECase(R_X86_64_PC64)
- ECase(R_X86_64_GOTOFF64)
- ECase(R_X86_64_GOTPC32)
- ECase(R_X86_64_GOT64)
- ECase(R_X86_64_GOTPCREL64)
- ECase(R_X86_64_GOTPC64)
- ECase(R_X86_64_GOTPLT64)
- ECase(R_X86_64_PLTOFF64)
- ECase(R_X86_64_SIZE32)
- ECase(R_X86_64_SIZE64)
- ECase(R_X86_64_GOTPC32_TLSDESC)
- ECase(R_X86_64_TLSDESC_CALL)
- ECase(R_X86_64_TLSDESC)
- ECase(R_X86_64_IRELATIVE)
+#include "llvm/Support/ELFRelocs/x86_64.def"
break;
case ELF::EM_MIPS:
- ECase(R_MIPS_NONE)
- ECase(R_MIPS_16)
- ECase(R_MIPS_32)
- ECase(R_MIPS_REL32)
- ECase(R_MIPS_26)
- ECase(R_MIPS_HI16)
- ECase(R_MIPS_LO16)
- ECase(R_MIPS_GPREL16)
- ECase(R_MIPS_LITERAL)
- ECase(R_MIPS_GOT16)
- ECase(R_MIPS_PC16)
- ECase(R_MIPS_CALL16)
- ECase(R_MIPS_GPREL32)
- ECase(R_MIPS_UNUSED1)
- ECase(R_MIPS_UNUSED2)
- ECase(R_MIPS_SHIFT5)
- ECase(R_MIPS_SHIFT6)
- ECase(R_MIPS_64)
- ECase(R_MIPS_GOT_DISP)
- ECase(R_MIPS_GOT_PAGE)
- ECase(R_MIPS_GOT_OFST)
- ECase(R_MIPS_GOT_HI16)
- ECase(R_MIPS_GOT_LO16)
- ECase(R_MIPS_SUB)
- ECase(R_MIPS_INSERT_A)
- ECase(R_MIPS_INSERT_B)
- ECase(R_MIPS_DELETE)
- ECase(R_MIPS_HIGHER)
- ECase(R_MIPS_HIGHEST)
- ECase(R_MIPS_CALL_HI16)
- ECase(R_MIPS_CALL_LO16)
- ECase(R_MIPS_SCN_DISP)
- ECase(R_MIPS_REL16)
- ECase(R_MIPS_ADD_IMMEDIATE)
- ECase(R_MIPS_PJUMP)
- ECase(R_MIPS_RELGOT)
- ECase(R_MIPS_JALR)
- ECase(R_MIPS_TLS_DTPMOD32)
- ECase(R_MIPS_TLS_DTPREL32)
- ECase(R_MIPS_TLS_DTPMOD64)
- ECase(R_MIPS_TLS_DTPREL64)
- ECase(R_MIPS_TLS_GD)
- ECase(R_MIPS_TLS_LDM)
- ECase(R_MIPS_TLS_DTPREL_HI16)
- ECase(R_MIPS_TLS_DTPREL_LO16)
- ECase(R_MIPS_TLS_GOTTPREL)
- ECase(R_MIPS_TLS_TPREL32)
- ECase(R_MIPS_TLS_TPREL64)
- ECase(R_MIPS_TLS_TPREL_HI16)
- ECase(R_MIPS_TLS_TPREL_LO16)
- ECase(R_MIPS_GLOB_DAT)
- ECase(R_MIPS_PC21_S2)
- ECase(R_MIPS_PC26_S2)
- ECase(R_MIPS_PC18_S3)
- ECase(R_MIPS_PC19_S2)
- ECase(R_MIPS_PCHI16)
- ECase(R_MIPS_PCLO16)
- ECase(R_MIPS16_GOT16)
- ECase(R_MIPS16_HI16)
- ECase(R_MIPS16_LO16)
- ECase(R_MIPS_COPY)
- ECase(R_MIPS_JUMP_SLOT)
- ECase(R_MICROMIPS_26_S1)
- ECase(R_MICROMIPS_HI16)
- ECase(R_MICROMIPS_LO16)
- ECase(R_MICROMIPS_GOT16)
- ECase(R_MICROMIPS_PC16_S1)
- ECase(R_MICROMIPS_CALL16)
- ECase(R_MICROMIPS_GOT_DISP)
- ECase(R_MICROMIPS_GOT_PAGE)
- ECase(R_MICROMIPS_GOT_OFST)
- ECase(R_MICROMIPS_TLS_GD)
- ECase(R_MICROMIPS_TLS_LDM)
- ECase(R_MICROMIPS_TLS_DTPREL_HI16)
- ECase(R_MICROMIPS_TLS_DTPREL_LO16)
- ECase(R_MICROMIPS_TLS_TPREL_HI16)
- ECase(R_MICROMIPS_TLS_TPREL_LO16)
- ECase(R_MIPS_NUM)
- ECase(R_MIPS_PC32)
+#include "llvm/Support/ELFRelocs/Mips.def"
break;
case ELF::EM_HEXAGON:
- ECase(R_HEX_NONE)
- ECase(R_HEX_B22_PCREL)
- ECase(R_HEX_B15_PCREL)
- ECase(R_HEX_B7_PCREL)
- ECase(R_HEX_LO16)
- ECase(R_HEX_HI16)
- ECase(R_HEX_32)
- ECase(R_HEX_16)
- ECase(R_HEX_8)
- ECase(R_HEX_GPREL16_0)
- ECase(R_HEX_GPREL16_1)
- ECase(R_HEX_GPREL16_2)
- ECase(R_HEX_GPREL16_3)
- ECase(R_HEX_HL16)
- ECase(R_HEX_B13_PCREL)
- ECase(R_HEX_B9_PCREL)
- ECase(R_HEX_B32_PCREL_X)
- ECase(R_HEX_32_6_X)
- ECase(R_HEX_B22_PCREL_X)
- ECase(R_HEX_B15_PCREL_X)
- ECase(R_HEX_B13_PCREL_X)
- ECase(R_HEX_B9_PCREL_X)
- ECase(R_HEX_B7_PCREL_X)
- ECase(R_HEX_16_X)
- ECase(R_HEX_12_X)
- ECase(R_HEX_11_X)
- ECase(R_HEX_10_X)
- ECase(R_HEX_9_X)
- ECase(R_HEX_8_X)
- ECase(R_HEX_7_X)
- ECase(R_HEX_6_X)
- ECase(R_HEX_32_PCREL)
- ECase(R_HEX_COPY)
- ECase(R_HEX_GLOB_DAT)
- ECase(R_HEX_JMP_SLOT)
- ECase(R_HEX_RELATIVE)
- ECase(R_HEX_PLT_B22_PCREL)
- ECase(R_HEX_GOTREL_LO16)
- ECase(R_HEX_GOTREL_HI16)
- ECase(R_HEX_GOTREL_32)
- ECase(R_HEX_GOT_LO16)
- ECase(R_HEX_GOT_HI16)
- ECase(R_HEX_GOT_32)
- ECase(R_HEX_GOT_16)
- ECase(R_HEX_DTPMOD_32)
- ECase(R_HEX_DTPREL_LO16)
- ECase(R_HEX_DTPREL_HI16)
- ECase(R_HEX_DTPREL_32)
- ECase(R_HEX_DTPREL_16)
- ECase(R_HEX_GD_PLT_B22_PCREL)
- ECase(R_HEX_GD_GOT_LO16)
- ECase(R_HEX_GD_GOT_HI16)
- ECase(R_HEX_GD_GOT_32)
- ECase(R_HEX_GD_GOT_16)
- ECase(R_HEX_IE_LO16)
- ECase(R_HEX_IE_HI16)
- ECase(R_HEX_IE_32)
- ECase(R_HEX_IE_GOT_LO16)
- ECase(R_HEX_IE_GOT_HI16)
- ECase(R_HEX_IE_GOT_32)
- ECase(R_HEX_IE_GOT_16)
- ECase(R_HEX_TPREL_LO16)
- ECase(R_HEX_TPREL_HI16)
- ECase(R_HEX_TPREL_32)
- ECase(R_HEX_TPREL_16)
- ECase(R_HEX_6_PCREL_X)
- ECase(R_HEX_GOTREL_32_6_X)
- ECase(R_HEX_GOTREL_16_X)
- ECase(R_HEX_GOTREL_11_X)
- ECase(R_HEX_GOT_32_6_X)
- ECase(R_HEX_GOT_16_X)
- ECase(R_HEX_GOT_11_X)
- ECase(R_HEX_DTPREL_32_6_X)
- ECase(R_HEX_DTPREL_16_X)
- ECase(R_HEX_DTPREL_11_X)
- ECase(R_HEX_GD_GOT_32_6_X)
- ECase(R_HEX_GD_GOT_16_X)
- ECase(R_HEX_GD_GOT_11_X)
- ECase(R_HEX_IE_32_6_X)
- ECase(R_HEX_IE_16_X)
- ECase(R_HEX_IE_GOT_32_6_X)
- ECase(R_HEX_IE_GOT_16_X)
- ECase(R_HEX_IE_GOT_11_X)
- ECase(R_HEX_TPREL_32_6_X)
- ECase(R_HEX_TPREL_16_X)
- ECase(R_HEX_TPREL_11_X)
+#include "llvm/Support/ELFRelocs/Hexagon.def"
break;
case ELF::EM_386:
- ECase(R_386_NONE)
- ECase(R_386_32)
- ECase(R_386_PC32)
- ECase(R_386_GOT32)
- ECase(R_386_PLT32)
- ECase(R_386_COPY)
- ECase(R_386_GLOB_DAT)
- ECase(R_386_JUMP_SLOT)
- ECase(R_386_RELATIVE)
- ECase(R_386_GOTOFF)
- ECase(R_386_GOTPC)
- ECase(R_386_32PLT)
- ECase(R_386_TLS_TPOFF)
- ECase(R_386_TLS_IE)
- ECase(R_386_TLS_GOTIE)
- ECase(R_386_TLS_LE)
- ECase(R_386_TLS_GD)
- ECase(R_386_TLS_LDM)
- ECase(R_386_16)
- ECase(R_386_PC16)
- ECase(R_386_8)
- ECase(R_386_PC8)
- ECase(R_386_TLS_GD_32)
- ECase(R_386_TLS_GD_PUSH)
- ECase(R_386_TLS_GD_CALL)
- ECase(R_386_TLS_GD_POP)
- ECase(R_386_TLS_LDM_32)
- ECase(R_386_TLS_LDM_PUSH)
- ECase(R_386_TLS_LDM_CALL)
- ECase(R_386_TLS_LDM_POP)
- ECase(R_386_TLS_LDO_32)
- ECase(R_386_TLS_IE_32)
- ECase(R_386_TLS_LE_32)
- ECase(R_386_TLS_DTPMOD32)
- ECase(R_386_TLS_DTPOFF32)
- ECase(R_386_TLS_TPOFF32)
- ECase(R_386_TLS_GOTDESC)
- ECase(R_386_TLS_DESC_CALL)
- ECase(R_386_TLS_DESC)
- ECase(R_386_IRELATIVE)
- ECase(R_386_NUM)
+#include "llvm/Support/ELFRelocs/i386.def"
break;
case ELF::EM_AARCH64:
- ECase(R_AARCH64_NONE)
- ECase(R_AARCH64_ABS64)
- ECase(R_AARCH64_ABS32)
- ECase(R_AARCH64_ABS16)
- ECase(R_AARCH64_PREL64)
- ECase(R_AARCH64_PREL32)
- ECase(R_AARCH64_PREL16)
- ECase(R_AARCH64_MOVW_UABS_G0)
- ECase(R_AARCH64_MOVW_UABS_G0_NC)
- ECase(R_AARCH64_MOVW_UABS_G1)
- ECase(R_AARCH64_MOVW_UABS_G1_NC)
- ECase(R_AARCH64_MOVW_UABS_G2)
- ECase(R_AARCH64_MOVW_UABS_G2_NC)
- ECase(R_AARCH64_MOVW_UABS_G3)
- ECase(R_AARCH64_MOVW_SABS_G0)
- ECase(R_AARCH64_MOVW_SABS_G1)
- ECase(R_AARCH64_MOVW_SABS_G2)
- ECase(R_AARCH64_LD_PREL_LO19)
- ECase(R_AARCH64_ADR_PREL_LO21)
- ECase(R_AARCH64_ADR_PREL_PG_HI21)
- ECase(R_AARCH64_ADD_ABS_LO12_NC)
- ECase(R_AARCH64_LDST8_ABS_LO12_NC)
- ECase(R_AARCH64_TSTBR14)
- ECase(R_AARCH64_CONDBR19)
- ECase(R_AARCH64_JUMP26)
- ECase(R_AARCH64_CALL26)
- ECase(R_AARCH64_LDST16_ABS_LO12_NC)
- ECase(R_AARCH64_LDST32_ABS_LO12_NC)
- ECase(R_AARCH64_LDST64_ABS_LO12_NC)
- ECase(R_AARCH64_LDST128_ABS_LO12_NC)
- ECase(R_AARCH64_GOTREL64)
- ECase(R_AARCH64_GOTREL32)
- ECase(R_AARCH64_ADR_GOT_PAGE)
- ECase(R_AARCH64_LD64_GOT_LO12_NC)
- ECase(R_AARCH64_TLSLD_MOVW_DTPREL_G2)
- ECase(R_AARCH64_TLSLD_MOVW_DTPREL_G1)
- ECase(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC)
- ECase(R_AARCH64_TLSLD_MOVW_DTPREL_G0)
- ECase(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC)
- ECase(R_AARCH64_TLSLD_ADD_DTPREL_HI12)
- ECase(R_AARCH64_TLSLD_ADD_DTPREL_LO12)
- ECase(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC)
- ECase(R_AARCH64_TLSLD_LDST8_DTPREL_LO12)
- ECase(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC)
- ECase(R_AARCH64_TLSLD_LDST16_DTPREL_LO12)
- ECase(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC)
- ECase(R_AARCH64_TLSLD_LDST32_DTPREL_LO12)
- ECase(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC)
- ECase(R_AARCH64_TLSLD_LDST64_DTPREL_LO12)
- ECase(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC)
- ECase(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1)
- ECase(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC)
- ECase(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21)
- ECase(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC)
- ECase(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19)
- ECase(R_AARCH64_TLSLE_MOVW_TPREL_G2)
- ECase(R_AARCH64_TLSLE_MOVW_TPREL_G1)
- ECase(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC)
- ECase(R_AARCH64_TLSLE_MOVW_TPREL_G0)
- ECase(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC)
- ECase(R_AARCH64_TLSLE_ADD_TPREL_HI12)
- ECase(R_AARCH64_TLSLE_ADD_TPREL_LO12)
- ECase(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)
- ECase(R_AARCH64_TLSLE_LDST8_TPREL_LO12)
- ECase(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC)
- ECase(R_AARCH64_TLSLE_LDST16_TPREL_LO12)
- ECase(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC)
- ECase(R_AARCH64_TLSLE_LDST32_TPREL_LO12)
- ECase(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC)
- ECase(R_AARCH64_TLSLE_LDST64_TPREL_LO12)
- ECase(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC)
- ECase(R_AARCH64_TLSDESC_ADR_PAGE)
- ECase(R_AARCH64_TLSDESC_LD64_LO12_NC)
- ECase(R_AARCH64_TLSDESC_ADD_LO12_NC)
- ECase(R_AARCH64_TLSDESC_CALL)
- ECase(R_AARCH64_COPY)
- ECase(R_AARCH64_GLOB_DAT)
- ECase(R_AARCH64_JUMP_SLOT)
- ECase(R_AARCH64_RELATIVE)
- ECase(R_AARCH64_TLS_DTPREL64)
- ECase(R_AARCH64_TLS_DTPMOD64)
- ECase(R_AARCH64_TLS_TPREL64)
- ECase(R_AARCH64_TLSDESC)
- ECase(R_AARCH64_IRELATIVE)
+#include "llvm/Support/ELFRelocs/AArch64.def"
+ break;
+ case ELF::EM_ARM:
+#include "llvm/Support/ELFRelocs/ARM.def"
break;
default:
llvm_unreachable("Unsupported architecture");
}
-#undef ECase
+#undef ELF_RELOC
}
void MappingTraits<ELFYAML::FileHeader>::mapping(IO &IO,
@@ -815,6 +506,7 @@ static void commonSectionMapping(IO &IO, ELFYAML::Section &Section) {
IO.mapOptional("Address", Section.Address, Hex64(0));
IO.mapOptional("Link", Section.Link, StringRef());
IO.mapOptional("AddressAlign", Section.AddressAlign, Hex64(0));
+ IO.mapOptional("Info", Section.Info, StringRef());
}
static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) {
@@ -825,10 +517,19 @@ static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) {
static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
commonSectionMapping(IO, Section);
- IO.mapOptional("Info", Section.Info, StringRef());
IO.mapOptional("Relocations", Section.Relocations);
}
+static void groupSectionMapping(IO &IO, ELFYAML::Group &group) {
+ commonSectionMapping(IO, group);
+ IO.mapRequired("Members", group.Members);
+}
+
+void MappingTraits<ELFYAML::SectionOrType>::mapping(
+ IO &IO, ELFYAML::SectionOrType &sectionOrType) {
+ IO.mapRequired("SectionOrType", sectionOrType.sectionNameOrType);
+}
+
void MappingTraits<std::unique_ptr<ELFYAML::Section>>::mapping(
IO &IO, std::unique_ptr<ELFYAML::Section> &Section) {
ELFYAML::ELF_SHT sectionType;
@@ -844,6 +545,11 @@ void MappingTraits<std::unique_ptr<ELFYAML::Section>>::mapping(
Section.reset(new ELFYAML::RelocationSection());
sectionMapping(IO, *cast<ELFYAML::RelocationSection>(Section.get()));
break;
+ case ELF::SHT_GROUP:
+ if (!IO.outputting())
+ Section.reset(new ELFYAML::Group());
+ groupSectionMapping(IO, *cast<ELFYAML::Group>(Section.get()));
+ break;
default:
if (!IO.outputting())
Section.reset(new ELFYAML::RawContentSection());
@@ -859,12 +565,49 @@ StringRef MappingTraits<std::unique_ptr<ELFYAML::Section>>::validate(
return "Section size must be greater or equal to the content size";
}
+namespace {
+struct NormalizedMips64RelType {
+ NormalizedMips64RelType(IO &)
+ : Type(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
+ Type2(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
+ Type3(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
+ SpecSym(ELFYAML::ELF_REL(ELF::RSS_UNDEF)) {}
+ NormalizedMips64RelType(IO &, ELFYAML::ELF_REL Original)
+ : Type(Original & 0xFF), Type2(Original >> 8 & 0xFF),
+ Type3(Original >> 16 & 0xFF), SpecSym(Original >> 24 & 0xFF) {}
+
+ ELFYAML::ELF_REL denormalize(IO &) {
+ ELFYAML::ELF_REL Res = Type | Type2 << 8 | Type3 << 16 | SpecSym << 24;
+ return Res;
+ }
+
+ ELFYAML::ELF_REL Type;
+ ELFYAML::ELF_REL Type2;
+ ELFYAML::ELF_REL Type3;
+ ELFYAML::ELF_RSS SpecSym;
+};
+}
+
void MappingTraits<ELFYAML::Relocation>::mapping(IO &IO,
ELFYAML::Relocation &Rel) {
+ const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
+ assert(Object && "The IO context is not initialized");
+
IO.mapRequired("Offset", Rel.Offset);
IO.mapRequired("Symbol", Rel.Symbol);
- IO.mapRequired("Type", Rel.Type);
- IO.mapOptional("Addend", Rel.Addend);
+
+ if (Object->Header.Machine == ELFYAML::ELF_EM(ELF::EM_MIPS) &&
+ Object->Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64)) {
+ MappingNormalization<NormalizedMips64RelType, ELFYAML::ELF_REL> Key(
+ IO, Rel.Type);
+ IO.mapRequired("Type", Key->Type);
+ IO.mapOptional("Type2", Key->Type2, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
+ IO.mapOptional("Type3", Key->Type3, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
+ IO.mapOptional("SpecSym", Key->SpecSym, ELFYAML::ELF_RSS(ELF::RSS_UNDEF));
+ } else
+ IO.mapRequired("Type", Rel.Type);
+
+ IO.mapOptional("Addend", Rel.Addend, (int64_t)0);
}
void MappingTraits<ELFYAML::Object>::mapping(IO &IO, ELFYAML::Object &Object) {
diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp
index 7256a2f..a2cbdcd 100644
--- a/lib/Object/IRObjectFile.cpp
+++ b/lib/Object/IRObjectFile.cpp
@@ -14,17 +14,17 @@
#include "llvm/Object/IRObjectFile.h"
#include "RecordStreamer.h"
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/GVMaterializer.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Module.h"
-#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCObjectFileInfo.h"
-#include "llvm/MC/MCTargetAsmParser.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCTargetAsmParser.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
@@ -73,6 +73,7 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)
MCContext MCCtx(MAI.get(), MRI.get(), &MOFI);
MOFI.InitMCObjectFileInfo(Triple, Reloc::Default, CodeModel::Default, MCCtx);
std::unique_ptr<RecordStreamer> Streamer(new RecordStreamer(MCCtx));
+ T->createNullTargetStreamer(*Streamer);
std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(InlineAsm));
SourceMgr SrcMgr;
@@ -116,7 +117,7 @@ IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)
IRObjectFile::~IRObjectFile() {
}
-static const GlobalValue *getGV(DataRefImpl &Symb) {
+static GlobalValue *getGV(DataRefImpl &Symb) {
if ((Symb.p & 3) == 3)
return nullptr;
@@ -181,6 +182,8 @@ void IRObjectFile::moveSymbolNext(DataRefImpl &Symb) const {
Res = (Index << 2) | 3;
break;
}
+ default:
+ llvm_unreachable("unreachable case");
}
Symb.p = Res;
@@ -235,10 +238,9 @@ uint32_t IRObjectFile::getSymbolFlags(DataRefImpl Symb) const {
return Res;
}
-const GlobalValue *IRObjectFile::getSymbolGV(DataRefImpl Symb) const {
- const GlobalValue *GV = getGV(Symb);
- return GV;
-}
+GlobalValue *IRObjectFile::getSymbolGV(DataRefImpl Symb) { return getGV(Symb); }
+
+std::unique_ptr<Module> IRObjectFile::takeModule() { return std::move(M); }
basic_symbol_iterator IRObjectFile::symbol_begin_impl() const {
Module::const_iterator I = M->begin();
@@ -291,8 +293,8 @@ ErrorOr<MemoryBufferRef> IRObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Ob
}
ErrorOr<std::unique_ptr<IRObjectFile>>
-llvm::object::IRObjectFile::createIRObjectFile(MemoryBufferRef Object,
- LLVMContext &Context) {
+llvm::object::IRObjectFile::create(MemoryBufferRef Object,
+ LLVMContext &Context) {
ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object);
if (!BCOrErr)
return BCOrErr.getError();
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index bbef639..4a1c311 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -38,8 +38,12 @@ namespace {
};
}
-template<typename T>
+template <typename T>
static T getStruct(const MachOObjectFile *O, const char *P) {
+ // Don't read before the beginning or past the end of the file
+ if (P < O->getData().begin() || P + sizeof(T) > O->getData().end())
+ report_fatal_error("Malformed MachO file.");
+
T Cmd;
memcpy(&Cmd, P, sizeof(T));
if (O->isLittleEndian() != sys::IsLittleEndianHost)
@@ -47,15 +51,26 @@ static T getStruct(const MachOObjectFile *O, const char *P) {
return Cmd;
}
+template <typename SegmentCmd>
+static uint32_t getSegmentLoadCommandNumSections(const SegmentCmd &S,
+ uint32_t Cmdsize) {
+ const unsigned SectionSize = sizeof(SegmentCmd);
+ if (S.nsects > std::numeric_limits<uint32_t>::max() / SectionSize ||
+ S.nsects * SectionSize > Cmdsize - sizeof(S))
+ report_fatal_error(
+ "Number of sections too large for size of load command.");
+ return S.nsects;
+}
+
static uint32_t
getSegmentLoadCommandNumSections(const MachOObjectFile *O,
const MachOObjectFile::LoadCommandInfo &L) {
- if (O->is64Bit()) {
- MachO::segment_command_64 S = O->getSegment64LoadCommand(L);
- return S.nsects;
- }
- MachO::segment_command S = O->getSegmentLoadCommand(L);
- return S.nsects;
+ if (O->is64Bit())
+ return getSegmentLoadCommandNumSections(O->getSegment64LoadCommand(L),
+ L.C.cmdsize);
+
+ return getSegmentLoadCommandNumSections(O->getSegmentLoadCommand(L),
+ L.C.cmdsize);
}
static bool isPageZeroSegment(const MachOObjectFile *O,
@@ -233,9 +248,13 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
bool Is64bits, std::error_code &EC)
: ObjectFile(getMachOType(IsLittleEndian, Is64bits), Object),
SymtabLoadCmd(nullptr), DysymtabLoadCmd(nullptr),
- DataInCodeLoadCmd(nullptr), DyldInfoLoadCmd(nullptr),
- UuidLoadCmd(nullptr), HasPageZeroSegment(false) {
+ DataInCodeLoadCmd(nullptr), LinkOptHintsLoadCmd(nullptr),
+ DyldInfoLoadCmd(nullptr), UuidLoadCmd(nullptr),
+ HasPageZeroSegment(false) {
uint32_t LoadCommandCount = this->getHeader().ncmds;
+ if (LoadCommandCount == 0)
+ return;
+
MachO::LoadCommandType SegmentLoadType = is64Bit() ?
MachO::LC_SEGMENT_64 : MachO::LC_SEGMENT;
@@ -262,6 +281,13 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
return;
}
DataInCodeLoadCmd = Load.Ptr;
+ } else if (Load.C.cmd == MachO::LC_LINKER_OPTIMIZATION_HINT) {
+ // Multiple linker optimization hint tables
+ if (LinkOptHintsLoadCmd) {
+ EC = object_error::parse_failed;
+ return;
+ }
+ LinkOptHintsLoadCmd = Load.Ptr;
} else if (Load.C.cmd == MachO::LC_DYLD_INFO ||
Load.C.cmd == MachO::LC_DYLD_INFO_ONLY) {
// Multiple dyldinfo load commands
@@ -278,6 +304,12 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
}
UuidLoadCmd = Load.Ptr;
} else if (Load.C.cmd == SegmentLoadType) {
+ const unsigned SegmentLoadSize = this->is64Bit()
+ ? sizeof(MachO::segment_command_64)
+ : sizeof(MachO::segment_command);
+ if (Load.C.cmdsize < SegmentLoadSize)
+ report_fatal_error("Segment load command size is too small.");
+
uint32_t NumSections = getSegmentLoadCommandNumSections(this, Load);
for (unsigned J = 0; J < NumSections; ++J) {
const char *Sec = getSectionPtr(this, Load, J);
@@ -312,10 +344,19 @@ std::error_code MachOObjectFile::getSymbolName(DataRefImpl Symb,
StringRef StringTable = getStringTableData();
MachO::nlist_base Entry = getSymbolTableEntryBase(this, Symb);
const char *Start = &StringTable.data()[Entry.n_strx];
+ if (Start < getData().begin() || Start >= getData().end())
+ report_fatal_error(
+ "Symbol name entry points before beginning or past end of file.");
Res = StringRef(Start);
return object_error::success;
}
+unsigned MachOObjectFile::getSectionType(SectionRef Sec) const {
+ DataRefImpl DRI = Sec.getRawDataRefImpl();
+ uint32_t Flags = getSectionFlags(this, DRI);
+ return Flags & MachO::SECTION_TYPE;
+}
+
// getIndirectName() returns the name of the alias'ed symbol who's string table
// index is in the n_value field.
std::error_code MachOObjectFile::getIndirectName(DataRefImpl Symb,
@@ -469,6 +510,9 @@ uint32_t MachOObjectFile::getSymbolFlags(DataRefImpl DRI) const {
if (Value && Value != UnknownAddressOrSize)
Result |= SymbolRef::SF_Common;
}
+
+ if (!(MachOType & MachO::N_PEXT))
+ Result |= SymbolRef::SF_Exported;
}
if (MachOFlags & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF))
@@ -575,32 +619,11 @@ bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const {
SectionType == MachO::S_GB_ZEROFILL);
}
-bool MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sect) const {
- // FIXME: Unimplemented.
- return true;
-}
-
bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const {
// FIXME: Unimplemented.
return false;
}
-bool MachOObjectFile::isSectionZeroInit(DataRefImpl Sec) const {
- uint32_t Flags = getSectionFlags(this, Sec);
- unsigned SectionType = Flags & MachO::SECTION_TYPE;
- return SectionType == MachO::S_ZEROFILL ||
- SectionType == MachO::S_GB_ZEROFILL;
-}
-
-bool MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec) const {
- // Consider using the code from isSectionText to look for __const sections.
- // Alternately, emit S_ATTR_PURE_INSTRUCTIONS and/or S_ATTR_SOME_INSTRUCTIONS
- // to use section attributes to distinguish code from data.
-
- // FIXME: Unimplemented.
- return false;
-}
-
bool MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,
DataRefImpl Symb) const {
SymbolRef::Type ST;
@@ -1213,7 +1236,8 @@ basic_symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index) const {
return basic_symbol_iterator(SymbolRef(DRI, this));
MachO::symtab_command Symtab = getSymtabLoadCommand();
- assert(Index < Symtab.nsyms && "Requested symbol index is out of range.");
+ if (Index >= Symtab.nsyms)
+ report_fatal_error("Requested symbol index is out of range.");
unsigned SymbolTableEntrySize =
is64Bit() ? sizeof(MachO::nlist_64) : sizeof(MachO::nlist);
DRI.p = reinterpret_cast<uintptr_t>(getPtr(this, Symtab.symoff));
@@ -1655,7 +1679,10 @@ void ExportEntry::moveNext() {
iterator_range<export_iterator>
MachOObjectFile::exports(ArrayRef<uint8_t> Trie) {
ExportEntry Start(Trie);
- Start.moveToFirst();
+ if (Trie.size() == 0)
+ Start.moveToEnd();
+ else
+ Start.moveToFirst();
ExportEntry Finish(Trie);
Finish.moveToEnd();
@@ -2114,6 +2141,8 @@ MachOObjectFile::getSectionFinalSegmentName(DataRefImpl Sec) const {
ArrayRef<char>
MachOObjectFile::getSectionRawName(DataRefImpl Sec) const {
+ if (Sec.d.a >= Sections.size())
+ report_fatal_error("getSectionRawName: Invalid section index");
const section_base *Base =
reinterpret_cast<const section_base *>(Sections[Sec.d.a]);
return makeArrayRef(Base->sectname);
@@ -2121,6 +2150,8 @@ MachOObjectFile::getSectionRawName(DataRefImpl Sec) const {
ArrayRef<char>
MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
+ if (Sec.d.a >= Sections.size())
+ report_fatal_error("getSectionRawFinalSegmentName: Invalid section index");
const section_base *Base =
reinterpret_cast<const section_base *>(Sections[Sec.d.a]);
return makeArrayRef(Base->segname);
@@ -2211,6 +2242,8 @@ MachOObjectFile::getFirstLoadCommandInfo() const {
sizeof(MachO::mach_header);
Load.Ptr = getPtr(this, HeaderSize);
Load.C = getStruct<MachO::load_command>(this, Load.Ptr);
+ if (Load.C.cmdsize < 8)
+ report_fatal_error("Load command with size < 8 bytes.");
return Load;
}
@@ -2219,14 +2252,22 @@ MachOObjectFile::getNextLoadCommandInfo(const LoadCommandInfo &L) const {
MachOObjectFile::LoadCommandInfo Next;
Next.Ptr = L.Ptr + L.C.cmdsize;
Next.C = getStruct<MachO::load_command>(this, Next.Ptr);
+ if (Next.C.cmdsize < 8)
+ report_fatal_error("Load command with size < 8 bytes.");
return Next;
}
MachO::section MachOObjectFile::getSection(DataRefImpl DRI) const {
+ // TODO: What if Sections.size() == 0?
+ if (DRI.d.a >= Sections.size())
+ report_fatal_error("getSection: Invalid section index.");
return getStruct<MachO::section>(this, Sections[DRI.d.a]);
}
MachO::section_64 MachOObjectFile::getSection64(DataRefImpl DRI) const {
+ // TODO: What if Sections.size() == 0?
+ if (DRI.d.a >= Sections.size())
+ report_fatal_error("getSection64: Invalid section index.");
return getStruct<MachO::section_64>(this, Sections[DRI.d.a]);
}
@@ -2269,9 +2310,9 @@ MachOObjectFile::getSegment64LoadCommand(const LoadCommandInfo &L) const {
return getStruct<MachO::segment_command_64>(this, L.Ptr);
}
-MachO::linker_options_command
-MachOObjectFile::getLinkerOptionsLoadCommand(const LoadCommandInfo &L) const {
- return getStruct<MachO::linker_options_command>(this, L.Ptr);
+MachO::linker_option_command
+MachOObjectFile::getLinkerOptionLoadCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::linker_option_command>(this, L.Ptr);
}
MachO::version_min_command
@@ -2299,6 +2340,11 @@ MachOObjectFile::getUuidCommand(const LoadCommandInfo &L) const {
return getStruct<MachO::uuid_command>(this, L.Ptr);
}
+MachO::rpath_command
+MachOObjectFile::getRpathCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::rpath_command>(this, L.Ptr);
+}
+
MachO::source_version_command
MachOObjectFile::getSourceVersionCommand(const LoadCommandInfo &L) const {
return getStruct<MachO::source_version_command>(this, L.Ptr);
@@ -2309,6 +2355,50 @@ MachOObjectFile::getEntryPointCommand(const LoadCommandInfo &L) const {
return getStruct<MachO::entry_point_command>(this, L.Ptr);
}
+MachO::encryption_info_command
+MachOObjectFile::getEncryptionInfoCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::encryption_info_command>(this, L.Ptr);
+}
+
+MachO::encryption_info_command_64
+MachOObjectFile::getEncryptionInfoCommand64(const LoadCommandInfo &L) const {
+ return getStruct<MachO::encryption_info_command_64>(this, L.Ptr);
+}
+
+MachO::sub_framework_command
+MachOObjectFile::getSubFrameworkCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::sub_framework_command>(this, L.Ptr);
+}
+
+MachO::sub_umbrella_command
+MachOObjectFile::getSubUmbrellaCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::sub_umbrella_command>(this, L.Ptr);
+}
+
+MachO::sub_library_command
+MachOObjectFile::getSubLibraryCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::sub_library_command>(this, L.Ptr);
+}
+
+MachO::sub_client_command
+MachOObjectFile::getSubClientCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::sub_client_command>(this, L.Ptr);
+}
+
+MachO::routines_command
+MachOObjectFile::getRoutinesCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::routines_command>(this, L.Ptr);
+}
+
+MachO::routines_command_64
+MachOObjectFile::getRoutinesCommand64(const LoadCommandInfo &L) const {
+ return getStruct<MachO::routines_command_64>(this, L.Ptr);
+}
+
+MachO::thread_command
+MachOObjectFile::getThreadCommand(const LoadCommandInfo &L) const {
+ return getStruct<MachO::thread_command>(this, L.Ptr);
+}
MachO::any_relocation_info
MachOObjectFile::getRelocation(DataRefImpl Rel) const {
@@ -2415,6 +2505,21 @@ MachOObjectFile::getDataInCodeLoadCommand() const {
return Cmd;
}
+MachO::linkedit_data_command
+MachOObjectFile::getLinkOptHintsLoadCommand() const {
+ if (LinkOptHintsLoadCmd)
+ return getStruct<MachO::linkedit_data_command>(this, LinkOptHintsLoadCmd);
+
+ // If there is no LinkOptHintsLoadCmd return a load command with zero'ed
+ // fields.
+ MachO::linkedit_data_command Cmd;
+ Cmd.cmd = MachO::LC_LINKER_OPTIMIZATION_HINT;
+ Cmd.cmdsize = sizeof(MachO::linkedit_data_command);
+ Cmd.dataoff = 0;
+ Cmd.datasize = 0;
+ return Cmd;
+}
+
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
if (!DyldInfoLoadCmd)
return ArrayRef<uint8_t>();
diff --git a/lib/Object/MachOUniversal.cpp b/lib/Object/MachOUniversal.cpp
index 77aeb63..a01c838 100644
--- a/lib/Object/MachOUniversal.cpp
+++ b/lib/Object/MachOUniversal.cpp
@@ -12,9 +12,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/Object/MachOUniversal.h"
+#include "llvm/Object/Archive.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h"
-#include "llvm/Object/Archive.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -79,20 +79,16 @@ MachOUniversalBinary::ObjectForArch::getAsObjectFile() const {
return object_error::parse_failed;
}
-std::error_code MachOUniversalBinary::ObjectForArch::getAsArchive(
- std::unique_ptr<Archive> &Result) const {
- if (Parent) {
- StringRef ParentData = Parent->getData();
- StringRef ObjectData = ParentData.substr(Header.offset, Header.size);
- StringRef ObjectName = Parent->getFileName();
- MemoryBufferRef ObjBuffer(ObjectData, ObjectName);
- ErrorOr<std::unique_ptr<Archive>> Obj = Archive::create(ObjBuffer);
- if (std::error_code EC = Obj.getError())
- return EC;
- Result = std::move(Obj.get());
- return object_error::success;
- }
- return object_error::parse_failed;
+ErrorOr<std::unique_ptr<Archive>>
+MachOUniversalBinary::ObjectForArch::getAsArchive() const {
+ if (!Parent)
+ return object_error::parse_failed;
+
+ StringRef ParentData = Parent->getData();
+ StringRef ObjectData = ParentData.substr(Header.offset, Header.size);
+ StringRef ObjectName = Parent->getFileName();
+ MemoryBufferRef ObjBuffer(ObjectData, ObjectName);
+ return Archive::create(ObjBuffer);
}
void MachOUniversalBinary::anchor() { }
diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp
index fd78271..01b7654 100644
--- a/lib/Object/ObjectFile.cpp
+++ b/lib/Object/ObjectFile.cpp
@@ -76,6 +76,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type) {
case sys::fs::file_magic::macho_bundle:
case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
case sys::fs::file_magic::macho_dsym_companion:
+ case sys::fs::file_magic::macho_kext_bundle:
return createMachOObjectFile(Object);
case sys::fs::file_magic::coff_object:
case sys::fs::file_magic::coff_import_library:
diff --git a/lib/Object/SymbolicFile.cpp b/lib/Object/SymbolicFile.cpp
index ffd3dbc..854e68e 100644
--- a/lib/Object/SymbolicFile.cpp
+++ b/lib/Object/SymbolicFile.cpp
@@ -33,7 +33,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
switch (Type) {
case sys::fs::file_magic::bitcode:
if (Context)
- return IRObjectFile::createIRObjectFile(Object, *Context);
+ return IRObjectFile::create(Object, *Context);
// Fallthrough
case sys::fs::file_magic::unknown:
case sys::fs::file_magic::archive:
@@ -53,6 +53,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
case sys::fs::file_magic::macho_bundle:
case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
case sys::fs::file_magic::macho_dsym_companion:
+ case sys::fs::file_magic::macho_kext_bundle:
case sys::fs::file_magic::coff_import_library:
case sys::fs::file_magic::pecoff_executable:
return ObjectFile::createObjectFile(Object, Type);
@@ -69,7 +70,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
if (!BCData)
return std::move(Obj);
- return IRObjectFile::createIRObjectFile(
+ return IRObjectFile::create(
MemoryBufferRef(BCData->getBuffer(), Object.getBufferIdentifier()),
*Context);
}