16#define DEBUG_TYPE "hexagon-elf-writer"
19using namespace Hexagon;
40unsigned HexagonELFObjectWriter::getRelocType(
MCContext &Ctx,
45 switch (
Fixup.getTargetKind()) {
51 case MCSymbolRefExpr::VariantKind::VK_DTPREL:
52 return ELF::R_HEX_DTPREL_32;
53 case MCSymbolRefExpr::VariantKind::VK_GOT:
54 return ELF::R_HEX_GOT_32;
55 case MCSymbolRefExpr::VariantKind::VK_GOTREL:
56 return ELF::R_HEX_GOTREL_32;
57 case MCSymbolRefExpr::VariantKind::VK_Hexagon_GD_GOT:
58 return ELF::R_HEX_GD_GOT_32;
59 case MCSymbolRefExpr::VariantKind::VK_Hexagon_IE:
60 return ELF::R_HEX_IE_32;
61 case MCSymbolRefExpr::VariantKind::VK_Hexagon_IE_GOT:
62 return ELF::R_HEX_IE_GOT_32;
63 case MCSymbolRefExpr::VariantKind::VK_Hexagon_LD_GOT:
64 return ELF::R_HEX_LD_GOT_32;
65 case MCSymbolRefExpr::VariantKind::VK_PCREL:
66 return ELF::R_HEX_32_PCREL;
67 case MCSymbolRefExpr::VariantKind::VK_TPREL:
68 return ELF::R_HEX_TPREL_32;
69 case MCSymbolRefExpr::VariantKind::VK_None:
70 return IsPCRel ? ELF::R_HEX_32_PCREL : ELF::R_HEX_32;
75 return ELF::R_HEX_32_PCREL;
78 case MCSymbolRefExpr::VariantKind::VK_DTPREL:
79 return ELF::R_HEX_DTPREL_16;
80 case MCSymbolRefExpr::VariantKind::VK_GOT:
81 return ELF::R_HEX_GOT_16;
82 case MCSymbolRefExpr::VariantKind::VK_Hexagon_GD_GOT:
83 return ELF::R_HEX_GD_GOT_16;
84 case MCSymbolRefExpr::VariantKind::VK_Hexagon_IE_GOT:
85 return ELF::R_HEX_IE_GOT_16;
86 case MCSymbolRefExpr::VariantKind::VK_Hexagon_LD_GOT:
87 return ELF::R_HEX_LD_GOT_16;
88 case MCSymbolRefExpr::VariantKind::VK_TPREL:
89 return ELF::R_HEX_TPREL_16;
90 case MCSymbolRefExpr::VariantKind::VK_None:
98 return ELF::R_HEX_B22_PCREL;
100 return ELF::R_HEX_B15_PCREL;
102 return ELF::R_HEX_B7_PCREL;
104 return ELF::R_HEX_LO16;
106 return ELF::R_HEX_HI16;
108 return ELF::R_HEX_32;
110 return ELF::R_HEX_16;
114 return ELF::R_HEX_GPREL16_0;
116 return ELF::R_HEX_GPREL16_1;
118 return ELF::R_HEX_GPREL16_2;
120 return ELF::R_HEX_GPREL16_3;
122 return ELF::R_HEX_HL16;
124 return ELF::R_HEX_B13_PCREL;
126 return ELF::R_HEX_B9_PCREL;
128 return ELF::R_HEX_B32_PCREL_X;
130 return ELF::R_HEX_32_6_X;
132 return ELF::R_HEX_B22_PCREL_X;
134 return ELF::R_HEX_B15_PCREL_X;
136 return ELF::R_HEX_B13_PCREL_X;
138 return ELF::R_HEX_B9_PCREL_X;
140 return ELF::R_HEX_B7_PCREL_X;
142 return ELF::R_HEX_16_X;
144 return ELF::R_HEX_12_X;
146 return ELF::R_HEX_11_X;
148 return ELF::R_HEX_10_X;
150 return ELF::R_HEX_9_X;
152 return ELF::R_HEX_8_X;
154 return ELF::R_HEX_7_X;
156 return ELF::R_HEX_6_X;
158 return ELF::R_HEX_32_PCREL;
160 return ELF::R_HEX_COPY;
162 return ELF::R_HEX_GLOB_DAT;
164 return ELF::R_HEX_JMP_SLOT;
166 return ELF::R_HEX_RELATIVE;
168 return ELF::R_HEX_PLT_B22_PCREL;
170 return ELF::R_HEX_GOTREL_LO16;
172 return ELF::R_HEX_GOTREL_HI16;
174 return ELF::R_HEX_GOTREL_32;
176 return ELF::R_HEX_GOT_LO16;
178 return ELF::R_HEX_GOT_HI16;
180 return ELF::R_HEX_GOT_32;
182 return ELF::R_HEX_GOT_16;
184 return ELF::R_HEX_DTPMOD_32;
186 return ELF::R_HEX_DTPREL_LO16;
188 return ELF::R_HEX_DTPREL_HI16;
190 return ELF::R_HEX_DTPREL_32;
192 return ELF::R_HEX_DTPREL_16;
194 return ELF::R_HEX_GD_PLT_B22_PCREL;
196 return ELF::R_HEX_LD_PLT_B22_PCREL;
198 return ELF::R_HEX_GD_GOT_LO16;
200 return ELF::R_HEX_GD_GOT_HI16;
202 return ELF::R_HEX_GD_GOT_32;
204 return ELF::R_HEX_GD_GOT_16;
206 return ELF::R_HEX_LD_GOT_LO16;
208 return ELF::R_HEX_LD_GOT_HI16;
210 return ELF::R_HEX_LD_GOT_32;
212 return ELF::R_HEX_LD_GOT_16;
214 return ELF::R_HEX_IE_LO16;
216 return ELF::R_HEX_IE_HI16;
218 return ELF::R_HEX_IE_32;
220 return ELF::R_HEX_IE_GOT_LO16;
222 return ELF::R_HEX_IE_GOT_HI16;
224 return ELF::R_HEX_IE_GOT_32;
226 return ELF::R_HEX_IE_GOT_16;
228 return ELF::R_HEX_TPREL_LO16;
230 return ELF::R_HEX_TPREL_HI16;
232 return ELF::R_HEX_TPREL_32;
234 return ELF::R_HEX_TPREL_16;
236 return ELF::R_HEX_6_PCREL_X;
238 return ELF::R_HEX_GOTREL_32_6_X;
240 return ELF::R_HEX_GOTREL_16_X;
242 return ELF::R_HEX_GOTREL_11_X;
244 return ELF::R_HEX_GOT_32_6_X;
246 return ELF::R_HEX_GOT_16_X;
248 return ELF::R_HEX_GOT_11_X;
250 return ELF::R_HEX_DTPREL_32_6_X;
252 return ELF::R_HEX_DTPREL_16_X;
254 return ELF::R_HEX_DTPREL_11_X;
256 return ELF::R_HEX_GD_GOT_32_6_X;
258 return ELF::R_HEX_GD_GOT_16_X;
260 return ELF::R_HEX_GD_GOT_11_X;
262 return ELF::R_HEX_LD_GOT_32_6_X;
264 return ELF::R_HEX_LD_GOT_16_X;
266 return ELF::R_HEX_LD_GOT_11_X;
268 return ELF::R_HEX_IE_32_6_X;
270 return ELF::R_HEX_IE_16_X;
272 return ELF::R_HEX_IE_GOT_32_6_X;
274 return ELF::R_HEX_IE_GOT_16_X;
276 return ELF::R_HEX_IE_GOT_11_X;
278 return ELF::R_HEX_TPREL_32_6_X;
280 return ELF::R_HEX_TPREL_16_X;
282 return ELF::R_HEX_TPREL_11_X;
284 return ELF::R_HEX_23_REG;
286 return ELF::R_HEX_27_REG;
288 return ELF::R_HEX_GD_PLT_B22_PCREL_X;
290 return ELF::R_HEX_GD_PLT_B32_PCREL_X;
292 return ELF::R_HEX_LD_PLT_B22_PCREL_X;
294 return ELF::R_HEX_LD_PLT_B32_PCREL_X;
298std::unique_ptr<MCObjectTargetWriter>
300 return std::make_unique<HexagonELFObjectWriter>(OSABI, CPU);
PowerPC TLS Dynamic Call Fixup
Context object for machine code objects.
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const =0
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
This represents an "assembler immediate".
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
@ C
The default llvm calling convention, compatible with C.
@ fixup_Hexagon_LD_PLT_B32_PCREL_X
@ fixup_Hexagon_GPREL16_3
@ fixup_Hexagon_GD_GOT_HI16
@ fixup_Hexagon_IE_GOT_16_X
@ fixup_Hexagon_LD_PLT_B22_PCREL
@ fixup_Hexagon_TPREL_32_6_X
@ fixup_Hexagon_TPREL_16_X
@ fixup_Hexagon_B7_PCREL_X
@ fixup_Hexagon_B13_PCREL
@ fixup_Hexagon_DTPREL_HI16
@ fixup_Hexagon_DTPMOD_32
@ fixup_Hexagon_IE_GOT_LO16
@ fixup_Hexagon_LD_PLT_B22_PCREL_X
@ fixup_Hexagon_GD_GOT_32_6_X
@ fixup_Hexagon_LD_GOT_HI16
@ fixup_Hexagon_B13_PCREL_X
@ fixup_Hexagon_GOTREL_HI16
@ fixup_Hexagon_IE_GOT_32_6_X
@ fixup_Hexagon_GD_GOT_16
@ fixup_Hexagon_PLT_B22_PCREL
@ fixup_Hexagon_B32_PCREL_X
@ fixup_Hexagon_GD_GOT_16_X
@ fixup_Hexagon_GD_GOT_11_X
@ fixup_Hexagon_DTPREL_32_6_X
@ fixup_Hexagon_GD_GOT_LO16
@ fixup_Hexagon_GD_PLT_B32_PCREL_X
@ fixup_Hexagon_DTPREL_16
@ fixup_Hexagon_DTPREL_11_X
@ fixup_Hexagon_GPREL16_2
@ fixup_Hexagon_GPREL16_1
@ fixup_Hexagon_DTPREL_32
@ fixup_Hexagon_GOTREL_32
@ fixup_Hexagon_DTPREL_LO16
@ fixup_Hexagon_LD_GOT_16_X
@ fixup_Hexagon_B15_PCREL
@ fixup_Hexagon_LD_GOT_16
@ fixup_Hexagon_GPREL16_0
@ fixup_Hexagon_6_PCREL_X
@ fixup_Hexagon_GD_GOT_32
@ fixup_Hexagon_GD_PLT_B22_PCREL_X
@ fixup_Hexagon_GD_PLT_B22_PCREL
@ fixup_Hexagon_IE_GOT_32
@ fixup_Hexagon_B22_PCREL
@ fixup_Hexagon_TPREL_LO16
@ fixup_Hexagon_TPREL_HI16
@ fixup_Hexagon_LD_GOT_32_6_X
@ fixup_Hexagon_IE_GOT_16
@ fixup_Hexagon_LD_GOT_LO16
@ fixup_Hexagon_TPREL_11_X
@ fixup_Hexagon_GOTREL_LO16
@ fixup_Hexagon_IE_GOT_HI16
@ fixup_Hexagon_GOT_32_6_X
@ fixup_Hexagon_LD_GOT_11_X
@ fixup_Hexagon_GOTREL_11_X
@ fixup_Hexagon_DTPREL_16_X
@ fixup_Hexagon_B15_PCREL_X
@ fixup_Hexagon_B22_PCREL_X
@ fixup_Hexagon_IE_32_6_X
@ fixup_Hexagon_IE_GOT_11_X
@ fixup_Hexagon_LD_GOT_32
@ fixup_Hexagon_GOTREL_32_6_X
@ fixup_Hexagon_B9_PCREL_X
@ fixup_Hexagon_GOTREL_16_X
std::variant< std::monostate, Loc::Single, Loc::Multi, Loc::MMI, Loc::EntryValue > Variant
Alias for the std::variant specialization base class of DbgVariable.
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectTargetWriter > createHexagonELFObjectWriter(uint8_t OSABI, StringRef CPU)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ FK_PCRel_4
A four-byte pc relative fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.