ARM Thumb symbol references in assembly need the low bit set.
authorJim Grosbach <grosbach@apple.com>
Fri, 24 Feb 2012 05:12:18 +0000 (05:12 +0000)
committerJim Grosbach <grosbach@apple.com>
Fri, 24 Feb 2012 05:12:18 +0000 (05:12 +0000)
Add support for a missed case when the symbols in a difference
expression are in the same section but not the same fragment.

rdar://10924681

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

lib/MC/MCExpr.cpp

index f3a91cbd5ef7d408b581621c1a486b0f99e022af..ceaecd04103c0b4a1b1c24b342dc22b8705e254c 100644 (file)
@@ -357,6 +357,11 @@ static void AttemptToFoldSymbolOffsetDifference(const MCAssembler *Asm,
   if (Addrs && (&SecA != &SecB))
     Addend += (Addrs->lookup(&SecA) - Addrs->lookup(&SecB));
 
+  // Pointers to Thumb symbols need to have their low-bit set to allow
+  // for interworking.
+  if (Asm->isThumbFunc(&SA))
+    Addend |= 1;
+
   // Clear the symbol expr pointers to indicate we have folded these
   // operands.
   A = B = 0;