From 41b7c6b250560d5015defaa5c112f355c2e91664 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. llvm-svn: 43593 --- clang/CodeGen/CodeGenModule.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'clang/CodeGen/CodeGenModule.cpp') diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp index a2023e441ff..6faf3f88d75 100644 --- a/clang/CodeGen/CodeGenModule.cpp +++ b/clang/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