2013-08-09 00:27:13 +02:00
|
|
|
//===- ELF.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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Object/ELF.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace object {
|
|
|
|
|
2014-11-21 21:16:07 +01:00
|
|
|
#define ELF_RELOC(name, value) \
|
|
|
|
case ELF::name: \
|
|
|
|
return #name; \
|
2013-08-09 00:27:13 +02:00
|
|
|
|
|
|
|
StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type) {
|
|
|
|
switch (Machine) {
|
|
|
|
case ELF::EM_X86_64:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/x86_64.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELF::EM_386:
|
2015-11-04 12:21:50 +01:00
|
|
|
case ELF::EM_IAMCU:
|
2013-08-09 00:27:13 +02:00
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/i386.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELF::EM_MIPS:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/Mips.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELF::EM_AARCH64:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/AArch64.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELF::EM_ARM:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/ARM.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2016-09-28 15:23:42 +02:00
|
|
|
case ELF::EM_AVR:
|
|
|
|
switch (Type) {
|
|
|
|
#include "llvm/Support/ELFRelocs/AVR.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2013-08-09 00:27:13 +02:00
|
|
|
case ELF::EM_HEXAGON:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/Hexagon.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2016-03-01 22:21:42 +01:00
|
|
|
case ELF::EM_LANAI:
|
|
|
|
switch (Type) {
|
|
|
|
#include "llvm/Support/ELFRelocs/Lanai.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2013-08-09 00:27:13 +02:00
|
|
|
case ELF::EM_PPC:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/PowerPC.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELF::EM_PPC64:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/PowerPC64.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2016-11-01 17:59:37 +01:00
|
|
|
case ELF::EM_RISCV:
|
|
|
|
switch (Type) {
|
|
|
|
#include "llvm/Support/ELFRelocs/RISCV.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2013-08-09 00:27:13 +02:00
|
|
|
case ELF::EM_S390:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/SystemZ.def"
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-01-26 04:21:28 +01:00
|
|
|
case ELF::EM_SPARC:
|
|
|
|
case ELF::EM_SPARC32PLUS:
|
|
|
|
case ELF::EM_SPARCV9:
|
|
|
|
switch (Type) {
|
2014-11-21 21:16:07 +01:00
|
|
|
#include "llvm/Support/ELFRelocs/Sparc.def"
|
2014-01-26 04:21:28 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2016-01-12 21:56:01 +01:00
|
|
|
case ELF::EM_WEBASSEMBLY:
|
|
|
|
switch (Type) {
|
|
|
|
#include "llvm/Support/ELFRelocs/WebAssembly.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2016-06-18 00:38:08 +02:00
|
|
|
case ELF::EM_AMDGPU:
|
|
|
|
switch (Type) {
|
|
|
|
#include "llvm/Support/ELFRelocs/AMDGPU.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-07-16 00:27:55 +02:00
|
|
|
case ELF::EM_BPF:
|
|
|
|
switch (Type) {
|
|
|
|
#include "llvm/Support/ELFRelocs/BPF.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-06-18 00:38:08 +02:00
|
|
|
break;
|
2013-08-09 00:27:13 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2014-11-21 21:16:07 +01:00
|
|
|
#undef ELF_RELOC
|
2013-08-09 00:27:13 +02:00
|
|
|
|
|
|
|
} // end namespace object
|
|
|
|
} // end namespace llvm
|