Skip to content

Commit 84841e2

Browse files
committed
Revert "[MC] Restore MCAsmBackend::shouldForceRelocation to false"
This reverts commit 6f6dc1f. Resulted in several bot failures.
1 parent cfd1b14 commit 84841e2

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ class MCAsmBackend {
8888
/// Get information on a fixup kind.
8989
virtual MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const;
9090

91-
// Hook used by the default `addReloc` to check if a relocation is needed.
91+
// Hook to check if a relocation is needed. The default implementation tests
92+
// whether the MCValue has a relocation specifier.
9293
virtual bool shouldForceRelocation(const MCAssembler &, const MCFixup &,
93-
const MCValue &, const MCSubtargetInfo *) {
94-
return false;
95-
}
94+
const MCValue &, const MCSubtargetInfo *);
9695

9796
/// Hook to check if extra nop bytes must be inserted for alignment directive.
9897
/// For some targets this may be necessary in order to support linker

llvm/lib/MC/MCAsmBackend.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ MCFixupKindInfo MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
109109
return Builtins[Kind - FK_NONE];
110110
}
111111

112+
bool MCAsmBackend::shouldForceRelocation(const MCAssembler &, const MCFixup &,
113+
const MCValue &Target,
114+
const MCSubtargetInfo *) {
115+
return Target.getSpecifier();
116+
}
117+
112118
bool MCAsmBackend::fixupNeedsRelaxationAdvanced(const MCAssembler &,
113119
const MCFixup &Fixup,
114120
const MCValue &, uint64_t Value,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ namespace {
200200
return Info;
201201
}
202202

203+
bool shouldForceRelocation(const MCAssembler &, const MCFixup &,
204+
const MCValue &,
205+
const MCSubtargetInfo *) override {
206+
return false;
207+
}
208+
203209
void relaxInstruction(MCInst &Inst,
204210
const MCSubtargetInfo &STI) const override {
205211
// FIXME.

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "llvm/MC/MCInst.h"
1818
#include "llvm/MC/MCObjectWriter.h"
1919
#include "llvm/MC/MCSubtargetInfo.h"
20-
#include "llvm/MC/MCValue.h"
2120

2221
using namespace llvm;
2322

@@ -113,8 +112,6 @@ class SystemZMCAsmBackend : public MCAsmBackend {
113112
// Override MCAsmBackend
114113
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
115114
MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override;
116-
bool shouldForceRelocation(const MCAssembler &, const MCFixup &,
117-
const MCValue &, const MCSubtargetInfo *) override;
118115
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
119116
const MCValue &Target, MutableArrayRef<char> Data,
120117
uint64_t Value, bool IsResolved,
@@ -155,13 +152,6 @@ MCFixupKindInfo SystemZMCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
155152
return SystemZ::MCFixupKindInfos[Kind - FirstTargetFixupKind];
156153
}
157154

158-
bool SystemZMCAsmBackend::shouldForceRelocation(const MCAssembler &,
159-
const MCFixup &,
160-
const MCValue &Target,
161-
const MCSubtargetInfo *) {
162-
return Target.getSpecifier();
163-
}
164-
165155
void SystemZMCAsmBackend::applyFixup(const MCAssembler &Asm,
166156
const MCFixup &Fixup,
167157
const MCValue &Target,

0 commit comments

Comments
 (0)