diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2012-09-23 15:53:47 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2012-09-23 15:53:47 +0000 |
commit | 37d73002d45be2a750974157d6571d39beccc4fd (patch) | |
tree | e173396afc585908fbcf08a0a6cf47820f2d4d5a /llvm/lib/MC/MCObjectFileInfo.cpp | |
parent | e7a1ba5e8b21671a371960828d63520e6c74db4f (diff) | |
download | bcm5719-llvm-37d73002d45be2a750974157d6571d39beccc4fd.tar.gz bcm5719-llvm-37d73002d45be2a750974157d6571d39beccc4fd.zip |
Emit dtors into proper section while compiling in vcpp-compatible mode.
Patch by Kai!
llvm-svn: 164476
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectFileInfo.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 29b4a946535..8053624831b 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/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 |