Skip to content

Commit 4182d2d

Browse files
committed
[ARM,PowerPC] shouldForceRelocation: check MCValue::Specifier
Follow-up to 38c3ad3 Removes reliance on a MCAssembler::evaluateFixup hack `if (Target.SymSpecifier || SA.isUndefined()) {` (previosuly `if (A->getKind() != MCSymbolRefExpr::VK_None || SA.isUndefined()) {`) Target.SymSpecifier will soon go away when MCValue replaces MCSymbolRefExpr members with MCSymbol and removes the temporary `SymSpecifier` workaround.
1 parent 38c3ad3 commit 4182d2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ bool ARMAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
993993
FixupKind == ARM::fixup_arm_uncondbl ||
994994
FixupKind == ARM::fixup_arm_condbl))
995995
return true;
996-
return false;
996+
return Target.getSpecifier();
997997
}
998998

999999
/// getFixupKindNumBytes - The number of bytes the fixup may change.

llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ class PPCAsmBackend : public MCAsmBackend {
159159
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
160160
const MCValue &Target,
161161
const MCSubtargetInfo *STI) override {
162+
// If there is a @ specifier, unless it is optimized out (e.g. constant @l),
163+
// force a relocation.
164+
if (Target.getSpecifier())
165+
return true;
162166
MCFixupKind Kind = Fixup.getKind();
163167
switch ((unsigned)Kind) {
164168
default:

0 commit comments

Comments
 (0)