diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 7d9382e5233..cf70ad6a2ec 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -776,6 +776,9 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, if (Kind.isThreadLocal()) return getTLSDataSection(); + if (Kind.isReadOnly() && ReadOnlySection != 0) + return ReadOnlySection; + return getDataSection(); } diff --git a/test/MC/COFF/rdata.ll b/test/MC/COFF/rdata.ll new file mode 100644 index 00000000000..f0417811704 --- /dev/null +++ b/test/MC/COFF/rdata.ll @@ -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