@@ -176,8 +176,11 @@ class X86AsmBackend : public MCAsmBackend {
176176 bool mayNeedRelaxation (const MCInst &Inst,
177177 const MCSubtargetInfo &STI) const override ;
178178
179- bool fixupNeedsRelaxation (const MCFixup &Fixup,
180- uint64_t Value) const override ;
179+ bool fixupNeedsRelaxationAdvanced (const MCAssembler &Asm,
180+ const MCFixup &Fixup, bool Resolved,
181+ uint64_t Value,
182+ const MCRelaxableFragment *DF,
183+ const bool WasForced) const override ;
181184
182185 void relaxInstruction (MCInst &Inst,
183186 const MCSubtargetInfo &STI) const override ;
@@ -729,10 +732,24 @@ bool X86AsmBackend::mayNeedRelaxation(const MCInst &MI,
729732 MI.getOperand (MI.getNumOperands () - 1 - SkipOperands).isExpr ());
730733}
731734
732- bool X86AsmBackend::fixupNeedsRelaxation (const MCFixup &Fixup,
733- uint64_t Value) const {
734- // Relax if the value is too big for a (signed) i8.
735- return !isInt<8 >(Value);
735+ bool X86AsmBackend::fixupNeedsRelaxationAdvanced (const MCAssembler &Asm,
736+ const MCFixup &Fixup,
737+ bool Resolved, uint64_t Value,
738+ const MCRelaxableFragment *DF,
739+ const bool WasForced) const {
740+ // If resolved, relax if the value is too big for a (signed) i8.
741+ if (Resolved)
742+ return !isInt<8 >(Value);
743+
744+ // Otherwise, relax unless there is a @ABS8 specifier.
745+ if (Fixup.getKind () == FK_Data_1) {
746+ MCValue Target;
747+ if (Fixup.getValue ()->evaluateAsRelocatable (Target, &Asm) &&
748+ Target.getSymA () &&
749+ Target.getSymA ()->getKind () == MCSymbolRefExpr::VK_X86_ABS8)
750+ return false ;
751+ }
752+ return true ;
736753}
737754
738755// FIXME: Can tblgen help at all here to verify there aren't other instructions
0 commit comments