MCAssembler tweak for determining when a symbol difference is resolved.
authorJim Grosbach <grosbach@apple.com>
Wed, 18 Jan 2012 21:54:12 +0000 (21:54 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 18 Jan 2012 21:54:12 +0000 (21:54 +0000)
If the two fragments are in the same Atom, then the difference
expression is resolvable at compile time. Previously we were checking
that they were in the same fragment, but that breaks down in the
presence of instruction relaxation which has multiple fragments in the
same atom.

rdar://10711829

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148423 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MachObjectWriter.cpp

index ce222b75cf4de4b7067645c4aca2c0e3101fbcc4..a3445219f1ef188d5c0da3ebd07ef497a03114ef 100644 (file)
@@ -591,7 +591,8 @@ IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
 
     if (!Asm.getBackend().hasReliableSymbolDifference()) {
       if (!SA.isInSection() || &SecA != &SecB ||
-          (!SA.isTemporary() && &FB != Asm.getSymbolData(SA).getFragment()))
+          (!SA.isTemporary() &&
+           FB.getAtom() != Asm.getSymbolData(SA).getFragment()->getAtom()))
         return false;
       return true;
     }