]> git.proxmox.com Git - rustc.git/blame - src/llvm/lib/Object/ELF.cpp
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / lib / Object / ELF.cpp
CommitLineData
1a4d82fc
JJ
1//===- ELF.cpp - ELF object file implementation -----------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/Object/ELF.h"
11
12namespace llvm {
13namespace object {
14
85aaf69f
SL
15#define ELF_RELOC(name, value) \
16 case ELF::name: \
17 return #name; \
1a4d82fc
JJ
18
19StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type) {
20 switch (Machine) {
21 case ELF::EM_X86_64:
22 switch (Type) {
85aaf69f 23#include "llvm/Support/ELFRelocs/x86_64.def"
1a4d82fc
JJ
24 default:
25 break;
26 }
27 break;
28 case ELF::EM_386:
29 switch (Type) {
85aaf69f 30#include "llvm/Support/ELFRelocs/i386.def"
1a4d82fc
JJ
31 default:
32 break;
33 }
34 break;
35 case ELF::EM_MIPS:
36 switch (Type) {
85aaf69f 37#include "llvm/Support/ELFRelocs/Mips.def"
1a4d82fc
JJ
38 default:
39 break;
40 }
41 break;
42 case ELF::EM_AARCH64:
43 switch (Type) {
85aaf69f 44#include "llvm/Support/ELFRelocs/AArch64.def"
1a4d82fc
JJ
45 default:
46 break;
47 }
48 break;
49 case ELF::EM_ARM:
50 switch (Type) {
85aaf69f 51#include "llvm/Support/ELFRelocs/ARM.def"
1a4d82fc
JJ
52 default:
53 break;
54 }
55 break;
56 case ELF::EM_HEXAGON:
57 switch (Type) {
85aaf69f 58#include "llvm/Support/ELFRelocs/Hexagon.def"
1a4d82fc
JJ
59 default:
60 break;
61 }
62 break;
63 case ELF::EM_PPC:
64 switch (Type) {
85aaf69f 65#include "llvm/Support/ELFRelocs/PowerPC.def"
1a4d82fc
JJ
66 default:
67 break;
68 }
69 break;
70 case ELF::EM_PPC64:
71 switch (Type) {
85aaf69f 72#include "llvm/Support/ELFRelocs/PowerPC64.def"
1a4d82fc
JJ
73 default:
74 break;
75 }
76 break;
77 case ELF::EM_S390:
78 switch (Type) {
85aaf69f 79#include "llvm/Support/ELFRelocs/SystemZ.def"
1a4d82fc
JJ
80 default:
81 break;
82 }
83 break;
84 case ELF::EM_SPARC:
85 case ELF::EM_SPARC32PLUS:
86 case ELF::EM_SPARCV9:
87 switch (Type) {
85aaf69f 88#include "llvm/Support/ELFRelocs/Sparc.def"
1a4d82fc
JJ
89 default:
90 break;
91 }
92 break;
93 default:
94 break;
95 }
96 return "Unknown";
97}
98
85aaf69f 99#undef ELF_RELOC
1a4d82fc
JJ
100
101} // end namespace object
102} // end namespace llvm