[llvm-commits] [llvm] r138912 - /llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

Jim Grosbach grosbach at apple.com
Wed Aug 31 15:23:09 PDT 2011


Author: grosbach
Date: Wed Aug 31 17:23:09 2011
New Revision: 138912

URL: http://llvm.org/viewvc/llvm-project?rev=138912&view=rev
Log:
Static relocation model Thumb jump table interworking.

Make sure the low bit of the PC is set when loading an address directly
for jump tables in static relocation model.

Modified:
    llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=138912&r1=138911&r2=138912&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Wed Aug 31 17:23:09 2011
@@ -923,6 +923,11 @@
       Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(JTISymbol,
                                                                    OutContext),
                                      OutContext);
+    // If we're generating a table of Thumb addresses in static relocation
+    // model, we need to add one to keep interworking correctly.
+    else if (AFI->isThumbFunction())
+      Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(1,OutContext),
+                                     OutContext);
     OutStreamer.EmitValue(Expr, 4);
   }
 }





More information about the llvm-commits mailing list