29 enum { DefaultEABIVersion = 0x05000000U };
35 ARMELFObjectWriter(uint8_t OSABI);
37 ~ARMELFObjectWriter()
override =
default;
43 unsigned Type)
const override;
48ARMELFObjectWriter::ARMELFObjectWriter(uint8_t OSABI)
53bool ARMELFObjectWriter::needsRelocateWithSymbol(
const MCValue &,
55 unsigned Type)
const {
63 case ELF::R_ARM_PREL31:
64 case ELF::R_ARM_ABS32:
75 return GetRelocTypeInner(
Target,
Fixup, IsPCRel, Ctx);
78unsigned ARMELFObjectWriter::GetRelocTypeInner(
const MCValue &
Target,
91 " only supported in FDPIC mode");
96 switch (
Fixup.getTargetKind()) {
99 return ELF::R_ARM_NONE;
104 "invalid fixup for 4-byte pc-relative data relocation");
105 return ELF::R_ARM_NONE;
110 if (SymRef->getSymbol().getName() ==
"_GLOBAL_OFFSET_TABLE_")
111 return ELF::R_ARM_BASE_PREL;
113 return ELF::R_ARM_REL32;
116 return ELF::R_ARM_TLS_IE32;
118 return ELF::R_ARM_GOT_PREL;
120 return ELF::R_ARM_PREL31;
126 return ELF::R_ARM_CALL;
128 return ELF::R_ARM_TLS_CALL;
130 return ELF::R_ARM_CALL;
135 return ELF::R_ARM_JUMP24;
137 return ELF::R_ARM_THM_JUMP19;
139 return ELF::R_ARM_THM_JUMP24;
141 return ELF::R_ARM_MOVT_PREL;
143 return ELF::R_ARM_MOVW_PREL_NC;
145 return ELF::R_ARM_THM_MOVT_PREL;
147 return ELF::R_ARM_THM_MOVW_PREL_NC;
149 return ELF::R_ARM_THM_ALU_ABS_G3;
151 return ELF::R_ARM_THM_ALU_ABS_G2_NC;
153 return ELF::R_ARM_THM_ALU_ABS_G1_NC;
155 return ELF::R_ARM_THM_ALU_ABS_G0_NC;
157 return ELF::R_ARM_THM_JUMP11;
159 return ELF::R_ARM_THM_JUMP8;
164 return ELF::R_ARM_THM_TLS_CALL;
166 return ELF::R_ARM_THM_CALL;
169 return ELF::R_ARM_LDR_PC_G0;
171 return ELF::R_ARM_LDRS_PC_G0;
173 return ELF::R_ARM_THM_PC12;
175 return ELF::R_ARM_ALU_PC_G0;
177 return ELF::R_ARM_THM_PC8;
179 return ELF::R_ARM_THM_ALU_PREL_11_0;
181 return ELF::R_ARM_THM_BF16;
183 return ELF::R_ARM_THM_BF12;
185 return ELF::R_ARM_THM_BF18;
191 return ELF::R_ARM_NONE;
196 "invalid fixup for 1-byte data relocation");
197 return ELF::R_ARM_NONE;
199 return ELF::R_ARM_ABS8;
205 "invalid fixup for 2-byte data relocation");
206 return ELF::R_ARM_NONE;
208 return ELF::R_ARM_ABS16;
214 "invalid fixup for 4-byte data relocation");
215 return ELF::R_ARM_NONE;
217 return ELF::R_ARM_NONE;
219 return ELF::R_ARM_GOT_BREL;
221 return ELF::R_ARM_TLS_GD32;
223 return ELF::R_ARM_TLS_LE32;
225 return ELF::R_ARM_TLS_IE32;
227 return ELF::R_ARM_ABS32;
229 return ELF::R_ARM_GOTOFF32;
231 return ELF::R_ARM_GOT_PREL;
233 return ELF::R_ARM_TARGET1;
235 return ELF::R_ARM_TARGET2;
237 return ELF::R_ARM_PREL31;
239 return ELF::R_ARM_SBREL32;
241 return ELF::R_ARM_TLS_LDO32;
243 return ELF::R_ARM_TLS_CALL;
245 return ELF::R_ARM_TLS_GOTDESC;
247 return ELF::R_ARM_TLS_LDM32;
249 return ELF::R_ARM_TLS_DESCSEQ;
251 return CheckFDPIC(ELF::R_ARM_FUNCDESC);
253 return CheckFDPIC(ELF::R_ARM_GOTFUNCDESC);
255 return CheckFDPIC(ELF::R_ARM_GOTOFFFUNCDESC);
257 return CheckFDPIC(ELF::R_ARM_TLS_GD32_FDPIC);
259 return CheckFDPIC(ELF::R_ARM_TLS_LDM32_FDPIC);
261 return CheckFDPIC(ELF::R_ARM_TLS_IE32_FDPIC);
265 return ELF::R_ARM_JUMP24;
270 return ELF::R_ARM_NONE;
272 return ELF::R_ARM_MOVT_ABS;
274 return ELF::R_ARM_MOVT_BREL;
280 return ELF::R_ARM_NONE;
282 return ELF::R_ARM_MOVW_ABS_NC;
284 return ELF::R_ARM_MOVW_BREL_NC;
290 "invalid fixup for Thumb MOVT instruction");
291 return ELF::R_ARM_NONE;
293 return ELF::R_ARM_THM_MOVT_ABS;
295 return ELF::R_ARM_THM_MOVT_BREL;
301 "invalid fixup for Thumb MOVW instruction");
302 return ELF::R_ARM_NONE;
304 return ELF::R_ARM_THM_MOVW_ABS_NC;
306 return ELF::R_ARM_THM_MOVW_BREL_NC;
310 return ELF::R_ARM_THM_ALU_ABS_G3;
312 return ELF::R_ARM_THM_ALU_ABS_G2_NC;
314 return ELF::R_ARM_THM_ALU_ABS_G1_NC;
316 return ELF::R_ARM_THM_ALU_ABS_G0_NC;
320std::unique_ptr<MCObjectTargetWriter>
322 return std::make_unique<ARMELFObjectWriter>(OSABI);
PowerPC TLS Dynamic Call Fixup
Context object for machine code objects.
void reportError(SMLoc L, const Twine &Msg)
virtual bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, unsigned Type) const
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)...
Represent a reference to a symbol from inside an expression.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This represents an "assembler immediate".
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
@ fixup_thumb_adr_pcrel_10
@ fixup_arm_thumb_upper_8_15
@ fixup_arm_thumb_lower_0_7
@ fixup_arm_pcrel_10_unscaled
@ fixup_arm_thumb_upper_0_7
@ fixup_arm_ldst_pcrel_12
@ fixup_arm_thumb_lower_8_15
StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type)
This is an optimization pass for GlobalISel generic memory operations.
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.
std::unique_ptr< MCObjectTargetWriter > createARMELFObjectWriter(uint8_t OSABI)
Construct an ELF Mach-O object writer.