@@ -460,9 +460,9 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
460460 // Other relocation types don't want this bit though (branches couldn't encode
461461 // it if it *was* present, and no other relocations exist) and it can
462462 // 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 () &&
466466 (Kind == FK_Data_4 || Kind == ARM::fixup_arm_movw_lo16 ||
467467 Kind == ARM::fixup_arm_movt_hi16 || Kind == ARM::fixup_t2_movw_lo16 ||
468468 Kind == ARM::fixup_t2_movt_hi16))
@@ -958,8 +958,7 @@ bool ARMAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
958958 const MCFixup &Fixup,
959959 const MCValue &Target,
960960 const MCSubtargetInfo *STI) {
961- const MCSymbolRefExpr *A = Target.getSymA ();
962- const MCSymbol *Sym = A ? &A->getSymbol () : nullptr ;
961+ const MCSymbol *Sym = Target.getAddSym ();
963962 const unsigned FixupKind = Fixup.getKind ();
964963 if (FixupKind == ARM::fixup_arm_thumb_bl) {
965964 assert (Sym && " How did we resolve this?" );
@@ -989,10 +988,10 @@ bool ARMAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
989988 // We must always generate a relocation for BL/BLX instructions if we have
990989 // a symbol to reference, as the linker relies on knowing the destination
991990 // 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))
996995 return true ;
997996 return false ;
998997}
0 commit comments