25 SparcELFObjectWriter(
bool Is64Bit,
bool IsV8Plus, uint8_t OSABI)
26 : MCELFObjectTargetWriter(
28 Is64Bit ?
ELF::EM_SPARCV9
29 : (IsV8Plus ?
ELF::EM_SPARC32PLUS :
ELF::EM_SPARC),
32 ~SparcELFObjectWriter()
override =
default;
35 unsigned getRelocType(
const MCFixup &Fixup,
const MCValue &Target,
36 bool IsPCRel)
const override;
38 bool needsRelocateWithSymbol(
const MCValue &,
unsigned Type)
const override;
42unsigned SparcELFObjectWriter::getRelocType(
const MCFixup &Fixup,
46 auto Spec =
Target.getSpecifier();
48 case ELF::R_SPARC_TLS_GD_HI22:
49 case ELF::R_SPARC_TLS_GD_LO10:
50 case ELF::R_SPARC_TLS_GD_ADD:
51 case ELF::R_SPARC_TLS_LDM_HI22:
52 case ELF::R_SPARC_TLS_LDM_LO10:
53 case ELF::R_SPARC_TLS_LDM_ADD:
54 case ELF::R_SPARC_TLS_LDO_HIX22:
55 case ELF::R_SPARC_TLS_LDO_LOX10:
56 case ELF::R_SPARC_TLS_LDO_ADD:
57 case ELF::R_SPARC_TLS_IE_HI22:
58 case ELF::R_SPARC_TLS_IE_LO10:
59 case ELF::R_SPARC_TLS_IE_LD:
60 case ELF::R_SPARC_TLS_IE_LDX:
61 case ELF::R_SPARC_TLS_IE_ADD:
62 case ELF::R_SPARC_TLS_LE_HIX22:
63 case ELF::R_SPARC_TLS_LE_LOX10:
67 case ELF::R_SPARC_DISP32:
69 return ELF::R_SPARC_DISP32;
71 " can only be used in a .word directive");
72 return ELF::R_SPARC_NONE;
73 case ELF::R_SPARC_TLS_DTPOFF32:
74 case ELF::R_SPARC_TLS_DTPOFF64: {
75 bool Is64 = Spec == ELF::R_SPARC_TLS_DTPOFF64;
78 " can only be used in a ." +
79 (Is64 ?
"xword" :
"word") +
" directive");
80 return ELF::R_SPARC_NONE;
99 case FK_Data_1:
return ELF::R_SPARC_DISP8;
100 case FK_Data_2:
return ELF::R_SPARC_DISP16;
101 case FK_Data_4:
return ELF::R_SPARC_DISP32;
102 case FK_Data_8:
return ELF::R_SPARC_DISP64;
104 if (
getContext().getObjectFileInfo()->isPositionIndependent())
105 return ELF::R_SPARC_WPLT30;
106 return ELF::R_SPARC_WDISP30;
111 switch(
Fixup.getKind()) {
114 case FK_NONE:
return ELF::R_SPARC_NONE;
126 if (
getContext().getObjectFileInfo()->isPositionIndependent())
127 return ELF::R_SPARC_GOT13;
128 return ELF::R_SPARC_13;
132 return ELF::R_SPARC_NONE;
135bool SparcELFObjectWriter::needsRelocateWithSymbol(
const MCValue &,
136 unsigned Type)
const {
145 case ELF::R_SPARC_GOT10:
146 case ELF::R_SPARC_GOT13:
147 case ELF::R_SPARC_GOT22:
148 case ELF::R_SPARC_GOTDATA_HIX22:
149 case ELF::R_SPARC_GOTDATA_LOX10:
150 case ELF::R_SPARC_GOTDATA_OP_HIX22:
151 case ELF::R_SPARC_GOTDATA_OP_LOX10:
152 case ELF::R_SPARC_GOTDATA_OP:
157std::unique_ptr<MCObjectTargetWriter>
159 return std::make_unique<SparcELFObjectWriter>(Is64Bit, IsV8Plus, OSABI);
static Error reportError(StringRef Message)
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Target - Wrapper for Target specific information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ fixup_sparc_13
fixup_sparc_13 - 13-bit fixup
StringRef getSpecifierName(uint16_t S)
bool isRelocation(MCFixupKind FixupKind)
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectTargetWriter > createSparcELFObjectWriter(bool Is64Bit, bool IsV8Plus, uint8_t OSABI)
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.