Skip to content

Commit e933948

Browse files
committed
ARM,Sparc: Avoid using the MCContext & argument
Prepare for removing MCContext from getRelocType functions.
1 parent a438b23 commit e933948

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ using namespace llvm;
2525

2626
namespace {
2727

28-
class ARMELFObjectWriter : public MCELFObjectTargetWriter {
29-
enum { DefaultEABIVersion = 0x05000000U };
28+
class ARMELFObjectWriter : public MCELFObjectTargetWriter {
29+
enum { DefaultEABIVersion = 0x05000000U };
3030

31-
unsigned GetRelocTypeInner(const MCValue &Target, const MCFixup &Fixup,
32-
bool IsPCRel, MCContext &Ctx) const;
31+
unsigned getRelocTypeInner(const MCValue &Target, const MCFixup &Fixup,
32+
bool IsPCRel) const;
3333

34-
public:
35-
ARMELFObjectWriter(uint8_t OSABI);
34+
public:
35+
ARMELFObjectWriter(uint8_t OSABI);
3636

37-
~ARMELFObjectWriter() override = default;
37+
~ARMELFObjectWriter() override = default;
3838

39-
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
40-
const MCFixup &Fixup, bool IsPCRel) const override;
39+
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
40+
const MCFixup &Fixup, bool IsPCRel) const override;
4141

42-
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
43-
unsigned Type) const override;
44-
};
42+
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
43+
unsigned Type) const override;
44+
};
4545

4646
} // end anonymous namespace
4747

@@ -72,13 +72,12 @@ bool ARMELFObjectWriter::needsRelocateWithSymbol(const MCValue &,
7272
unsigned ARMELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
7373
const MCFixup &Fixup,
7474
bool IsPCRel) const {
75-
return GetRelocTypeInner(Target, Fixup, IsPCRel, Ctx);
75+
return getRelocTypeInner(Target, Fixup, IsPCRel);
7676
}
7777

78-
unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
78+
unsigned ARMELFObjectWriter::getRelocTypeInner(const MCValue &Target,
7979
const MCFixup &Fixup,
80-
bool IsPCRel,
81-
MCContext &Ctx) const {
80+
bool IsPCRel) const {
8281
unsigned Kind = Fixup.getTargetKind();
8382
uint8_t Specifier = Target.getSpecifier();
8483
auto CheckFDPIC = [&](uint32_t Type) {

llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ unsigned SparcELFObjectWriter::getRelocType(MCContext &Ctx,
8888
case FK_Data_4: return ELF::R_SPARC_DISP32;
8989
case FK_Data_8: return ELF::R_SPARC_DISP64;
9090
case Sparc::fixup_sparc_call30:
91-
if (Ctx.getObjectFileInfo()->isPositionIndependent())
91+
if (getContext().getObjectFileInfo()->isPositionIndependent())
9292
return ELF::R_SPARC_WPLT30;
9393
return ELF::R_SPARC_WDISP30;
9494
}
@@ -110,7 +110,7 @@ unsigned SparcELFObjectWriter::getRelocType(MCContext &Ctx,
110110
? ELF::R_SPARC_UA64
111111
: ELF::R_SPARC_64);
112112
case Sparc::fixup_sparc_13:
113-
if (Ctx.getObjectFileInfo()->isPositionIndependent())
113+
if (getContext().getObjectFileInfo()->isPositionIndependent())
114114
return ELF::R_SPARC_GOT13;
115115
return ELF::R_SPARC_13;
116116
}

0 commit comments

Comments
 (0)