29 enum { DefaultEABIVersion = 0x05000000U };
35 ARMELFObjectWriter(uint8_t OSABI);
37 ~ARMELFObjectWriter()
override =
default;
40 const MCFixup &Fixup,
bool IsPCRel)
const override;
42 bool needsRelocateWithSymbol(
const MCSymbol &Sym,
43 unsigned Type)
const override;
50 ARMELFObjectWriter::ARMELFObjectWriter(uint8_t OSABI)
55 bool ARMELFObjectWriter::needsRelocateWithSymbol(
const MCSymbol &Sym,
56 unsigned Type)
const {
64 case ELF::R_ARM_PREL31:
65 case ELF::R_ARM_ABS32:
76 return GetRelocTypeInner(Target, Fixup, IsPCRel, Ctx);
79 unsigned ARMELFObjectWriter::GetRelocTypeInner(
const MCValue &
Target,
86 switch ((
unsigned)Fixup.
getKind()) {
89 return ELF::R_ARM_NONE;
94 case MCSymbolRefExpr::VK_None:
95 return ELF::R_ARM_REL32;
96 case MCSymbolRefExpr::VK_GOTTPOFF:
97 return ELF::R_ARM_TLS_IE32;
98 case MCSymbolRefExpr::VK_ARM_GOT_PREL:
99 return ELF::R_ARM_GOT_PREL;
100 case MCSymbolRefExpr::VK_ARM_PREL31:
101 return ELF::R_ARM_PREL31;
106 case MCSymbolRefExpr::VK_PLT:
107 return ELF::R_ARM_CALL;
108 case MCSymbolRefExpr::VK_TLSCALL:
109 return ELF::R_ARM_TLS_CALL;
111 return ELF::R_ARM_CALL;
116 return ELF::R_ARM_JUMP24;
118 return ELF::R_ARM_THM_JUMP19;
120 return ELF::R_ARM_THM_JUMP24;
122 return ELF::R_ARM_MOVT_PREL;
124 return ELF::R_ARM_MOVW_PREL_NC;
126 return ELF::R_ARM_THM_MOVT_PREL;
128 return ELF::R_ARM_THM_MOVW_PREL_NC;
130 return ELF::R_ARM_THM_JUMP11;
132 return ELF::R_ARM_THM_JUMP8;
136 case MCSymbolRefExpr::VK_TLSCALL:
137 return ELF::R_ARM_THM_TLS_CALL;
139 return ELF::R_ARM_THM_CALL;
143 switch ((
unsigned)Fixup.
getKind()) {
146 return ELF::R_ARM_NONE;
151 case MCSymbolRefExpr::VK_None:
152 return ELF::R_ARM_ABS8;
158 case MCSymbolRefExpr::VK_None:
159 return ELF::R_ARM_ABS16;
165 case MCSymbolRefExpr::VK_ARM_NONE:
166 return ELF::R_ARM_NONE;
167 case MCSymbolRefExpr::VK_GOT:
168 return ELF::R_ARM_GOT_BREL;
169 case MCSymbolRefExpr::VK_TLSGD:
170 return ELF::R_ARM_TLS_GD32;
171 case MCSymbolRefExpr::VK_TPOFF:
172 return ELF::R_ARM_TLS_LE32;
173 case MCSymbolRefExpr::VK_GOTTPOFF:
174 return ELF::R_ARM_TLS_IE32;
175 case MCSymbolRefExpr::VK_None:
176 return ELF::R_ARM_ABS32;
177 case MCSymbolRefExpr::VK_GOTOFF:
178 return ELF::R_ARM_GOTOFF32;
179 case MCSymbolRefExpr::VK_ARM_GOT_PREL:
180 return ELF::R_ARM_GOT_PREL;
181 case MCSymbolRefExpr::VK_ARM_TARGET1:
182 return ELF::R_ARM_TARGET1;
183 case MCSymbolRefExpr::VK_ARM_TARGET2:
184 return ELF::R_ARM_TARGET2;
185 case MCSymbolRefExpr::VK_ARM_PREL31:
186 return ELF::R_ARM_PREL31;
187 case MCSymbolRefExpr::VK_ARM_SBREL:
188 return ELF::R_ARM_SBREL32;
189 case MCSymbolRefExpr::VK_ARM_TLSLDO:
190 return ELF::R_ARM_TLS_LDO32;
191 case MCSymbolRefExpr::VK_TLSCALL:
192 return ELF::R_ARM_TLS_CALL;
193 case MCSymbolRefExpr::VK_TLSDESC:
194 return ELF::R_ARM_TLS_GOTDESC;
195 case MCSymbolRefExpr::VK_TLSLDM:
196 return ELF::R_ARM_TLS_LDM32;
197 case MCSymbolRefExpr::VK_ARM_TLSDESCSEQ:
198 return ELF::R_ARM_TLS_DESCSEQ;
202 return ELF::R_ARM_JUMP24;
207 case MCSymbolRefExpr::VK_None:
208 return ELF::R_ARM_MOVT_ABS;
209 case MCSymbolRefExpr::VK_ARM_SBREL:
210 return ELF::R_ARM_MOVT_BREL;
216 case MCSymbolRefExpr::VK_None:
217 return ELF::R_ARM_MOVW_ABS_NC;
218 case MCSymbolRefExpr::VK_ARM_SBREL:
219 return ELF::R_ARM_MOVW_BREL_NC;
225 case MCSymbolRefExpr::VK_None:
226 return ELF::R_ARM_THM_MOVT_ABS;
227 case MCSymbolRefExpr::VK_ARM_SBREL:
228 return ELF::R_ARM_THM_MOVT_BREL;
234 case MCSymbolRefExpr::VK_None:
235 return ELF::R_ARM_THM_MOVW_ABS_NC;
236 case MCSymbolRefExpr::VK_ARM_SBREL:
237 return ELF::R_ARM_THM_MOVW_BREL_NC;
242 void ARMELFObjectWriter::addTargetSectionFlags(
MCContext &Ctx,
257 std::unique_ptr<MCObjectTargetWriter>
259 return llvm::make_unique<ARMELFObjectWriter>(OSABI);
SectionKind getKind() const
bool hasInstructions() const
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
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.
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg)
The instances of the Type class are immutable: once they are created, they are never changed...
void setFlags(unsigned F)
const MCObjectFileInfo * getObjectFileInfo() const
std::unique_ptr< MCObjectTargetWriter > createARMELFObjectWriter(uint8_t OSABI)
Construct an ELF Mach-O object writer.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
This represents a section on linux, lots of unix variants and some bare metal systems.
MCSection * getTextSection() const
bool isExecuteOnly() const
unsigned getFlags() const
MCFixupKind getKind() const