aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSectionCOFF.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-09-20 20:40:50 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-09-20 20:40:50 +0000
commit7d0dc3ef18e5adf8e8a68766996a20f0f8bfa68a (patch)
treee703f22ddfabe743577feec5b520883783675926 /llvm/lib/MC/MCSectionCOFF.cpp
parent78a761ce8cfab62f252135021622551c83271471 (diff)
downloadllvm-7d0dc3ef18e5adf8e8a68766996a20f0f8bfa68a.zip
llvm-7d0dc3ef18e5adf8e8a68766996a20f0f8bfa68a.tar.gz
llvm-7d0dc3ef18e5adf8e8a68766996a20f0f8bfa68a.tar.bz2
MC: Fix MCSectionCOFF::PrintSwitchToSection
We had a few bugs: - We were considering the GVKind instead of just looking at the section characteristics - We would never print out 'y' when a section was meant to be unreadable - We would never print out 's' when a section was meant to be shared - We translated IMAGE_SCN_MEM_DISCARDABLE to 'n' when it should've meant IMAGE_SCN_LNK_REMOVE llvm-svn: 218189
Diffstat (limited to 'llvm/lib/MC/MCSectionCOFF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionCOFF.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCSectionCOFF.cpp b/llvm/lib/MC/MCSectionCOFF.cpp
index ee6b249..e95845f 100644
--- a/llvm/lib/MC/MCSectionCOFF.cpp
+++ b/llvm/lib/MC/MCSectionCOFF.cpp
@@ -47,18 +47,22 @@ void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
}
OS << "\t.section\t" << getSectionName() << ",\"";
- if (getKind().isText())
+ if (getCharacteristics() & COFF::IMAGE_SCN_MEM_EXECUTE)
OS << 'x';
- else if (getKind().isBSS())
- OS << 'b';
- if (getKind().isWriteable() && !getKind().isReadOnlyWithRel())
+ if (getCharacteristics() & COFF::IMAGE_SCN_MEM_WRITE)
OS << 'w';
- else
+ else if (getCharacteristics() & COFF::IMAGE_SCN_MEM_READ)
OS << 'r';
- if (getCharacteristics() & COFF::IMAGE_SCN_MEM_DISCARDABLE)
- OS << 'n';
+ else
+ OS << 'y';
if (getCharacteristics() & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)
OS << 'd';
+ if (getCharacteristics() & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)
+ OS << 'b';
+ if (getCharacteristics() & COFF::IMAGE_SCN_LNK_REMOVE)
+ OS << 'n';
+ if (getCharacteristics() & COFF::IMAGE_SCN_MEM_SHARED)
+ OS << 's';
OS << '"';
if (getCharacteristics() & COFF::IMAGE_SCN_LNK_COMDAT) {