@@ -239,14 +239,55 @@ static unsigned calculateMMLEIndex(unsigned i) {
239239 return (1 - i / 2 ) * 2 + i % 2 ;
240240}
241241
242+ static bool shouldForceRelocation (const MCFixup &Fixup) {
243+ const unsigned FixupKind = Fixup.getKind ();
244+ switch (FixupKind) {
245+ default :
246+ return false ;
247+ // All these relocations require special processing
248+ // at linking time. Delegate this work to a linker.
249+ case Mips::fixup_Mips_CALL_HI16:
250+ case Mips::fixup_Mips_CALL_LO16:
251+ case Mips::fixup_Mips_CALL16:
252+ case Mips::fixup_Mips_GOT:
253+ case Mips::fixup_Mips_GOT_PAGE:
254+ case Mips::fixup_Mips_GOT_OFST:
255+ case Mips::fixup_Mips_GOT_DISP:
256+ case Mips::fixup_Mips_GOT_HI16:
257+ case Mips::fixup_Mips_GOT_LO16:
258+ case Mips::fixup_Mips_GOTTPREL:
259+ case Mips::fixup_Mips_DTPREL_HI:
260+ case Mips::fixup_Mips_DTPREL_LO:
261+ case Mips::fixup_Mips_TLSGD:
262+ case Mips::fixup_Mips_TLSLDM:
263+ case Mips::fixup_Mips_TPREL_HI:
264+ case Mips::fixup_Mips_TPREL_LO:
265+ case Mips::fixup_Mips_JALR:
266+ case Mips::fixup_MICROMIPS_CALL16:
267+ case Mips::fixup_MICROMIPS_GOT_DISP:
268+ case Mips::fixup_MICROMIPS_GOT_PAGE:
269+ case Mips::fixup_MICROMIPS_GOT_OFST:
270+ case Mips::fixup_MICROMIPS_GOT16:
271+ case Mips::fixup_MICROMIPS_GOTTPREL:
272+ case Mips::fixup_MICROMIPS_TLS_DTPREL_HI16:
273+ case Mips::fixup_MICROMIPS_TLS_DTPREL_LO16:
274+ case Mips::fixup_MICROMIPS_TLS_GD:
275+ case Mips::fixup_MICROMIPS_TLS_LDM:
276+ case Mips::fixup_MICROMIPS_TLS_TPREL_HI16:
277+ case Mips::fixup_MICROMIPS_TLS_TPREL_LO16:
278+ case Mips::fixup_MICROMIPS_JALR:
279+ return true ;
280+ }
281+ }
282+
242283// / ApplyFixup - Apply the \p Value for given \p Fixup into the provided
243284// / data fragment, at the offset specified by the fixup and following the
244285// / fixup kind as appropriate.
245286void MipsAsmBackend::applyFixup (const MCFragment &F, const MCFixup &Fixup,
246287 const MCValue &Target,
247288 MutableArrayRef<char > Data, uint64_t Value,
248289 bool IsResolved) {
249- if (IsResolved && shouldForceRelocation (Fixup, Target ))
290+ if (shouldForceRelocation (Fixup))
250291 IsResolved = false ;
251292 maybeAddReloc (F, Fixup, Target, Value, IsResolved);
252293 MCFixupKind Kind = Fixup.getKind ();
@@ -559,48 +600,6 @@ bool MipsAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
559600 return true ;
560601}
561602
562- bool MipsAsmBackend::shouldForceRelocation (const MCFixup &Fixup,
563- const MCValue &Target) {
564- const unsigned FixupKind = Fixup.getKind ();
565- switch (FixupKind) {
566- default :
567- return false ;
568- // All these relocations require special processing
569- // at linking time. Delegate this work to a linker.
570- case Mips::fixup_Mips_CALL_HI16:
571- case Mips::fixup_Mips_CALL_LO16:
572- case Mips::fixup_Mips_CALL16:
573- case Mips::fixup_Mips_GOT:
574- case Mips::fixup_Mips_GOT_PAGE:
575- case Mips::fixup_Mips_GOT_OFST:
576- case Mips::fixup_Mips_GOT_DISP:
577- case Mips::fixup_Mips_GOT_HI16:
578- case Mips::fixup_Mips_GOT_LO16:
579- case Mips::fixup_Mips_GOTTPREL:
580- case Mips::fixup_Mips_DTPREL_HI:
581- case Mips::fixup_Mips_DTPREL_LO:
582- case Mips::fixup_Mips_TLSGD:
583- case Mips::fixup_Mips_TLSLDM:
584- case Mips::fixup_Mips_TPREL_HI:
585- case Mips::fixup_Mips_TPREL_LO:
586- case Mips::fixup_Mips_JALR:
587- case Mips::fixup_MICROMIPS_CALL16:
588- case Mips::fixup_MICROMIPS_GOT_DISP:
589- case Mips::fixup_MICROMIPS_GOT_PAGE:
590- case Mips::fixup_MICROMIPS_GOT_OFST:
591- case Mips::fixup_MICROMIPS_GOT16:
592- case Mips::fixup_MICROMIPS_GOTTPREL:
593- case Mips::fixup_MICROMIPS_TLS_DTPREL_HI16:
594- case Mips::fixup_MICROMIPS_TLS_DTPREL_LO16:
595- case Mips::fixup_MICROMIPS_TLS_GD:
596- case Mips::fixup_MICROMIPS_TLS_LDM:
597- case Mips::fixup_MICROMIPS_TLS_TPREL_HI16:
598- case Mips::fixup_MICROMIPS_TLS_TPREL_LO16:
599- case Mips::fixup_MICROMIPS_JALR:
600- return true ;
601- }
602- }
603-
604603namespace {
605604
606605class WindowsMipsAsmBackend : public MipsAsmBackend {
0 commit comments