@@ -296,9 +296,10 @@ class ObjCProtocolInitializerVisitor
296
296
// Check if the ObjC runtime already has a descriptor for this
297
297
// protocol. If so, use it.
298
298
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
+
302
303
auto existing = Builder.CreateCall (objc_getProtocol, protocolName);
303
304
auto isNull = Builder.CreateICmpEQ (existing,
304
305
llvm::ConstantPointerNull::get (IGM.ProtocolDescriptorPtrTy ));
@@ -4241,8 +4242,9 @@ getObjCClassByNameReference(IRGenModule &IGM, ClassDecl *cls) {
4241
4242
auto kind = TypeReferenceKind::DirectObjCClassName;
4242
4243
SmallString<64 > objcRuntimeNameBuffer;
4243
4244
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 );
4246
4248
4247
4249
return TypeEntityReference (kind, ref);
4248
4250
}
@@ -4800,7 +4802,7 @@ void IRGenModule::emitAccessibleFunction(StringRef sectionName,
4800
4802
// -- Field: Name (record name)
4801
4803
{
4802
4804
llvm::Constant *name =
4803
- getAddrOfGlobalString (func.getFunctionName (),
4805
+ getAddrOfGlobalString (func.getFunctionName (), /* sectionName= */ " " ,
4804
4806
/* willBeRelativelyAddressed=*/ true );
4805
4807
fields.addRelativeAddress (name);
4806
4808
}
@@ -6023,9 +6025,10 @@ Address IRGenFunction::createAlloca(llvm::Type *type,
6023
6025
// / FIXME: willBeRelativelyAddressed is only needed to work around an ld64 bug
6024
6026
// / resolving relative references to coalesceable symbols.
6025
6027
// / 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) {
6029
6032
useOSLogSection = useOSLogSection &&
6030
6033
TargetInfo.OutputObjectFormat == llvm::Triple::MachO;
6031
6034
@@ -6053,8 +6056,8 @@ llvm::Constant *IRGenModule::getAddrOfGlobalString(StringRef data,
6053
6056
(llvm::Twine (" .nul" ) + llvm::Twine (i)).toVector (name);
6054
6057
}
6055
6058
6056
- auto sectionName =
6057
- useOSLogSection ? " __TEXT,__oslogstring,cstring_literals" : " " ;
6059
+ sectionName =
6060
+ useOSLogSection ? " __TEXT,__oslogstring,cstring_literals" : sectionName ;
6058
6061
6059
6062
entry = createStringConstant (data, willBeRelativelyAddressed,
6060
6063
sectionName, name);
@@ -6067,9 +6070,11 @@ IRGenModule::getAddrOfGlobalIdentifierString(StringRef data,
6067
6070
if (Lexer::identifierMustAlwaysBeEscaped (data)) {
6068
6071
llvm::SmallString<256 > name;
6069
6072
Mangle::Mangler::appendRawIdentifierForRuntime (data, name);
6070
- return getAddrOfGlobalString (name, willBeRelativelyAddressed);
6073
+ return getAddrOfGlobalString (name, /* sectionName=*/ " " ,
6074
+ willBeRelativelyAddressed);
6071
6075
}
6072
- return getAddrOfGlobalString (data, willBeRelativelyAddressed);
6076
+ return getAddrOfGlobalString (data, /* sectionName=*/ " " ,
6077
+ willBeRelativelyAddressed);
6073
6078
}
6074
6079
6075
6080
// / Get or create a global UTF-16 string constant.
0 commit comments