Revert "coff also doesn't have a ReadOnlySection yet, (!)"

This reverts commit r77814.

We were sticking global constants in the .data section instead of in the
.rdata section when emitting for COFF.

This fixes PR16831.

llvm-svn: 187956
This commit is contained in:
David Majnemer 2013-08-08 01:50:52 +00:00
parent 160c346748
commit e90cbda29f
2 changed files with 9 additions and 0 deletions

View File

@ -776,6 +776,9 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
if (Kind.isThreadLocal())
return getTLSDataSection();
if (Kind.isReadOnly() && ReadOnlySection != 0)
return ReadOnlySection;
return getDataSection();
}

6
test/MC/COFF/rdata.ll Normal file
View File

@ -0,0 +1,6 @@
; RUN: llc -mtriple i386-pc-win32 < %s | FileCheck %s
%struct.foo = type { i32, i32 }
@"\01?thingy@@3Ufoo@@B" = constant %struct.foo zeroinitializer, align 4
; CHECK: .section .rdata