diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-02-23 21:56:08 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-02-23 21:56:08 +0000 |
commit | 32d22ee11dc03a69ef22b0794e301cd32176019d (patch) | |
tree | 1ce48762c541f04568898942863d8abfdf0ca199 /lib | |
parent | 8ce6b7daf72627fc8bd95e62a7c4a037eaf3772e (diff) | |
download | external_llvm-32d22ee11dc03a69ef22b0794e301cd32176019d.zip external_llvm-32d22ee11dc03a69ef22b0794e301cd32176019d.tar.gz external_llvm-32d22ee11dc03a69ef22b0794e301cd32176019d.tar.bz2 |
Emit global ctors into .CRT$XCU instead of .ctors on Win32. Patch by Joe Groff!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCObjectFileInfo.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp index 1a27df5..7dd06e7 100644 --- a/lib/MC/MCObjectFileInfo.cpp +++ b/lib/MC/MCObjectFileInfo.cpp @@ -409,12 +409,22 @@ void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) { COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ, SectionKind::getReadOnly()); - StaticCtorSection = - Ctx->getCOFFSection(".ctors", - COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | - COFF::IMAGE_SCN_MEM_READ | - COFF::IMAGE_SCN_MEM_WRITE, - SectionKind::getDataRel()); + if (T.getOS() == Triple::Win32) { + StaticCtorSection = + Ctx->getCOFFSection(".CRT$XCU", + COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | + COFF::IMAGE_SCN_MEM_READ, + SectionKind::getReadOnly()); + } else { + StaticCtorSection = + Ctx->getCOFFSection(".ctors", + COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | + COFF::IMAGE_SCN_MEM_READ | + COFF::IMAGE_SCN_MEM_WRITE, + SectionKind::getDataRel()); + } + + StaticDtorSection = Ctx->getCOFFSection(".dtors", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | |