[llvm-commits] [llvm] r145318 - /llvm/trunk/lib/MC/MCAssembler.cpp

Jim Grosbach grosbach at apple.com
Mon Nov 28 15:39:01 PST 2011


Author: grosbach
Date: Mon Nov 28 17:39:00 2011
New Revision: 145318

URL: http://llvm.org/viewvc/llvm-project?rev=145318&view=rev
Log:
Thumb2 only force the fixup thumb bit for data relocations.

rdar://10493453

Modified:
    llvm/trunk/lib/MC/MCAssembler.cpp

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=145318&r1=145317&r2=145318&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Nov 28 17:39:00 2011
@@ -273,13 +273,17 @@
 
   Value = Target.getConstant();
 
-  bool IsThumb = false;
+  bool SetThumbBit = false;
   if (const MCSymbolRefExpr *A = Target.getSymA()) {
     const MCSymbol &Sym = A->getSymbol().AliasedSymbol();
     if (Sym.isDefined())
       Value += Layout.getSymbolOffset(&getSymbolData(Sym));
-    if (isThumbFunc(&Sym))
-      IsThumb = true;
+    // ARM data fixups based from a thumb function address need to have the low
+    // bit set. The actual value is always at least 16-bit aligned, so the
+    // low bit is normally clear and available for use as an ISA flag for
+    // interworking.
+    if (Fixup.getKind() == FK_Data_4 && isThumbFunc(&Sym))
+      SetThumbBit = true;
   }
   if (const MCSymbolRefExpr *B = Target.getSymB()) {
     const MCSymbol &Sym = B->getSymbol().AliasedSymbol();
@@ -302,11 +306,7 @@
     Value -= Offset;
   }
 
-  // ARM fixups based from a thumb function address need to have the low
-  // bit set. The actual value is always at least 16-bit aligned, so the
-  // low bit is normally clear and available for use as an ISA flag for
-  // interworking.
-  if (IsThumb)
+  if (SetThumbBit)
     Value |= 1;
 
   return IsResolved;





More information about the llvm-commits mailing list