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

Owen Anderson resistor at mac.com
Fri Dec 17 13:49:48 PST 2010


Author: resistor
Date: Fri Dec 17 15:49:48 2010
New Revision: 122091

URL: http://llvm.org/viewvc/llvm-project?rev=122091&view=rev
Log:
Thumb's forced-PC-alignment requirement applies to the _total_ displacement, not just to the fragment relative
portion.  While the fragment boundary is usually already aligned, it is possible for it not to be, which 
would lead to a non-aligned final displacement.

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=122091&r1=122090&r2=122091&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Fri Dec 17 15:49:48 2010
@@ -254,12 +254,12 @@
     "FKF_IsAlignedDownTo32Bits is only allowed on PC-relative fixups!");
 
   if (IsPCRel) {
-    uint32_t Offset = Fixup.getOffset();
+    uint32_t Offset = Layout.getFragmentOffset(DF) + Fixup.getOffset();
     
     // A number of ARM fixups in Thumb mode require that the effective PC
     // address be determined as the 32-bit aligned version of the actual offset.
     if (ShouldAlignPC) Offset &= ~0x3;
-    Value -= Layout.getFragmentOffset(DF) + Offset;
+    Value -= Offset;
   }
 
   // ARM fixups based from a thumb function address need to have the low





More information about the llvm-commits mailing list