@@ -460,9 +460,9 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
460
460
// Other relocation types don't want this bit though (branches couldn't encode
461
461
// it if it *was* present, and no other relocations exist) and it can
462
462
// interfere with checking valid expressions.
463
- if ( const MCSymbolRefExpr *A = Target. getSymA ()) {
464
- if (A-> hasSubsectionsViaSymbols () && Asm. isThumbFunc (&A-> getSymbol ( )) &&
465
- A-> getSymbol (). isExternal () &&
463
+ bool IsMachO = Asm. getContext (). getObjectFileType () == MCContext::IsMachO;
464
+ if (const auto *SA = Target. getAddSym ( )) {
465
+ if (IsMachO && Asm. isThumbFunc (SA) && SA-> isExternal () &&
466
466
(Kind == FK_Data_4 || Kind == ARM::fixup_arm_movw_lo16 ||
467
467
Kind == ARM::fixup_arm_movt_hi16 || Kind == ARM::fixup_t2_movw_lo16 ||
468
468
Kind == ARM::fixup_t2_movt_hi16))
@@ -958,8 +958,7 @@ bool ARMAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
958
958
const MCFixup &Fixup,
959
959
const MCValue &Target,
960
960
const MCSubtargetInfo *STI) {
961
- const MCSymbolRefExpr *A = Target.getSymA ();
962
- const MCSymbol *Sym = A ? &A->getSymbol () : nullptr ;
961
+ const MCSymbol *Sym = Target.getAddSym ();
963
962
const unsigned FixupKind = Fixup.getKind ();
964
963
if (FixupKind == ARM::fixup_arm_thumb_bl) {
965
964
assert (Sym && " How did we resolve this?" );
@@ -989,10 +988,10 @@ bool ARMAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
989
988
// We must always generate a relocation for BL/BLX instructions if we have
990
989
// a symbol to reference, as the linker relies on knowing the destination
991
990
// symbol's thumb-ness to get interworking right.
992
- if (A && (FixupKind == ARM::fixup_arm_thumb_blx ||
993
- FixupKind == ARM::fixup_arm_blx ||
994
- FixupKind == ARM::fixup_arm_uncondbl ||
995
- FixupKind == ARM::fixup_arm_condbl))
991
+ if (Sym && (FixupKind == ARM::fixup_arm_thumb_blx ||
992
+ FixupKind == ARM::fixup_arm_blx ||
993
+ FixupKind == ARM::fixup_arm_uncondbl ||
994
+ FixupKind == ARM::fixup_arm_condbl))
996
995
return true ;
997
996
return false ;
998
997
}
0 commit comments