From: Anders Carlsson Date: Thu, 1 Nov 2007 00:41:52 +0000 (+0000) Subject: Put constant CFStrings in the __DATA,__cfstring section. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c67829763b98bc670062b553897a851fab17401;p=clang 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 --- 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; }