diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-08-31 22:23:09 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-08-31 22:23:09 +0000 |
commit | de98273189700c1c66f06bcfbcc481cf481a8dee (patch) | |
tree | 1f7cfefec34e15d166341502b04ea06e1f1ac108 | |
parent | b45b11bce1fd79b0973d2df8db295583b5477c62 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138912 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMAsmPrinter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index ce238a1beb..13d2ad504e 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -923,6 +923,11 @@ void ARMAsmPrinter::EmitJumpTable(const MachineInstr *MI) { 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); } } |