From 0c67829763b98bc670062b553897a851fab17401 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 1 Nov 2007 00:41:52 +0000 Subject: Put constant CFStrings in the __DATA,__cfstring section. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43593 91177308-0d34-0410-b5e6-96231b3b80d8 --- CodeGen/CodeGenModule.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'CodeGen/CodeGenModule.cpp') diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp index a2023e441f..6faf3f88d7 100644 --- a/CodeGen/CodeGenModule.cpp +++ b/CodeGen/CodeGenModule.cpp @@ -247,10 +247,11 @@ GetAddrOfConstantCFString(const std::string &str) { // The struct. Ty = getTypes().ConvertType(getContext().getCFConstantStringType()); C = llvm::ConstantStruct::get(cast(Ty), Fields); - C = new llvm::GlobalVariable(C->getType(), true, - llvm::GlobalVariable::InternalLinkage, - C, "", &getModule()); - - Entry.setValue(C); - return C; + llvm::GlobalVariable *GV = + new llvm::GlobalVariable(C->getType(), true, + llvm::GlobalVariable::InternalLinkage, + C, "", &getModule()); + GV->setSection("__DATA,__cfstring"); + Entry.setValue(GV); + return GV; } -- cgit v1.2.3-70-g09d2