[llvm] fe32806 - ELFObjectWriter: Remove the MCContext argument from getRelocType
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat May 24 21:48:16 PDT 2025
Author: Fangrui Song
Date: 2025-05-24T21:48:11-07:00
New Revision: fe32806d67eef72ff406dbcdc6a28d882a00e3a3
URL: https://github.com/llvm/llvm-project/commit/fe32806d67eef72ff406dbcdc6a28d882a00e3a3
DIFF: https://github.com/llvm/llvm-project/commit/fe32806d67eef72ff406dbcdc6a28d882a00e3a3.diff
LOG: ELFObjectWriter: Remove the MCContext argument from getRelocType
Additionally, swap MCFixup/MCValue order to match addReloc/recordRelocation.
Added:
Modified:
llvm/include/llvm/MC/MCELFObjectWriter.h
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp
llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp
llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
llvm/lib/Target/M68k/MCTargetDesc/M68kELFObjectWriter.cpp
llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFObjectWriter.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
llvm/lib/Target/Xtensa/MCTargetDesc/XtensaELFObjectWriter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCELFObjectWriter.h b/llvm/include/llvm/MC/MCELFObjectWriter.h
index 25fa7981ad062..e4b1940498a0b 100644
--- a/llvm/include/llvm/MC/MCELFObjectWriter.h
+++ b/llvm/include/llvm/MC/MCELFObjectWriter.h
@@ -85,8 +85,8 @@ class MCELFObjectTargetWriter : public MCObjectTargetWriter {
}
}
- virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const = 0;
+ virtual unsigned getRelocType(const MCFixup &Fixup, const MCValue &Target,
+ bool IsPCRel) const = 0;
virtual bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const;
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 4665d8574a852..7df9e90ebad12 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1377,7 +1377,7 @@ void ELFObjectWriter::recordRelocation(const MCFragment &F,
if (mc::isRelocRelocation(Fixup.getKind()))
Type = Fixup.getKind() - FirstLiteralRelocationKind;
else
- Type = TargetObjectWriter->getRelocType(Ctx, Target, Fixup, IsPCRel);
+ Type = TargetObjectWriter->getRelocType(Fixup, Target, IsPCRel);
bool UseSectionSym =
SymA && SymA->getBinding() == ELF::STB_LOCAL && !SymA->isUndefined();
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
index 32d2363a8604b..992c9d9105ae7 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
@@ -36,8 +36,8 @@ class AArch64ELFObjectWriter : public MCELFObjectTargetWriter {
~AArch64ELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
bool isNonILP32reloc(const MCFixup &Fixup,
@@ -83,9 +83,8 @@ bool AArch64ELFObjectWriter::isNonILP32reloc(
return false;
}
-unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned AArch64ELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
unsigned Kind = Fixup.getTargetKind();
AArch64MCExpr::Specifier RefKind =
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
index 516186e5684b4..9a3f418e0d527 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
@@ -22,8 +22,8 @@ class AMDGPUELFObjectWriter : public MCELFObjectTargetWriter {
AMDGPUELFObjectWriter(bool Is64Bit, uint8_t OSABI, bool HasRelocationAddend);
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
};
@@ -34,9 +34,8 @@ AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(bool Is64Bit, uint8_t OSABI,
: MCELFObjectTargetWriter(Is64Bit, OSABI, ELF::EM_AMDGPU,
HasRelocationAddend) {}
-unsigned AMDGPUELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned AMDGPUELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
if (const auto *SymA = Target.getAddSym()) {
// SCRATCH_RSRC_DWORD[01] is a special global variable that represents
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
index 4b691b6e2a1ef..3754f1c29c364 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
@@ -28,16 +28,13 @@ namespace {
class ARMELFObjectWriter : public MCELFObjectTargetWriter {
enum { DefaultEABIVersion = 0x05000000U };
- unsigned getRelocTypeInner(const MCValue &Target, const MCFixup &Fixup,
- bool IsPCRel) const;
-
public:
ARMELFObjectWriter(uint8_t OSABI);
~ARMELFObjectWriter() override = default;
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
@@ -69,15 +66,9 @@ bool ARMELFObjectWriter::needsRelocateWithSymbol(const MCValue &,
// Need to examine the Fixup when determining whether to
// emit the relocation as an explicit symbol or as a section relative
// offset
-unsigned ARMELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned ARMELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
- return getRelocTypeInner(Target, Fixup, IsPCRel);
-}
-
-unsigned ARMELFObjectWriter::getRelocTypeInner(const MCValue &Target,
- const MCFixup &Fixup,
- bool IsPCRel) const {
unsigned Kind = Fixup.getTargetKind();
uint8_t Specifier = Target.getSpecifier();
auto CheckFDPIC = [&](uint32_t Type) {
diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp
index e34348ea94d30..39997a672d9a3 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp
@@ -27,15 +27,15 @@ class AVRELFObjectWriter : public MCELFObjectTargetWriter {
virtual ~AVRELFObjectWriter() = default;
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
};
AVRELFObjectWriter::AVRELFObjectWriter(uint8_t OSABI)
: MCELFObjectTargetWriter(false, OSABI, ELF::EM_AVR, true) {}
-unsigned AVRELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned AVRELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
auto Modifier = AVRMCExpr::Specifier(Target.getSpecifier());
switch ((unsigned)Fixup.getKind()) {
diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp b/llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
index 73ea49cc0ee92..5d653eed1755c 100644
--- a/llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
+++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
@@ -25,8 +25,8 @@ class BPFELFObjectWriter : public MCELFObjectTargetWriter {
~BPFELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
};
} // end anonymous namespace
@@ -35,8 +35,8 @@ BPFELFObjectWriter::BPFELFObjectWriter(uint8_t OSABI)
: MCELFObjectTargetWriter(/*Is64Bit*/ true, OSABI, ELF::EM_BPF,
/*HasRelocationAddend*/ false) {}
-unsigned BPFELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned BPFELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
// determine the type of the relocation
switch (Fixup.getKind()) {
diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
index 74149aeec78f1..6bdd5e53cafdb 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
@@ -27,17 +27,16 @@ class CSKYELFObjectWriter : public MCELFObjectTargetWriter {
: MCELFObjectTargetWriter(false, OSABI, ELF::EM_CSKY, true){};
~CSKYELFObjectWriter() {}
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
};
} // namespace
-unsigned CSKYELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned CSKYELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
const MCExpr *Expr = Fixup.getValue();
// Determine the type of the relocation
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp
index b7342d3675417..b0d79357557f0 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp
@@ -28,8 +28,8 @@ class HexagonELFObjectWriter : public MCELFObjectTargetWriter {
public:
HexagonELFObjectWriter(uint8_t OSABI, StringRef C);
- unsigned getRelocType(MCContext &Ctx, MCValue const &Target,
- MCFixup const &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
};
}
@@ -38,9 +38,8 @@ HexagonELFObjectWriter::HexagonELFObjectWriter(uint8_t OSABI, StringRef C)
/*HasRelocationAddend*/ true),
CPU(C) {}
-unsigned HexagonELFObjectWriter::getRelocType(MCContext &Ctx,
- MCValue const &Target,
- MCFixup const &Fixup,
+unsigned HexagonELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
auto Variant = HexagonMCExpr::VariantKind(Target.getSpecifier());
switch (Variant) {
diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
index a21518e44116e..eeb99e86602af 100644
--- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
+++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
@@ -24,8 +24,8 @@ class LanaiELFObjectWriter : public MCELFObjectTargetWriter {
~LanaiELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
};
@@ -36,10 +36,8 @@ LanaiELFObjectWriter::LanaiELFObjectWriter(uint8_t OSABI)
: MCELFObjectTargetWriter(/*Is64Bit_=*/false, OSABI, ELF::EM_LANAI,
/*HasRelocationAddend_=*/true) {}
-unsigned LanaiELFObjectWriter::getRelocType(MCContext & /*Ctx*/,
- const MCValue & /*Target*/,
- const MCFixup &Fixup,
- bool /*IsPCRel*/) const {
+unsigned LanaiELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &, bool) const {
unsigned Type;
unsigned Kind = static_cast<unsigned>(Fixup.getKind());
switch (Kind) {
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
index e141670a71dd2..0ee354c3cfd57 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
@@ -32,8 +32,8 @@ class LoongArchELFObjectWriter : public MCELFObjectTargetWriter {
}
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool EnableRelax;
};
} // end namespace
@@ -46,9 +46,8 @@ LoongArchELFObjectWriter::LoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit,
LoongArchELFObjectWriter::~LoongArchELFObjectWriter() {}
-unsigned LoongArchELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned LoongArchELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
switch (Target.getSpecifier()) {
case ELF::R_LARCH_TLS_LE_HI20:
diff --git a/llvm/lib/Target/M68k/MCTargetDesc/M68kELFObjectWriter.cpp b/llvm/lib/Target/M68k/MCTargetDesc/M68kELFObjectWriter.cpp
index 200d499753718..1a61325008aab 100644
--- a/llvm/lib/Target/M68k/MCTargetDesc/M68kELFObjectWriter.cpp
+++ b/llvm/lib/Target/M68k/MCTargetDesc/M68kELFObjectWriter.cpp
@@ -33,8 +33,8 @@ class M68kELFObjectWriter : public MCELFObjectTargetWriter {
~M68kELFObjectWriter() override;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
};
} // namespace
@@ -61,9 +61,8 @@ static M68kRelType getType(unsigned Kind, M68kMCExpr::Specifier &Modifier,
llvm_unreachable("Unimplemented");
}
-unsigned M68kELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned M68kELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
auto Specifier = M68kMCExpr::Specifier(Target.getSpecifier());
unsigned Kind = Fixup.getKind();
diff --git a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFObjectWriter.cpp b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFObjectWriter.cpp
index aa097ccb9de63..1fdc1f799fe52 100644
--- a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFObjectWriter.cpp
+++ b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFObjectWriter.cpp
@@ -27,8 +27,8 @@ class MSP430ELFObjectWriter : public MCELFObjectTargetWriter {
~MSP430ELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override {
+ unsigned getRelocType(const MCFixup &Fixup, const MCValue &,
+ bool IsPCRel) const override {
// Translate fixup kind to ELF relocation type.
switch (Fixup.getTargetKind()) {
case FK_Data_1: return ELF::R_MSP430_8;
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
index 96826a51907c0..549f342f493f5 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -48,8 +48,8 @@ class MipsELFObjectWriter : public MCELFObjectTargetWriter {
~MipsELFObjectWriter() override = default;
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
void sortRelocs(std::vector<ELFRelocationEntry> &Relocs) override;
@@ -152,9 +152,8 @@ MipsELFObjectWriter::MipsELFObjectWriter(uint8_t OSABI,
bool HasRelocationAddend, bool Is64)
: MCELFObjectTargetWriter(Is64, OSABI, ELF::EM_MIPS, HasRelocationAddend) {}
-unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned MipsELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
// Determine the type of the relocation.
unsigned Kind = Fixup.getTargetKind();
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
index 8d6f7a94b0519..b6707358b2fd7 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
@@ -25,8 +25,8 @@ namespace {
PPCELFObjectWriter(bool Is64Bit, uint8_t OSABI);
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &Fixup, const MCValue &Target,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
@@ -38,8 +38,8 @@ PPCELFObjectWriter::PPCELFObjectWriter(bool Is64Bit, uint8_t OSABI)
Is64Bit ? ELF::EM_PPC64 : ELF::EM_PPC,
/*HasRelocationAddend*/ true) {}
-unsigned PPCELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned PPCELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
SMLoc Loc = Fixup.getValue()->getLoc();
auto Spec = static_cast<PPCMCExpr::Specifier>(Target.getSpecifier());
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
index 4cde08a41f41b..3955e97feca33 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
@@ -35,8 +35,8 @@ class RISCVELFObjectWriter : public MCELFObjectTargetWriter {
}
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
};
}
@@ -46,9 +46,8 @@ RISCVELFObjectWriter::RISCVELFObjectWriter(uint8_t OSABI, bool Is64Bit)
RISCVELFObjectWriter::~RISCVELFObjectWriter() = default;
-unsigned RISCVELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned RISCVELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
const MCExpr *Expr = Fixup.getValue();
unsigned Kind = Fixup.getTargetKind();
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
index 89297450b72c7..40bc484a48532 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
@@ -32,17 +32,16 @@ namespace {
~SparcELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &Fixup, const MCValue &Target,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
};
}
-unsigned SparcELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned SparcELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
switch (Target.getSpecifier()) {
case ELF::R_SPARC_TLS_GD_HI22:
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
index d87f8d6485c0b..94bf2cadb1901 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
@@ -32,8 +32,8 @@ class SystemZELFObjectWriter : public MCELFObjectTargetWriter {
protected:
// Override MCELFObjectTargetWriter.
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
unsigned getAbsoluteReloc(SMLoc Loc, unsigned Kind) const;
@@ -99,9 +99,8 @@ unsigned SystemZELFObjectWriter::getPCRelReloc(SMLoc Loc, unsigned Kind) const {
return 0;
}
-unsigned SystemZELFObjectWriter::getRelocType(MCContext &Ctx,
+unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
const MCValue &Target,
- const MCFixup &Fixup,
bool IsPCRel) const {
SMLoc Loc = Fixup.getLoc();
unsigned Kind = Fixup.getKind();
diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp b/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
index 1b3e9784de3ba..2984c862c4bc6 100644
--- a/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
+++ b/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
@@ -29,16 +29,16 @@ class VEELFObjectWriter : public MCELFObjectTargetWriter {
~VEELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
};
} // namespace
-unsigned VEELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned VEELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
switch (Target.getSpecifier()) {
case VEMCExpr::VK_TLS_GD_HI32:
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
index c817a3a806d29..b2451511e363f 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
@@ -33,8 +33,8 @@ class X86ELFObjectWriter : public MCELFObjectTargetWriter {
~X86ELFObjectWriter() override = default;
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
@@ -339,8 +339,8 @@ unsigned X86ELFObjectWriter::getRelocType32(SMLoc Loc,
return ELF::R_386_NONE;
}
-unsigned X86ELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned X86ELFObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
MCFixupKind Kind = Fixup.getKind();
auto Specifier = X86MCExpr::Specifier(Target.getSpecifier());
diff --git a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaELFObjectWriter.cpp b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaELFObjectWriter.cpp
index 7472371932f11..68cf5d999254c 100644
--- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaELFObjectWriter.cpp
+++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaELFObjectWriter.cpp
@@ -30,8 +30,8 @@ class XtensaObjectWriter : public MCELFObjectTargetWriter {
virtual ~XtensaObjectWriter();
protected:
- unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup, bool IsPCRel) const override;
+ unsigned getRelocType(const MCFixup &, const MCValue &,
+ bool IsPCRel) const override;
bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym,
unsigned Type) const override;
};
@@ -43,8 +43,8 @@ XtensaObjectWriter::XtensaObjectWriter(uint8_t OSABI)
XtensaObjectWriter::~XtensaObjectWriter() {}
-unsigned XtensaObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
- const MCFixup &Fixup,
+unsigned XtensaObjectWriter::getRelocType(const MCFixup &Fixup,
+ const MCValue &Target,
bool IsPCRel) const {
switch ((unsigned)Fixup.getKind()) {
More information about the llvm-commits
mailing list