@@ -296,9 +296,10 @@ class ObjCProtocolInitializerVisitor
296296 // Check if the ObjC runtime already has a descriptor for this
297297 // protocol. If so, use it.
298298 SmallString<32 > buf;
299- auto protocolName
300- = IGM.getAddrOfGlobalString (proto->getObjCRuntimeName (buf));
301-
299+ auto protocolName = IGM.getAddrOfGlobalString (
300+ proto->getObjCRuntimeName (buf),
301+ /* sectionName=*/ " __TEXT,__objc_classname,cstring_literals" );
302+
302303 auto existing = Builder.CreateCall (objc_getProtocol, protocolName);
303304 auto isNull = Builder.CreateICmpEQ (existing,
304305 llvm::ConstantPointerNull::get (IGM.ProtocolDescriptorPtrTy ));
@@ -4241,8 +4242,9 @@ getObjCClassByNameReference(IRGenModule &IGM, ClassDecl *cls) {
42414242 auto kind = TypeReferenceKind::DirectObjCClassName;
42424243 SmallString<64 > objcRuntimeNameBuffer;
42434244 auto ref = IGM.getAddrOfGlobalString (
4244- cls->getObjCRuntimeName (objcRuntimeNameBuffer),
4245- /* willBeRelativelyAddressed=*/ true );
4245+ cls->getObjCRuntimeName (objcRuntimeNameBuffer),
4246+ /* sectionName=*/ " __TEXT,__objc_classname,cstring_literals" ,
4247+ /* willBeRelativelyAddressed=*/ true );
42464248
42474249 return TypeEntityReference (kind, ref);
42484250}
@@ -4800,7 +4802,7 @@ void IRGenModule::emitAccessibleFunction(StringRef sectionName,
48004802 // -- Field: Name (record name)
48014803 {
48024804 llvm::Constant *name =
4803- getAddrOfGlobalString (func.getFunctionName (),
4805+ getAddrOfGlobalString (func.getFunctionName (), /* sectionName= */ " " ,
48044806 /* willBeRelativelyAddressed=*/ true );
48054807 fields.addRelativeAddress (name);
48064808 }
@@ -6023,9 +6025,10 @@ Address IRGenFunction::createAlloca(llvm::Type *type,
60236025// / FIXME: willBeRelativelyAddressed is only needed to work around an ld64 bug
60246026// / resolving relative references to coalesceable symbols.
60256027// / It should be removed when fixed. rdar://problem/22674524
6026- llvm::Constant *IRGenModule::getAddrOfGlobalString (StringRef data,
6027- bool willBeRelativelyAddressed,
6028- bool useOSLogSection) {
6028+ llvm::Constant *
6029+ IRGenModule::getAddrOfGlobalString (StringRef data, StringRef sectionName,
6030+ bool willBeRelativelyAddressed,
6031+ bool useOSLogSection) {
60296032 useOSLogSection = useOSLogSection &&
60306033 TargetInfo.OutputObjectFormat == llvm::Triple::MachO;
60316034
@@ -6053,8 +6056,8 @@ llvm::Constant *IRGenModule::getAddrOfGlobalString(StringRef data,
60536056 (llvm::Twine (" .nul" ) + llvm::Twine (i)).toVector (name);
60546057 }
60556058
6056- auto sectionName =
6057- useOSLogSection ? " __TEXT,__oslogstring,cstring_literals" : " " ;
6059+ sectionName =
6060+ useOSLogSection ? " __TEXT,__oslogstring,cstring_literals" : sectionName ;
60586061
60596062 entry = createStringConstant (data, willBeRelativelyAddressed,
60606063 sectionName, name);
@@ -6067,9 +6070,11 @@ IRGenModule::getAddrOfGlobalIdentifierString(StringRef data,
60676070 if (Lexer::identifierMustAlwaysBeEscaped (data)) {
60686071 llvm::SmallString<256 > name;
60696072 Mangle::Mangler::appendRawIdentifierForRuntime (data, name);
6070- return getAddrOfGlobalString (name, willBeRelativelyAddressed);
6073+ return getAddrOfGlobalString (name, /* sectionName=*/ " " ,
6074+ willBeRelativelyAddressed);
60716075 }
6072- return getAddrOfGlobalString (data, willBeRelativelyAddressed);
6076+ return getAddrOfGlobalString (data, /* sectionName=*/ " " ,
6077+ willBeRelativelyAddressed);
60736078}
60746079
60756080// / Get or create a global UTF-16 string constant.
0 commit comments