summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-08-31 22:23:09 +0000
committerJim Grosbach <grosbach@apple.com>2011-08-31 22:23:09 +0000
commite1995f25667c1cc2ef50ed266f64e58c473c06dc (patch)
treeb3e548c9d5e79242fed201b3a73bc223ba78eed5
parent4af0aa98d565970ee86c15e7cbe206e944b956ce (diff)
downloadbcm5719-llvm-e1995f25667c1cc2ef50ed266f64e58c473c06dc.tar.gz
bcm5719-llvm-e1995f25667c1cc2ef50ed266f64e58c473c06dc.zip
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. llvm-svn: 138912
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index ce238a1bebf..13d2ad504e5 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/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);
}
}
OpenPOWER on IntegriCloud