[llvm] r187956 - Revert "coff also doesn't have a ReadOnlySection yet, (!)"

David Majnemer david.majnemer at gmail.com
Wed Aug 7 18:50:52 PDT 2013


Author: majnemer
Date: Wed Aug  7 20:50:52 2013
New Revision: 187956

URL: http://llvm.org/viewvc/llvm-project?rev=187956&view=rev
Log:
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.

Added:
    llvm/trunk/test/MC/COFF/rdata.ll
Modified:
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=187956&r1=187955&r2=187956&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Wed Aug  7 20:50:52 2013
@@ -776,6 +776,9 @@ SelectSectionForGlobal(const GlobalValue
   if (Kind.isThreadLocal())
     return getTLSDataSection();
 
+  if (Kind.isReadOnly() && ReadOnlySection != 0)
+    return ReadOnlySection;
+
   return getDataSection();
 }
 

Added: llvm/trunk/test/MC/COFF/rdata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/rdata.ll?rev=187956&view=auto
==============================================================================
--- llvm/trunk/test/MC/COFF/rdata.ll (added)
+++ llvm/trunk/test/MC/COFF/rdata.ll Wed Aug  7 20:50:52 2013
@@ -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





More information about the llvm-commits mailing list