forked from OSchip/llvm-project
[-cxx-abi microsoft] Stick zero initialized symbols into the .bss section for COFF
Summary: We need to do two things: - Initialize BSSSection in MCObjectFileInfo::InitCOFFMCObjectFileInfo - Teach TargetLoweringObjectFileCOFF::SelectSectionForGlobal what to do with it This fixes PR16861. Reviewers: rnk Reviewed By: rnk CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1361 llvm-svn: 188244
This commit is contained in:
parent
d29614f98d
commit
3d96acb735
|
@ -771,15 +771,18 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||
}
|
||||
|
||||
if (Kind.isText())
|
||||
return getTextSection();
|
||||
return TextSection;
|
||||
|
||||
if (Kind.isThreadLocal())
|
||||
return getTLSDataSection();
|
||||
return TLSDataSection;
|
||||
|
||||
if (Kind.isReadOnly() && ReadOnlySection != 0)
|
||||
if (Kind.isReadOnly())
|
||||
return ReadOnlySection;
|
||||
|
||||
return getDataSection();
|
||||
if (Kind.isBSS())
|
||||
return BSSSection;
|
||||
|
||||
return DataSection;
|
||||
}
|
||||
|
||||
void TargetLoweringObjectFileCOFF::
|
||||
|
|
|
@ -496,6 +496,12 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
|
|||
|
||||
void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
|
||||
// COFF
|
||||
BSSSection =
|
||||
Ctx->getCOFFSection(".bss",
|
||||
COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
|
||||
COFF::IMAGE_SCN_MEM_READ |
|
||||
COFF::IMAGE_SCN_MEM_WRITE,
|
||||
SectionKind::getBSS());
|
||||
TextSection =
|
||||
Ctx->getCOFFSection(".text",
|
||||
COFF::IMAGE_SCN_CNT_CODE |
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
; RUN: llc -mtriple i386-pc-win32 < %s | FileCheck %s
|
||||
|
||||
%struct.foo = type { i32, i32 }
|
||||
|
||||
@"\01?thingy@@3Ufoo@@B" = global %struct.foo zeroinitializer, align 4
|
||||
; CHECK: .bss
|
Loading…
Reference in New Issue