summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCExpr.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-02-24 05:12:18 +0000
committerJim Grosbach <grosbach@apple.com>2012-02-24 05:12:18 +0000
commit213039a5a1ed1528663816ae5349cf951e398972 (patch)
tree05452589a279cf4b45815f5573fb3419a7b839ff /llvm/lib/MC/MCExpr.cpp
parent0e615684bbefb24ef850afc79bc326682cb1615b (diff)
downloadbcm5719-llvm-213039a5a1ed1528663816ae5349cf951e398972.tar.gz
bcm5719-llvm-213039a5a1ed1528663816ae5349cf951e398972.zip
ARM Thumb symbol references in assembly need the low bit set.
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 llvm-svn: 151345
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r--llvm/lib/MC/MCExpr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index f3a91cbd5ef..ceaecd04103 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -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;
OpenPOWER on IntegriCloud