From ec951e0c2fc0db00c36bc60c900331dde32c1b43 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 23 Apr 2010 22:33:39 +0000 Subject: More -fno-constant-cfstrings API work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102219 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index ee02e9374e..599df96723 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1610,12 +1610,14 @@ CodeGenModule::GetAddrOfConstantNSString(const StringLiteral *Literal) { llvm::Constant::getNullValue(llvm::Type::getInt32Ty(VMContext)); llvm::Constant *Zeros[] = { Zero, Zero }; - // If we don't already have it, get __NSConstantStringClassReference. + // If we don't already have it, get _NSConstantStringClassReference. if (!NSConstantStringClassRef) { const llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy); Ty = llvm::ArrayType::get(Ty, 0); - llvm::Constant *GV = CreateRuntimeVariable(Ty, - "__NSConstantStringClassReference"); + llvm::Constant *GV = CreateRuntimeVariable(Ty, + Features.ObjCNonFragileABI ? + "OBJC_CLASS_$_NSConstantString" : + "_NSConstantStringClassReference"); // Decay array -> ptr NSConstantStringClassRef = llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2); @@ -1666,7 +1668,10 @@ CodeGenModule::GetAddrOfConstantNSString(const StringLiteral *Literal) { llvm::GlobalVariable::PrivateLinkage, C, "_unnamed_nsstring_"); // FIXME. Fix section. - if (const char *Sect = getContext().Target.getNSStringSection()) + if (const char *Sect = + Features.ObjCNonFragileABI + ? getContext().Target.getNSStringNonFragileABISection() + : getContext().Target.getNSStringSection()) GV->setSection(Sect); Entry.setValue(GV); -- cgit v1.2.3-70-g09d2