Merge r65599 into Dib:
Try, again, to send STRING_CSTs to the cstring section. This is a
followup to r65490. Darwin-specific.
llvm-svn: 65617
diff --git a/llvm-gcc-4.2/gcc/config/darwin.h b/llvm-gcc-4.2/gcc/config/darwin.h
index 6e55319..7c67b74 100644
--- a/llvm-gcc-4.2/gcc/config/darwin.h
+++ b/llvm-gcc-4.2/gcc/config/darwin.h
@@ -679,6 +679,8 @@
} while (0)
/* LLVM LOCAL - end radar 6389998 */
+/* Assign STRING_CSTs to the .cstring section. */
+#define LLVM_DARWIN_CSTRING_SECTION "__TEXT,__cstring,cstring_literals"
#endif
/* LLVM LOCAL end */
diff --git a/llvm-gcc-4.2/gcc/llvm-convert.cpp b/llvm-gcc-4.2/gcc/llvm-convert.cpp
index 2dc0c59..8110a78 100644
--- a/llvm-gcc-4.2/gcc/llvm-convert.cpp
+++ b/llvm-gcc-4.2/gcc/llvm-convert.cpp
@@ -7346,6 +7346,11 @@
TAI->getStringConstantPrefix() :
".str", TheModule);
if (SlotP) *SlotP = GV;
+#ifdef LLVM_DARWIN_CSTRING_SECTION
+ // For Darwin, try to put it into the .cstring section.
+ if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr)
+ GV->setSection(LLVM_DARWIN_CSTRING_SECTION);
+#endif
return GV;
}