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

David Majnemer david.majnemer at gmail.com
Wed Aug 7 17:43:59 PDT 2013


Hi rnk, timurrrr, ruiu,

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.

http://llvm-reviews.chandlerc.com/D1318

Files:
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  test/MC/COFF/rdata.ll

Index: lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -776,6 +776,9 @@
   if (Kind.isThreadLocal())
     return getTLSDataSection();
 
+  if (Kind.isReadOnly() && ReadOnlySection != 0)
+    return ReadOnlySection;
+
   return getDataSection();
 }
 
Index: test/MC/COFF/rdata.ll
===================================================================
--- /dev/null
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1318.1.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130807/ae0ef5a0/attachment.bin>


More information about the llvm-commits mailing list