summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-06-08 03:57:49 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-06-08 03:57:49 +0000
commit70a0206e4b1a5210c8391ef171a42caaeee3fd47 (patch)
treef822795be23efa8f7a98e85cc007ca7a3d7be549 /llvm/lib
parent491c33e9557a0957749f89c2bd6f4c8215cfeec8 (diff)
downloadbcm5719-llvm-70a0206e4b1a5210c8391ef171a42caaeee3fd47.tar.gz
bcm5719-llvm-70a0206e4b1a5210c8391ef171a42caaeee3fd47.zip
MC: fix text section characteristics for WoA
link.exe requires that the text section has the IMAGE_SCN_MEM_16BIT flag set. Otherwise, it will treat the function as ARM. If this occurs, then jumps to the function will fail, switching from thumb to ARM mode execution. With this change, it is possible to link using the MSVC linker as well. llvm-svn: 210415
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index d3d08323447..715dc844c78 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -569,6 +569,8 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
+ bool IsWoA = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
+
// The object file format cannot represent common symbols with explicit
// alignments.
CommDirectiveSupportsAlignment = false;
@@ -582,6 +584,7 @@ void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
SectionKind::getBSS());
TextSection =
Ctx->getCOFFSection(".text",
+ (IsWoA ? COFF::IMAGE_SCN_MEM_16BIT : 0) |
COFF::IMAGE_SCN_CNT_CODE |
COFF::IMAGE_SCN_MEM_EXECUTE |
COFF::IMAGE_SCN_MEM_READ,
OpenPOWER on IntegriCloud