0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 //===- ELFYAML.cpp - ELF YAMLIO implementation ----------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 // The LLVM Compiler Infrastructure
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 // This file is distributed under the University of Illinois Open Source
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 // License. See LICENSE.TXT for details.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 //===----------------------------------------------------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 // This file defines classes for handling the YAML representation of ELF.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 //===----------------------------------------------------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 #include "llvm/Object/ELFYAML.h"
|
77
|
15 #include "llvm/Support/Casting.h"
|
95
|
16 #include "llvm/Support/MipsABIFlags.h"
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 namespace llvm {
|
77
|
19
|
|
20 ELFYAML::Section::~Section() {}
|
|
21
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 namespace yaml {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 void
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 ScalarEnumerationTraits<ELFYAML::ELF_ET>::enumeration(IO &IO,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 ELFYAML::ELF_ET &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 ECase(ET_NONE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 ECase(ET_REL)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 ECase(ET_EXEC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 ECase(ET_DYN)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 ECase(ET_CORE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 #undef ECase
|
83
|
34 IO.enumFallback<Hex16>(Value);
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 void
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 ScalarEnumerationTraits<ELFYAML::ELF_EM>::enumeration(IO &IO,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 ELFYAML::ELF_EM &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 ECase(EM_NONE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 ECase(EM_M32)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 ECase(EM_SPARC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 ECase(EM_386)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 ECase(EM_68K)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 ECase(EM_88K)
|
95
|
47 ECase(EM_IAMCU)
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 ECase(EM_860)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 ECase(EM_MIPS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 ECase(EM_S370)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 ECase(EM_MIPS_RS3_LE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 ECase(EM_PARISC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 ECase(EM_VPP500)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 ECase(EM_SPARC32PLUS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 ECase(EM_960)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 ECase(EM_PPC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 ECase(EM_PPC64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 ECase(EM_S390)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 ECase(EM_SPU)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 ECase(EM_V800)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 ECase(EM_FR20)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 ECase(EM_RH32)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 ECase(EM_RCE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 ECase(EM_ARM)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 ECase(EM_ALPHA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 ECase(EM_SH)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 ECase(EM_SPARCV9)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 ECase(EM_TRICORE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 ECase(EM_ARC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 ECase(EM_H8_300)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 ECase(EM_H8_300H)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 ECase(EM_H8S)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 ECase(EM_H8_500)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 ECase(EM_IA_64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 ECase(EM_MIPS_X)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 ECase(EM_COLDFIRE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 ECase(EM_68HC12)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 ECase(EM_MMA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 ECase(EM_PCP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 ECase(EM_NCPU)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 ECase(EM_NDR1)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 ECase(EM_STARCORE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 ECase(EM_ME16)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 ECase(EM_ST100)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 ECase(EM_TINYJ)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 ECase(EM_X86_64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 ECase(EM_PDSP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 ECase(EM_PDP10)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 ECase(EM_PDP11)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 ECase(EM_FX66)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 ECase(EM_ST9PLUS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 ECase(EM_ST7)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 ECase(EM_68HC16)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 ECase(EM_68HC11)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 ECase(EM_68HC08)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 ECase(EM_68HC05)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97 ECase(EM_SVX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
98 ECase(EM_ST19)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
99 ECase(EM_VAX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100 ECase(EM_CRIS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 ECase(EM_JAVELIN)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 ECase(EM_FIREPATH)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 ECase(EM_ZSP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
104 ECase(EM_MMIX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
105 ECase(EM_HUANY)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
106 ECase(EM_PRISM)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 ECase(EM_AVR)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 ECase(EM_FR30)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 ECase(EM_D10V)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110 ECase(EM_D30V)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 ECase(EM_V850)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 ECase(EM_M32R)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 ECase(EM_MN10300)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 ECase(EM_MN10200)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 ECase(EM_PJ)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 ECase(EM_OPENRISC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 ECase(EM_ARC_COMPACT)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118 ECase(EM_XTENSA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 ECase(EM_VIDEOCORE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 ECase(EM_TMM_GPP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
121 ECase(EM_NS32K)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 ECase(EM_TPC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123 ECase(EM_SNP1K)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124 ECase(EM_ST200)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
125 ECase(EM_IP2K)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126 ECase(EM_MAX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
127 ECase(EM_CR)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
128 ECase(EM_F2MC16)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
129 ECase(EM_MSP430)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
130 ECase(EM_BLACKFIN)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
131 ECase(EM_SE_C33)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
132 ECase(EM_SEP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
133 ECase(EM_ARCA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
134 ECase(EM_UNICORE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
135 ECase(EM_EXCESS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
136 ECase(EM_DXP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 ECase(EM_ALTERA_NIOS2)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138 ECase(EM_CRX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139 ECase(EM_XGATE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 ECase(EM_C166)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
141 ECase(EM_M16C)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
142 ECase(EM_DSPIC30F)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
143 ECase(EM_CE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
144 ECase(EM_M32C)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
145 ECase(EM_TSK3000)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
146 ECase(EM_RS08)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
147 ECase(EM_SHARC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
148 ECase(EM_ECOG2)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
149 ECase(EM_SCORE7)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
150 ECase(EM_DSP24)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
151 ECase(EM_VIDEOCORE3)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
152 ECase(EM_LATTICEMICO32)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
153 ECase(EM_SE_C17)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
154 ECase(EM_TI_C6000)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
155 ECase(EM_TI_C2000)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
156 ECase(EM_TI_C5500)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
157 ECase(EM_MMDSP_PLUS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
158 ECase(EM_CYPRESS_M8C)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
159 ECase(EM_R32C)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
160 ECase(EM_TRIMEDIA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
161 ECase(EM_HEXAGON)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
162 ECase(EM_8051)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
163 ECase(EM_STXP7X)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
164 ECase(EM_NDS32)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
165 ECase(EM_ECOG1)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
166 ECase(EM_ECOG1X)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
167 ECase(EM_MAXQ30)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
168 ECase(EM_XIMO16)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
169 ECase(EM_MANIK)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
170 ECase(EM_CRAYNV2)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
171 ECase(EM_RX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
172 ECase(EM_METAG)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
173 ECase(EM_MCST_ELBRUS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
174 ECase(EM_ECOG16)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
175 ECase(EM_CR16)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
176 ECase(EM_ETPU)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
177 ECase(EM_SLE9X)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
178 ECase(EM_L10M)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
179 ECase(EM_K10M)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
180 ECase(EM_AARCH64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
181 ECase(EM_AVR32)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
182 ECase(EM_STM8)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
183 ECase(EM_TILE64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
184 ECase(EM_TILEPRO)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
185 ECase(EM_CUDA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
186 ECase(EM_TILEGX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
187 ECase(EM_CLOUDSHIELD)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
188 ECase(EM_COREA_1ST)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
189 ECase(EM_COREA_2ND)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
190 ECase(EM_ARC_COMPACT2)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
191 ECase(EM_OPEN8)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
192 ECase(EM_RL78)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
193 ECase(EM_VIDEOCORE5)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
194 ECase(EM_78KOR)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
195 ECase(EM_56800EX)
|
95
|
196 ECase(EM_AMDGPU)
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
197 #undef ECase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
198 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
199
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
200 void ScalarEnumerationTraits<ELFYAML::ELF_ELFCLASS>::enumeration(
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
201 IO &IO, ELFYAML::ELF_ELFCLASS &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
202 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
203 // Since the semantics of ELFCLASSNONE is "invalid", just don't accept it
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
204 // here.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
205 ECase(ELFCLASS32)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
206 ECase(ELFCLASS64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
207 #undef ECase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
208 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
209
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
210 void ScalarEnumerationTraits<ELFYAML::ELF_ELFDATA>::enumeration(
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
211 IO &IO, ELFYAML::ELF_ELFDATA &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
212 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
213 // Since the semantics of ELFDATANONE is "invalid", just don't accept it
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
214 // here.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
215 ECase(ELFDATA2LSB)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
216 ECase(ELFDATA2MSB)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
217 #undef ECase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
218 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
219
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
220 void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
221 IO &IO, ELFYAML::ELF_ELFOSABI &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
222 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
223 ECase(ELFOSABI_NONE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
224 ECase(ELFOSABI_HPUX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
225 ECase(ELFOSABI_NETBSD)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
226 ECase(ELFOSABI_GNU)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
227 ECase(ELFOSABI_GNU)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
228 ECase(ELFOSABI_HURD)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
229 ECase(ELFOSABI_SOLARIS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
230 ECase(ELFOSABI_AIX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
231 ECase(ELFOSABI_IRIX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
232 ECase(ELFOSABI_FREEBSD)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
233 ECase(ELFOSABI_TRU64)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
234 ECase(ELFOSABI_MODESTO)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
235 ECase(ELFOSABI_OPENBSD)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
236 ECase(ELFOSABI_OPENVMS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
237 ECase(ELFOSABI_NSK)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
238 ECase(ELFOSABI_AROS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
239 ECase(ELFOSABI_FENIXOS)
|
95
|
240 ECase(ELFOSABI_CLOUDABI)
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
241 ECase(ELFOSABI_C6000_ELFABI)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
242 ECase(ELFOSABI_C6000_LINUX)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
243 ECase(ELFOSABI_ARM)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
244 ECase(ELFOSABI_STANDALONE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
245 #undef ECase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
246 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
247
|
77
|
248 void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
|
|
249 ELFYAML::ELF_EF &Value) {
|
|
250 const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
|
|
251 assert(Object && "The IO context is not initialized");
|
|
252 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
|
|
253 #define BCaseMask(X, M) IO.maskedBitSetCase(Value, #X, ELF::X, ELF::M);
|
|
254 switch (Object->Header.Machine) {
|
|
255 case ELF::EM_ARM:
|
|
256 BCase(EF_ARM_SOFT_FLOAT)
|
|
257 BCase(EF_ARM_VFP_FLOAT)
|
|
258 BCaseMask(EF_ARM_EABI_UNKNOWN, EF_ARM_EABIMASK)
|
|
259 BCaseMask(EF_ARM_EABI_VER1, EF_ARM_EABIMASK)
|
|
260 BCaseMask(EF_ARM_EABI_VER2, EF_ARM_EABIMASK)
|
|
261 BCaseMask(EF_ARM_EABI_VER3, EF_ARM_EABIMASK)
|
|
262 BCaseMask(EF_ARM_EABI_VER4, EF_ARM_EABIMASK)
|
|
263 BCaseMask(EF_ARM_EABI_VER5, EF_ARM_EABIMASK)
|
|
264 break;
|
|
265 case ELF::EM_MIPS:
|
|
266 BCase(EF_MIPS_NOREORDER)
|
|
267 BCase(EF_MIPS_PIC)
|
|
268 BCase(EF_MIPS_CPIC)
|
|
269 BCase(EF_MIPS_ABI2)
|
|
270 BCase(EF_MIPS_32BITMODE)
|
95
|
271 BCase(EF_MIPS_FP64)
|
83
|
272 BCase(EF_MIPS_NAN2008)
|
77
|
273 BCase(EF_MIPS_MICROMIPS)
|
|
274 BCase(EF_MIPS_ARCH_ASE_M16)
|
95
|
275 BCase(EF_MIPS_ARCH_ASE_MDMX)
|
|
276 BCaseMask(EF_MIPS_ABI_O32, EF_MIPS_ABI)
|
|
277 BCaseMask(EF_MIPS_ABI_O64, EF_MIPS_ABI)
|
|
278 BCaseMask(EF_MIPS_ABI_EABI32, EF_MIPS_ABI)
|
|
279 BCaseMask(EF_MIPS_ABI_EABI64, EF_MIPS_ABI)
|
|
280 BCaseMask(EF_MIPS_MACH_3900, EF_MIPS_MACH)
|
|
281 BCaseMask(EF_MIPS_MACH_4010, EF_MIPS_MACH)
|
|
282 BCaseMask(EF_MIPS_MACH_4100, EF_MIPS_MACH)
|
|
283 BCaseMask(EF_MIPS_MACH_4650, EF_MIPS_MACH)
|
|
284 BCaseMask(EF_MIPS_MACH_4120, EF_MIPS_MACH)
|
|
285 BCaseMask(EF_MIPS_MACH_4111, EF_MIPS_MACH)
|
|
286 BCaseMask(EF_MIPS_MACH_SB1, EF_MIPS_MACH)
|
|
287 BCaseMask(EF_MIPS_MACH_OCTEON, EF_MIPS_MACH)
|
|
288 BCaseMask(EF_MIPS_MACH_XLR, EF_MIPS_MACH)
|
|
289 BCaseMask(EF_MIPS_MACH_OCTEON2, EF_MIPS_MACH)
|
|
290 BCaseMask(EF_MIPS_MACH_OCTEON3, EF_MIPS_MACH)
|
|
291 BCaseMask(EF_MIPS_MACH_5400, EF_MIPS_MACH)
|
|
292 BCaseMask(EF_MIPS_MACH_5900, EF_MIPS_MACH)
|
|
293 BCaseMask(EF_MIPS_MACH_5500, EF_MIPS_MACH)
|
|
294 BCaseMask(EF_MIPS_MACH_9000, EF_MIPS_MACH)
|
|
295 BCaseMask(EF_MIPS_MACH_LS2E, EF_MIPS_MACH)
|
|
296 BCaseMask(EF_MIPS_MACH_LS2F, EF_MIPS_MACH)
|
|
297 BCaseMask(EF_MIPS_MACH_LS3A, EF_MIPS_MACH)
|
77
|
298 BCaseMask(EF_MIPS_ARCH_1, EF_MIPS_ARCH)
|
|
299 BCaseMask(EF_MIPS_ARCH_2, EF_MIPS_ARCH)
|
|
300 BCaseMask(EF_MIPS_ARCH_3, EF_MIPS_ARCH)
|
|
301 BCaseMask(EF_MIPS_ARCH_4, EF_MIPS_ARCH)
|
|
302 BCaseMask(EF_MIPS_ARCH_5, EF_MIPS_ARCH)
|
|
303 BCaseMask(EF_MIPS_ARCH_32, EF_MIPS_ARCH)
|
|
304 BCaseMask(EF_MIPS_ARCH_64, EF_MIPS_ARCH)
|
|
305 BCaseMask(EF_MIPS_ARCH_32R2, EF_MIPS_ARCH)
|
|
306 BCaseMask(EF_MIPS_ARCH_64R2, EF_MIPS_ARCH)
|
|
307 BCaseMask(EF_MIPS_ARCH_32R6, EF_MIPS_ARCH)
|
|
308 BCaseMask(EF_MIPS_ARCH_64R6, EF_MIPS_ARCH)
|
|
309 break;
|
|
310 case ELF::EM_HEXAGON:
|
|
311 BCase(EF_HEXAGON_MACH_V2)
|
|
312 BCase(EF_HEXAGON_MACH_V3)
|
|
313 BCase(EF_HEXAGON_MACH_V4)
|
|
314 BCase(EF_HEXAGON_MACH_V5)
|
|
315 BCase(EF_HEXAGON_ISA_V2)
|
|
316 BCase(EF_HEXAGON_ISA_V3)
|
|
317 BCase(EF_HEXAGON_ISA_V4)
|
|
318 BCase(EF_HEXAGON_ISA_V5)
|
|
319 break;
|
|
320 default:
|
|
321 llvm_unreachable("Unsupported architecture");
|
|
322 }
|
|
323 #undef BCase
|
|
324 #undef BCaseMask
|
|
325 }
|
|
326
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
327 void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration(
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
328 IO &IO, ELFYAML::ELF_SHT &Value) {
|
77
|
329 const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
|
|
330 assert(Object && "The IO context is not initialized");
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
331 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
332 ECase(SHT_NULL)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
333 ECase(SHT_PROGBITS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
334 // No SHT_SYMTAB. Use the top-level `Symbols` key instead.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
335 // FIXME: Issue a diagnostic with this information.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
336 ECase(SHT_STRTAB)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
337 ECase(SHT_RELA)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
338 ECase(SHT_HASH)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
339 ECase(SHT_DYNAMIC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
340 ECase(SHT_NOTE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
341 ECase(SHT_NOBITS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
342 ECase(SHT_REL)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
343 ECase(SHT_SHLIB)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
344 ECase(SHT_DYNSYM)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
345 ECase(SHT_INIT_ARRAY)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
346 ECase(SHT_FINI_ARRAY)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
347 ECase(SHT_PREINIT_ARRAY)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
348 ECase(SHT_GROUP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
349 ECase(SHT_SYMTAB_SHNDX)
|
77
|
350 ECase(SHT_LOOS)
|
|
351 ECase(SHT_GNU_ATTRIBUTES)
|
|
352 ECase(SHT_GNU_HASH)
|
|
353 ECase(SHT_GNU_verdef)
|
|
354 ECase(SHT_GNU_verneed)
|
|
355 ECase(SHT_GNU_versym)
|
|
356 ECase(SHT_HIOS)
|
|
357 ECase(SHT_LOPROC)
|
|
358 switch (Object->Header.Machine) {
|
|
359 case ELF::EM_ARM:
|
|
360 ECase(SHT_ARM_EXIDX)
|
|
361 ECase(SHT_ARM_PREEMPTMAP)
|
|
362 ECase(SHT_ARM_ATTRIBUTES)
|
|
363 ECase(SHT_ARM_DEBUGOVERLAY)
|
|
364 ECase(SHT_ARM_OVERLAYSECTION)
|
|
365 break;
|
|
366 case ELF::EM_HEXAGON:
|
|
367 ECase(SHT_HEX_ORDERED)
|
|
368 break;
|
|
369 case ELF::EM_X86_64:
|
|
370 ECase(SHT_X86_64_UNWIND)
|
|
371 break;
|
|
372 case ELF::EM_MIPS:
|
|
373 ECase(SHT_MIPS_REGINFO)
|
|
374 ECase(SHT_MIPS_OPTIONS)
|
|
375 ECase(SHT_MIPS_ABIFLAGS)
|
|
376 break;
|
|
377 default:
|
|
378 // Nothing to do.
|
|
379 break;
|
|
380 }
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
381 #undef ECase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
382 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
383
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
384 void ScalarBitSetTraits<ELFYAML::ELF_SHF>::bitset(IO &IO,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
385 ELFYAML::ELF_SHF &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
386 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
387 BCase(SHF_WRITE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
388 BCase(SHF_ALLOC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
389 BCase(SHF_EXCLUDE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
390 BCase(SHF_EXECINSTR)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
391 BCase(SHF_MERGE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
392 BCase(SHF_STRINGS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
393 BCase(SHF_INFO_LINK)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
394 BCase(SHF_LINK_ORDER)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
395 BCase(SHF_OS_NONCONFORMING)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
396 BCase(SHF_GROUP)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
397 BCase(SHF_TLS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
398 #undef BCase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
399 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
400
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
401 void ScalarEnumerationTraits<ELFYAML::ELF_STT>::enumeration(
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
402 IO &IO, ELFYAML::ELF_STT &Value) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
403 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
404 ECase(STT_NOTYPE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
405 ECase(STT_OBJECT)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
406 ECase(STT_FUNC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
407 ECase(STT_SECTION)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
408 ECase(STT_FILE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
409 ECase(STT_COMMON)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
410 ECase(STT_TLS)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
411 ECase(STT_GNU_IFUNC)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
412 #undef ECase
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
413 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
414
|
77
|
415 void ScalarEnumerationTraits<ELFYAML::ELF_STV>::enumeration(
|
|
416 IO &IO, ELFYAML::ELF_STV &Value) {
|
|
417 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
|
418 ECase(STV_DEFAULT)
|
|
419 ECase(STV_INTERNAL)
|
|
420 ECase(STV_HIDDEN)
|
|
421 ECase(STV_PROTECTED)
|
|
422 #undef ECase
|
|
423 }
|
|
424
|
83
|
425 void ScalarBitSetTraits<ELFYAML::ELF_STO>::bitset(IO &IO,
|
|
426 ELFYAML::ELF_STO &Value) {
|
|
427 const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
|
|
428 assert(Object && "The IO context is not initialized");
|
|
429 #define BCase(X) IO.bitSetCase(Value, #X, ELF::X);
|
|
430 switch (Object->Header.Machine) {
|
|
431 case ELF::EM_MIPS:
|
|
432 BCase(STO_MIPS_OPTIONAL)
|
|
433 BCase(STO_MIPS_PLT)
|
|
434 BCase(STO_MIPS_PIC)
|
|
435 BCase(STO_MIPS_MICROMIPS)
|
|
436 break;
|
|
437 default:
|
|
438 break; // Nothing to do
|
|
439 }
|
|
440 #undef BCase
|
|
441 #undef BCaseMask
|
|
442 }
|
|
443
|
|
444 void ScalarEnumerationTraits<ELFYAML::ELF_RSS>::enumeration(
|
|
445 IO &IO, ELFYAML::ELF_RSS &Value) {
|
|
446 #define ECase(X) IO.enumCase(Value, #X, ELF::X);
|
|
447 ECase(RSS_UNDEF)
|
|
448 ECase(RSS_GP)
|
|
449 ECase(RSS_GP0)
|
|
450 ECase(RSS_LOC)
|
|
451 #undef ECase
|
|
452 }
|
|
453
|
77
|
454 void ScalarEnumerationTraits<ELFYAML::ELF_REL>::enumeration(
|
|
455 IO &IO, ELFYAML::ELF_REL &Value) {
|
|
456 const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
|
|
457 assert(Object && "The IO context is not initialized");
|
83
|
458 #define ELF_RELOC(X, Y) IO.enumCase(Value, #X, ELF::X);
|
77
|
459 switch (Object->Header.Machine) {
|
|
460 case ELF::EM_X86_64:
|
83
|
461 #include "llvm/Support/ELFRelocs/x86_64.def"
|
77
|
462 break;
|
|
463 case ELF::EM_MIPS:
|
83
|
464 #include "llvm/Support/ELFRelocs/Mips.def"
|
77
|
465 break;
|
|
466 case ELF::EM_HEXAGON:
|
83
|
467 #include "llvm/Support/ELFRelocs/Hexagon.def"
|
77
|
468 break;
|
|
469 case ELF::EM_386:
|
83
|
470 #include "llvm/Support/ELFRelocs/i386.def"
|
|
471 break;
|
|
472 case ELF::EM_AARCH64:
|
|
473 #include "llvm/Support/ELFRelocs/AArch64.def"
|
|
474 break;
|
|
475 case ELF::EM_ARM:
|
|
476 #include "llvm/Support/ELFRelocs/ARM.def"
|
77
|
477 break;
|
|
478 default:
|
|
479 llvm_unreachable("Unsupported architecture");
|
|
480 }
|
83
|
481 #undef ELF_RELOC
|
77
|
482 }
|
|
483
|
95
|
484 void ScalarEnumerationTraits<ELFYAML::MIPS_AFL_REG>::enumeration(
|
|
485 IO &IO, ELFYAML::MIPS_AFL_REG &Value) {
|
|
486 #define ECase(X) IO.enumCase(Value, #X, Mips::AFL_##X);
|
|
487 ECase(REG_NONE)
|
|
488 ECase(REG_32)
|
|
489 ECase(REG_64)
|
|
490 ECase(REG_128)
|
|
491 #undef ECase
|
|
492 }
|
|
493
|
|
494 void ScalarEnumerationTraits<ELFYAML::MIPS_ABI_FP>::enumeration(
|
|
495 IO &IO, ELFYAML::MIPS_ABI_FP &Value) {
|
|
496 #define ECase(X) IO.enumCase(Value, #X, Mips::Val_GNU_MIPS_ABI_##X);
|
|
497 ECase(FP_ANY)
|
|
498 ECase(FP_DOUBLE)
|
|
499 ECase(FP_SINGLE)
|
|
500 ECase(FP_SOFT)
|
|
501 ECase(FP_OLD_64)
|
|
502 ECase(FP_XX)
|
|
503 ECase(FP_64)
|
|
504 ECase(FP_64A)
|
|
505 #undef ECase
|
|
506 }
|
|
507
|
|
508 void ScalarEnumerationTraits<ELFYAML::MIPS_AFL_EXT>::enumeration(
|
|
509 IO &IO, ELFYAML::MIPS_AFL_EXT &Value) {
|
|
510 #define ECase(X) IO.enumCase(Value, #X, Mips::AFL_##X);
|
|
511 ECase(EXT_NONE)
|
|
512 ECase(EXT_XLR)
|
|
513 ECase(EXT_OCTEON2)
|
|
514 ECase(EXT_OCTEONP)
|
|
515 ECase(EXT_LOONGSON_3A)
|
|
516 ECase(EXT_OCTEON)
|
|
517 ECase(EXT_5900)
|
|
518 ECase(EXT_4650)
|
|
519 ECase(EXT_4010)
|
|
520 ECase(EXT_4100)
|
|
521 ECase(EXT_3900)
|
|
522 ECase(EXT_10000)
|
|
523 ECase(EXT_SB1)
|
|
524 ECase(EXT_4111)
|
|
525 ECase(EXT_4120)
|
|
526 ECase(EXT_5400)
|
|
527 ECase(EXT_5500)
|
|
528 ECase(EXT_LOONGSON_2E)
|
|
529 ECase(EXT_LOONGSON_2F)
|
|
530 ECase(EXT_OCTEON3)
|
|
531 #undef ECase
|
|
532 }
|
|
533
|
|
534 void ScalarEnumerationTraits<ELFYAML::MIPS_ISA>::enumeration(
|
|
535 IO &IO, ELFYAML::MIPS_ISA &Value) {
|
|
536 IO.enumCase(Value, "MIPS1", 1);
|
|
537 IO.enumCase(Value, "MIPS2", 2);
|
|
538 IO.enumCase(Value, "MIPS3", 3);
|
|
539 IO.enumCase(Value, "MIPS4", 4);
|
|
540 IO.enumCase(Value, "MIPS5", 5);
|
|
541 IO.enumCase(Value, "MIPS32", 32);
|
|
542 IO.enumCase(Value, "MIPS64", 64);
|
|
543 }
|
|
544
|
|
545 void ScalarBitSetTraits<ELFYAML::MIPS_AFL_ASE>::bitset(
|
|
546 IO &IO, ELFYAML::MIPS_AFL_ASE &Value) {
|
|
547 #define BCase(X) IO.bitSetCase(Value, #X, Mips::AFL_ASE_##X);
|
|
548 BCase(DSP)
|
|
549 BCase(DSPR2)
|
|
550 BCase(EVA)
|
|
551 BCase(MCU)
|
|
552 BCase(MDMX)
|
|
553 BCase(MIPS3D)
|
|
554 BCase(MT)
|
|
555 BCase(SMARTMIPS)
|
|
556 BCase(VIRT)
|
|
557 BCase(MSA)
|
|
558 BCase(MIPS16)
|
|
559 BCase(MICROMIPS)
|
|
560 BCase(XPA)
|
|
561 #undef BCase
|
|
562 }
|
|
563
|
|
564 void ScalarBitSetTraits<ELFYAML::MIPS_AFL_FLAGS1>::bitset(
|
|
565 IO &IO, ELFYAML::MIPS_AFL_FLAGS1 &Value) {
|
|
566 #define BCase(X) IO.bitSetCase(Value, #X, Mips::AFL_FLAGS1_##X);
|
|
567 BCase(ODDSPREG)
|
|
568 #undef BCase
|
|
569 }
|
|
570
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
571 void MappingTraits<ELFYAML::FileHeader>::mapping(IO &IO,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
572 ELFYAML::FileHeader &FileHdr) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
573 IO.mapRequired("Class", FileHdr.Class);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
574 IO.mapRequired("Data", FileHdr.Data);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
575 IO.mapOptional("OSABI", FileHdr.OSABI, ELFYAML::ELF_ELFOSABI(0));
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
576 IO.mapRequired("Type", FileHdr.Type);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
577 IO.mapRequired("Machine", FileHdr.Machine);
|
77
|
578 IO.mapOptional("Flags", FileHdr.Flags, ELFYAML::ELF_EF(0));
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
579 IO.mapOptional("Entry", FileHdr.Entry, Hex64(0));
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
580 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
581
|
83
|
582 namespace {
|
|
583 struct NormalizedOther {
|
|
584 NormalizedOther(IO &)
|
|
585 : Visibility(ELFYAML::ELF_STV(0)), Other(ELFYAML::ELF_STO(0)) {}
|
|
586 NormalizedOther(IO &, uint8_t Original)
|
|
587 : Visibility(Original & 0x3), Other(Original & ~0x3) {}
|
|
588
|
|
589 uint8_t denormalize(IO &) { return Visibility | Other; }
|
|
590
|
|
591 ELFYAML::ELF_STV Visibility;
|
|
592 ELFYAML::ELF_STO Other;
|
|
593 };
|
|
594 }
|
|
595
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
596 void MappingTraits<ELFYAML::Symbol>::mapping(IO &IO, ELFYAML::Symbol &Symbol) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
597 IO.mapOptional("Name", Symbol.Name, StringRef());
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
598 IO.mapOptional("Type", Symbol.Type, ELFYAML::ELF_STT(0));
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
599 IO.mapOptional("Section", Symbol.Section, StringRef());
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
600 IO.mapOptional("Value", Symbol.Value, Hex64(0));
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
601 IO.mapOptional("Size", Symbol.Size, Hex64(0));
|
83
|
602
|
|
603 MappingNormalization<NormalizedOther, uint8_t> Keys(IO, Symbol.Other);
|
|
604 IO.mapOptional("Visibility", Keys->Visibility, ELFYAML::ELF_STV(0));
|
|
605 IO.mapOptional("Other", Keys->Other, ELFYAML::ELF_STO(0));
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
606 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
607
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
608 void MappingTraits<ELFYAML::LocalGlobalWeakSymbols>::mapping(
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
609 IO &IO, ELFYAML::LocalGlobalWeakSymbols &Symbols) {
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
610 IO.mapOptional("Local", Symbols.Local);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
611 IO.mapOptional("Global", Symbols.Global);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
612 IO.mapOptional("Weak", Symbols.Weak);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
613 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
614
|
77
|
615 static void commonSectionMapping(IO &IO, ELFYAML::Section &Section) {
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
616 IO.mapOptional("Name", Section.Name, StringRef());
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
617 IO.mapRequired("Type", Section.Type);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
618 IO.mapOptional("Flags", Section.Flags, ELFYAML::ELF_SHF(0));
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
619 IO.mapOptional("Address", Section.Address, Hex64(0));
|
77
|
620 IO.mapOptional("Link", Section.Link, StringRef());
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
621 IO.mapOptional("AddressAlign", Section.AddressAlign, Hex64(0));
|
95
|
622 IO.mapOptional("Info", Section.Info, StringRef());
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
623 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
624
|
77
|
625 static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) {
|
|
626 commonSectionMapping(IO, Section);
|
|
627 IO.mapOptional("Content", Section.Content);
|
|
628 IO.mapOptional("Size", Section.Size, Hex64(Section.Content.binary_size()));
|
|
629 }
|
|
630
|
95
|
631 static void sectionMapping(IO &IO, ELFYAML::NoBitsSection &Section) {
|
|
632 commonSectionMapping(IO, Section);
|
|
633 IO.mapOptional("Size", Section.Size, Hex64(0));
|
|
634 }
|
|
635
|
77
|
636 static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
|
|
637 commonSectionMapping(IO, Section);
|
|
638 IO.mapOptional("Relocations", Section.Relocations);
|
|
639 }
|
|
640
|
95
|
641 static void groupSectionMapping(IO &IO, ELFYAML::Group &group) {
|
|
642 commonSectionMapping(IO, group);
|
|
643 IO.mapRequired("Members", group.Members);
|
|
644 }
|
|
645
|
|
646 void MappingTraits<ELFYAML::SectionOrType>::mapping(
|
|
647 IO &IO, ELFYAML::SectionOrType §ionOrType) {
|
|
648 IO.mapRequired("SectionOrType", sectionOrType.sectionNameOrType);
|
|
649 }
|
|
650
|
|
651 static void sectionMapping(IO &IO, ELFYAML::MipsABIFlags &Section) {
|
|
652 commonSectionMapping(IO, Section);
|
|
653 IO.mapOptional("Version", Section.Version, Hex16(0));
|
|
654 IO.mapRequired("ISA", Section.ISALevel);
|
|
655 IO.mapOptional("ISARevision", Section.ISARevision, Hex8(0));
|
|
656 IO.mapOptional("ISAExtension", Section.ISAExtension,
|
|
657 ELFYAML::MIPS_AFL_EXT(Mips::AFL_EXT_NONE));
|
|
658 IO.mapOptional("ASEs", Section.ASEs, ELFYAML::MIPS_AFL_ASE(0));
|
|
659 IO.mapOptional("FpABI", Section.FpABI,
|
|
660 ELFYAML::MIPS_ABI_FP(Mips::Val_GNU_MIPS_ABI_FP_ANY));
|
|
661 IO.mapOptional("GPRSize", Section.GPRSize,
|
|
662 ELFYAML::MIPS_AFL_REG(Mips::AFL_REG_NONE));
|
|
663 IO.mapOptional("CPR1Size", Section.CPR1Size,
|
|
664 ELFYAML::MIPS_AFL_REG(Mips::AFL_REG_NONE));
|
|
665 IO.mapOptional("CPR2Size", Section.CPR2Size,
|
|
666 ELFYAML::MIPS_AFL_REG(Mips::AFL_REG_NONE));
|
|
667 IO.mapOptional("Flags1", Section.Flags1, ELFYAML::MIPS_AFL_FLAGS1(0));
|
|
668 IO.mapOptional("Flags2", Section.Flags2, Hex32(0));
|
|
669 }
|
|
670
|
77
|
671 void MappingTraits<std::unique_ptr<ELFYAML::Section>>::mapping(
|
|
672 IO &IO, std::unique_ptr<ELFYAML::Section> &Section) {
|
|
673 ELFYAML::ELF_SHT sectionType;
|
|
674 if (IO.outputting())
|
|
675 sectionType = Section->Type;
|
|
676 else
|
|
677 IO.mapRequired("Type", sectionType);
|
|
678
|
|
679 switch (sectionType) {
|
|
680 case ELF::SHT_REL:
|
|
681 case ELF::SHT_RELA:
|
|
682 if (!IO.outputting())
|
|
683 Section.reset(new ELFYAML::RelocationSection());
|
|
684 sectionMapping(IO, *cast<ELFYAML::RelocationSection>(Section.get()));
|
|
685 break;
|
95
|
686 case ELF::SHT_GROUP:
|
|
687 if (!IO.outputting())
|
|
688 Section.reset(new ELFYAML::Group());
|
|
689 groupSectionMapping(IO, *cast<ELFYAML::Group>(Section.get()));
|
|
690 break;
|
|
691 case ELF::SHT_NOBITS:
|
|
692 if (!IO.outputting())
|
|
693 Section.reset(new ELFYAML::NoBitsSection());
|
|
694 sectionMapping(IO, *cast<ELFYAML::NoBitsSection>(Section.get()));
|
|
695 break;
|
|
696 case ELF::SHT_MIPS_ABIFLAGS:
|
|
697 if (!IO.outputting())
|
|
698 Section.reset(new ELFYAML::MipsABIFlags());
|
|
699 sectionMapping(IO, *cast<ELFYAML::MipsABIFlags>(Section.get()));
|
|
700 break;
|
77
|
701 default:
|
|
702 if (!IO.outputting())
|
|
703 Section.reset(new ELFYAML::RawContentSection());
|
|
704 sectionMapping(IO, *cast<ELFYAML::RawContentSection>(Section.get()));
|
|
705 }
|
|
706 }
|
|
707
|
|
708 StringRef MappingTraits<std::unique_ptr<ELFYAML::Section>>::validate(
|
|
709 IO &io, std::unique_ptr<ELFYAML::Section> &Section) {
|
|
710 const auto *RawSection = dyn_cast<ELFYAML::RawContentSection>(Section.get());
|
|
711 if (!RawSection || RawSection->Size >= RawSection->Content.binary_size())
|
|
712 return StringRef();
|
|
713 return "Section size must be greater or equal to the content size";
|
|
714 }
|
|
715
|
83
|
716 namespace {
|
|
717 struct NormalizedMips64RelType {
|
|
718 NormalizedMips64RelType(IO &)
|
|
719 : Type(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
|
|
720 Type2(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
|
|
721 Type3(ELFYAML::ELF_REL(ELF::R_MIPS_NONE)),
|
|
722 SpecSym(ELFYAML::ELF_REL(ELF::RSS_UNDEF)) {}
|
|
723 NormalizedMips64RelType(IO &, ELFYAML::ELF_REL Original)
|
|
724 : Type(Original & 0xFF), Type2(Original >> 8 & 0xFF),
|
|
725 Type3(Original >> 16 & 0xFF), SpecSym(Original >> 24 & 0xFF) {}
|
|
726
|
|
727 ELFYAML::ELF_REL denormalize(IO &) {
|
|
728 ELFYAML::ELF_REL Res = Type | Type2 << 8 | Type3 << 16 | SpecSym << 24;
|
|
729 return Res;
|
|
730 }
|
|
731
|
|
732 ELFYAML::ELF_REL Type;
|
|
733 ELFYAML::ELF_REL Type2;
|
|
734 ELFYAML::ELF_REL Type3;
|
|
735 ELFYAML::ELF_RSS SpecSym;
|
|
736 };
|
|
737 }
|
|
738
|
77
|
739 void MappingTraits<ELFYAML::Relocation>::mapping(IO &IO,
|
|
740 ELFYAML::Relocation &Rel) {
|
83
|
741 const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
|
|
742 assert(Object && "The IO context is not initialized");
|
|
743
|
77
|
744 IO.mapRequired("Offset", Rel.Offset);
|
|
745 IO.mapRequired("Symbol", Rel.Symbol);
|
83
|
746
|
|
747 if (Object->Header.Machine == ELFYAML::ELF_EM(ELF::EM_MIPS) &&
|
|
748 Object->Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64)) {
|
|
749 MappingNormalization<NormalizedMips64RelType, ELFYAML::ELF_REL> Key(
|
|
750 IO, Rel.Type);
|
|
751 IO.mapRequired("Type", Key->Type);
|
|
752 IO.mapOptional("Type2", Key->Type2, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
|
|
753 IO.mapOptional("Type3", Key->Type3, ELFYAML::ELF_REL(ELF::R_MIPS_NONE));
|
|
754 IO.mapOptional("SpecSym", Key->SpecSym, ELFYAML::ELF_RSS(ELF::RSS_UNDEF));
|
|
755 } else
|
|
756 IO.mapRequired("Type", Rel.Type);
|
|
757
|
|
758 IO.mapOptional("Addend", Rel.Addend, (int64_t)0);
|
77
|
759 }
|
|
760
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
761 void MappingTraits<ELFYAML::Object>::mapping(IO &IO, ELFYAML::Object &Object) {
|
77
|
762 assert(!IO.getContext() && "The IO context is initialized already");
|
|
763 IO.setContext(&Object);
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
764 IO.mapRequired("FileHeader", Object.Header);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
765 IO.mapOptional("Sections", Object.Sections);
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
766 IO.mapOptional("Symbols", Object.Symbols);
|
77
|
767 IO.setContext(nullptr);
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
768 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
769
|
95
|
770 LLVM_YAML_STRONG_TYPEDEF(uint8_t, MIPS_AFL_REG)
|
|
771 LLVM_YAML_STRONG_TYPEDEF(uint8_t, MIPS_ABI_FP)
|
|
772 LLVM_YAML_STRONG_TYPEDEF(uint32_t, MIPS_AFL_EXT)
|
|
773 LLVM_YAML_STRONG_TYPEDEF(uint32_t, MIPS_AFL_ASE)
|
|
774 LLVM_YAML_STRONG_TYPEDEF(uint32_t, MIPS_AFL_FLAGS1)
|
|
775
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
776 } // end namespace yaml
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
777 } // end namespace llvm
|