ARM,Sparc: Avoid using the MCContext & argument Prepare for removing MCContext from getRelocType functions.
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp index bf2e717..4b691b6 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
@@ -25,23 +25,23 @@ namespace { - class ARMELFObjectWriter : public MCELFObjectTargetWriter { - enum { DefaultEABIVersion = 0x05000000U }; +class ARMELFObjectWriter : public MCELFObjectTargetWriter { + enum { DefaultEABIVersion = 0x05000000U }; - unsigned GetRelocTypeInner(const MCValue &Target, const MCFixup &Fixup, - bool IsPCRel, MCContext &Ctx) const; + unsigned getRelocTypeInner(const MCValue &Target, const MCFixup &Fixup, + bool IsPCRel) const; - public: - ARMELFObjectWriter(uint8_t OSABI); +public: + ARMELFObjectWriter(uint8_t OSABI); - ~ARMELFObjectWriter() override = default; + ~ARMELFObjectWriter() override = default; - unsigned getRelocType(MCContext &Ctx, const MCValue &Target, - const MCFixup &Fixup, bool IsPCRel) const override; + unsigned getRelocType(MCContext &Ctx, const MCValue &Target, + const MCFixup &Fixup, bool IsPCRel) const override; - bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, - unsigned Type) const override; - }; + bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, + unsigned Type) const override; +}; } // end anonymous namespace @@ -72,13 +72,12 @@ unsigned ARMELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const { - return GetRelocTypeInner(Target, Fixup, IsPCRel, Ctx); + return getRelocTypeInner(Target, Fixup, IsPCRel); } -unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target, +unsigned ARMELFObjectWriter::getRelocTypeInner(const MCValue &Target, const MCFixup &Fixup, - bool IsPCRel, - MCContext &Ctx) const { + bool IsPCRel) const { unsigned Kind = Fixup.getTargetKind(); uint8_t Specifier = Target.getSpecifier(); auto CheckFDPIC = [&](uint32_t Type) {
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp index b54958c..8929745 100644 --- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp +++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
@@ -88,7 +88,7 @@ case FK_Data_4: return ELF::R_SPARC_DISP32; case FK_Data_8: return ELF::R_SPARC_DISP64; case Sparc::fixup_sparc_call30: - if (Ctx.getObjectFileInfo()->isPositionIndependent()) + if (getContext().getObjectFileInfo()->isPositionIndependent()) return ELF::R_SPARC_WPLT30; return ELF::R_SPARC_WDISP30; } @@ -110,7 +110,7 @@ ? ELF::R_SPARC_UA64 : ELF::R_SPARC_64); case Sparc::fixup_sparc_13: - if (Ctx.getObjectFileInfo()->isPositionIndependent()) + if (getContext().getObjectFileInfo()->isPositionIndependent()) return ELF::R_SPARC_GOT13; return ELF::R_SPARC_13; }