19 #define DEBUG_TYPE "hexagon-elf-writer" 22 using namespace Hexagon;
31 HexagonELFObjectWriter(uint8_t OSABI,
StringRef C);
38 HexagonELFObjectWriter::HexagonELFObjectWriter(uint8_t OSABI,
StringRef C)
48 switch ((
unsigned)Fixup.
getKind()) {
54 case MCSymbolRefExpr::VariantKind::VK_DTPREL:
55 return ELF::R_HEX_DTPREL_32;
56 case MCSymbolRefExpr::VariantKind::VK_GOT:
57 return ELF::R_HEX_GOT_32;
58 case MCSymbolRefExpr::VariantKind::VK_GOTREL:
59 return ELF::R_HEX_GOTREL_32;
60 case MCSymbolRefExpr::VariantKind::VK_Hexagon_GD_GOT:
61 return ELF::R_HEX_GD_GOT_32;
62 case MCSymbolRefExpr::VariantKind::VK_Hexagon_IE:
63 return ELF::R_HEX_IE_32;
64 case MCSymbolRefExpr::VariantKind::VK_Hexagon_IE_GOT:
65 return ELF::R_HEX_IE_GOT_32;
66 case MCSymbolRefExpr::VariantKind::VK_Hexagon_LD_GOT:
67 return ELF::R_HEX_LD_GOT_32;
68 case MCSymbolRefExpr::VariantKind::VK_Hexagon_PCREL:
69 return ELF::R_HEX_32_PCREL;
70 case MCSymbolRefExpr::VariantKind::VK_TPREL:
71 return ELF::R_HEX_TPREL_32;
72 case MCSymbolRefExpr::VariantKind::VK_None:
73 return IsPCRel ? ELF::R_HEX_32_PCREL : ELF::R_HEX_32;
78 return ELF::R_HEX_32_PCREL;
81 case MCSymbolRefExpr::VariantKind::VK_DTPREL:
82 return ELF::R_HEX_DTPREL_16;
83 case MCSymbolRefExpr::VariantKind::VK_GOT:
84 return ELF::R_HEX_GOT_16;
85 case MCSymbolRefExpr::VariantKind::VK_Hexagon_GD_GOT:
86 return ELF::R_HEX_GD_GOT_16;
87 case MCSymbolRefExpr::VariantKind::VK_Hexagon_IE_GOT:
88 return ELF::R_HEX_IE_GOT_16;
89 case MCSymbolRefExpr::VariantKind::VK_Hexagon_LD_GOT:
90 return ELF::R_HEX_LD_GOT_16;
91 case MCSymbolRefExpr::VariantKind::VK_TPREL:
92 return ELF::R_HEX_TPREL_16;
93 case MCSymbolRefExpr::VariantKind::VK_None:
101 return ELF::R_HEX_B22_PCREL;
103 return ELF::R_HEX_B15_PCREL;
105 return ELF::R_HEX_B7_PCREL;
107 return ELF::R_HEX_LO16;
109 return ELF::R_HEX_HI16;
111 return ELF::R_HEX_32;
113 return ELF::R_HEX_16;
117 return ELF::R_HEX_GPREL16_0;
119 return ELF::R_HEX_GPREL16_1;
121 return ELF::R_HEX_GPREL16_2;
123 return ELF::R_HEX_GPREL16_3;
125 return ELF::R_HEX_HL16;
127 return ELF::R_HEX_B13_PCREL;
129 return ELF::R_HEX_B9_PCREL;
131 return ELF::R_HEX_B32_PCREL_X;
133 return ELF::R_HEX_32_6_X;
135 return ELF::R_HEX_B22_PCREL_X;
137 return ELF::R_HEX_B15_PCREL_X;
139 return ELF::R_HEX_B13_PCREL_X;
141 return ELF::R_HEX_B9_PCREL_X;
143 return ELF::R_HEX_B7_PCREL_X;
145 return ELF::R_HEX_16_X;
147 return ELF::R_HEX_12_X;
149 return ELF::R_HEX_11_X;
151 return ELF::R_HEX_10_X;
153 return ELF::R_HEX_9_X;
155 return ELF::R_HEX_8_X;
157 return ELF::R_HEX_7_X;
159 return ELF::R_HEX_6_X;
161 return ELF::R_HEX_32_PCREL;
163 return ELF::R_HEX_COPY;
165 return ELF::R_HEX_GLOB_DAT;
167 return ELF::R_HEX_JMP_SLOT;
169 return ELF::R_HEX_RELATIVE;
171 return ELF::R_HEX_PLT_B22_PCREL;
173 return ELF::R_HEX_GOTREL_LO16;
175 return ELF::R_HEX_GOTREL_HI16;
177 return ELF::R_HEX_GOTREL_32;
179 return ELF::R_HEX_GOT_LO16;
181 return ELF::R_HEX_GOT_HI16;
183 return ELF::R_HEX_GOT_32;
185 return ELF::R_HEX_GOT_16;
187 return ELF::R_HEX_DTPMOD_32;
189 return ELF::R_HEX_DTPREL_LO16;
191 return ELF::R_HEX_DTPREL_HI16;
193 return ELF::R_HEX_DTPREL_32;
195 return ELF::R_HEX_DTPREL_16;
197 return ELF::R_HEX_GD_PLT_B22_PCREL;
199 return ELF::R_HEX_LD_PLT_B22_PCREL;
201 return ELF::R_HEX_GD_GOT_LO16;
203 return ELF::R_HEX_GD_GOT_HI16;
205 return ELF::R_HEX_GD_GOT_32;
207 return ELF::R_HEX_GD_GOT_16;
209 return ELF::R_HEX_LD_GOT_LO16;
211 return ELF::R_HEX_LD_GOT_HI16;
213 return ELF::R_HEX_LD_GOT_32;
215 return ELF::R_HEX_LD_GOT_16;
217 return ELF::R_HEX_IE_LO16;
219 return ELF::R_HEX_IE_HI16;
221 return ELF::R_HEX_IE_32;
223 return ELF::R_HEX_IE_GOT_LO16;
225 return ELF::R_HEX_IE_GOT_HI16;
227 return ELF::R_HEX_IE_GOT_32;
229 return ELF::R_HEX_IE_GOT_16;
231 return ELF::R_HEX_TPREL_LO16;
233 return ELF::R_HEX_TPREL_HI16;
235 return ELF::R_HEX_TPREL_32;
237 return ELF::R_HEX_TPREL_16;
239 return ELF::R_HEX_6_PCREL_X;
241 return ELF::R_HEX_GOTREL_32_6_X;
243 return ELF::R_HEX_GOTREL_16_X;
245 return ELF::R_HEX_GOTREL_11_X;
247 return ELF::R_HEX_GOT_32_6_X;
249 return ELF::R_HEX_GOT_16_X;
251 return ELF::R_HEX_GOT_11_X;
253 return ELF::R_HEX_DTPREL_32_6_X;
255 return ELF::R_HEX_DTPREL_16_X;
257 return ELF::R_HEX_DTPREL_11_X;
259 return ELF::R_HEX_GD_GOT_32_6_X;
261 return ELF::R_HEX_GD_GOT_16_X;
263 return ELF::R_HEX_GD_GOT_11_X;
265 return ELF::R_HEX_LD_GOT_32_6_X;
267 return ELF::R_HEX_LD_GOT_16_X;
269 return ELF::R_HEX_LD_GOT_11_X;
271 return ELF::R_HEX_IE_32_6_X;
273 return ELF::R_HEX_IE_16_X;
275 return ELF::R_HEX_IE_GOT_32_6_X;
277 return ELF::R_HEX_IE_GOT_16_X;
279 return ELF::R_HEX_IE_GOT_11_X;
281 return ELF::R_HEX_TPREL_32_6_X;
283 return ELF::R_HEX_TPREL_16_X;
285 return ELF::R_HEX_TPREL_11_X;
287 return ELF::R_HEX_23_REG;
289 return ELF::R_HEX_27_REG;
291 return ELF::R_HEX_GD_PLT_B22_PCREL_X;
293 return ELF::R_HEX_GD_PLT_B32_PCREL_X;
295 return ELF::R_HEX_LD_PLT_B22_PCREL_X;
297 return ELF::R_HEX_LD_PLT_B32_PCREL_X;
301 std::unique_ptr<MCObjectTargetWriter>
303 return llvm::make_unique<HexagonELFObjectWriter>(OSABI, CPU);
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbolRefExpr::VariantKind getAccessVariant() const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
Context object for machine code objects.
PowerPC TLS Dynamic Call Fixup
A four-byte pc relative fixup.
std::unique_ptr< MCObjectTargetWriter > createHexagonELFObjectWriter(uint8_t OSABI, StringRef CPU)
Target - Wrapper for Target specific information.
StringRef - Represent a constant reference to a string, i.e.
MCFixupKind getKind() const