@@ -142,7 +142,7 @@ bool MCAssembler::isThumbFunc(const MCSymbol *Symbol) const {
142142 return true ;
143143}
144144
145- bool MCAssembler::evaluateFixup (const MCFragment &F, const MCFixup &Fixup,
145+ bool MCAssembler::evaluateFixup (const MCFragment &F, MCFixup &Fixup,
146146 MCValue &Target, uint64_t &Value,
147147 bool RecordReloc,
148148 MutableArrayRef<char > Contents) const {
@@ -163,6 +163,7 @@ bool MCAssembler::evaluateFixup(const MCFragment &F, const MCFixup &Fixup,
163163
164164 bool IsResolved = false ;
165165 unsigned FixupFlags = getBackend ().getFixupKindInfo (Fixup.getKind ()).Flags ;
166+ bool IsPCRel = FixupFlags & MCFixupKindInfo::FKF_IsPCRel;
166167 if (FixupFlags & MCFixupKindInfo::FKF_IsTarget) {
167168 IsResolved = getBackend ().evaluateTargetFixup (Fixup, Target, Value);
168169 } else {
@@ -174,7 +175,6 @@ bool MCAssembler::evaluateFixup(const MCFragment &F, const MCFixup &Fixup,
174175 if (Sub && Sub->isDefined ())
175176 Value -= getSymbolOffset (*Sub);
176177
177- bool IsPCRel = FixupFlags & MCFixupKindInfo::FKF_IsPCRel;
178178 bool ShouldAlignPC =
179179 FixupFlags & MCFixupKindInfo::FKF_IsAlignedDownTo32Bits;
180180 if (IsPCRel) {
@@ -202,6 +202,8 @@ bool MCAssembler::evaluateFixup(const MCFragment &F, const MCFixup &Fixup,
202202
203203 if (IsResolved && mc::isRelocRelocation (Fixup.getKind ()))
204204 IsResolved = false ;
205+ if (IsPCRel)
206+ Fixup.setPCRel ();
205207 getBackend ().applyFixup (F, Fixup, Target, Contents, Value, IsResolved);
206208 return true ;
207209}
@@ -875,7 +877,7 @@ void MCAssembler::layout() {
875877 // Process fragments with fixups here.
876878 if (auto *F = dyn_cast<MCEncodedFragment>(&Frag)) {
877879 auto Contents = F->getContents ();
878- for (const MCFixup &Fixup : F->getFixups ()) {
880+ for (MCFixup &Fixup : F->getFixups ()) {
879881 uint64_t FixedValue;
880882 MCValue Target;
881883 evaluateFixup (Frag, Fixup, Target, FixedValue,
0 commit comments