aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2012-09-23 15:53:47 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2012-09-23 15:53:47 +0000
commit371e17c03c3169459c84986d4a318f6d6d3f8730 (patch)
tree672b97bd6f5627bed1be91d50d89ea54aed12774 /lib/MC
parent02e92a0b5dd75514c8489d3f87fe7c5262ca6290 (diff)
downloadexternal_llvm-371e17c03c3169459c84986d4a318f6d6d3f8730.zip
external_llvm-371e17c03c3169459c84986d4a318f6d6d3f8730.tar.gz
external_llvm-371e17c03c3169459c84986d4a318f6d6d3f8730.tar.bz2
Emit dtors into proper section while compiling in vcpp-compatible mode.
Patch by Kai! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCObjectFileInfo.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp
index 29b4a94..8053624 100644
--- a/lib/MC/MCObjectFileInfo.cpp
+++ b/lib/MC/MCObjectFileInfo.cpp
@@ -430,12 +430,20 @@ void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
}
- StaticDtorSection =
- Ctx->getCOFFSection(".dtors",
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
- COFF::IMAGE_SCN_MEM_READ |
- COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ if (T.getOS() == Triple::Win32) {
+ StaticDtorSection =
+ Ctx->getCOFFSection(".CRT$XTX",
+ COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getReadOnly());
+ } else {
+ StaticDtorSection =
+ Ctx->getCOFFSection(".dtors",
+ COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ |
+ COFF::IMAGE_SCN_MEM_WRITE,
+ SectionKind::getDataRel());
+ }
// FIXME: We're emitting LSDA info into a readonly section on COFF, even
// though it contains relocatable pointers. In PIC mode, this is probably a