Loading...
--- dyld/dyld-1122.1/cache_builder/CacheDylib.cpp
+++ dyld/dyld-1162/cache_builder/CacheDylib.cpp
@@ -202,7 +202,7 @@
const CacheDylib& cacheDylib, std::string_view segmentName,
objc_visitor::Visitor& objcVisitor)
{
- // <rdar://problem/66284631> Don't put __objc_const read-only memory as Swift has method lists we can't see
+ // rdar://113642480 (Swift has some mutable data in __objc_const)
__block bool isBadSwiftLibrary = false;
cacheDylib.inputMF->withFileLayout(diag, ^(const mach_o::Layout &layout) {
if ( !layout.isSwiftLibrary() )
@@ -2164,9 +2164,18 @@
if ( objcClass.getMethodCachePropertiesVMAddr(objcVisitor).has_value() )
return;
+ MachOFile::PointerMetaData PMD;
+ if ( config.layout.hasAuthRegion && (objcIMPCachesOptimizer.libobjcImpCachesVersion >= 4) ) {
+ PMD.diversity = 0x9cff; // hash of "originalPreoptCache"
+ PMD.high8 = 0;
+ PMD.authenticated = 1;
+ PMD.key = 2; // DA
+ PMD.usesAddrDiversity = 1;
+ }
+
// Set the "vtable" to point to the cache
CacheVMAddress impCacheVMAddr = objcIMPCachesOptimizer.impCachesChunk->cacheVMAddress + impCacheOffset;
- objcClass.setMethodCachePropertiesVMAddr(objcVisitor, VMAddress(impCacheVMAddr.rawValue()));
+ objcClass.setMethodCachePropertiesVMAddr(objcVisitor, VMAddress(impCacheVMAddr.rawValue()), PMD);
// Tell the slide info emitter to slide this location
metadata_visitor::ResolvedValue vtableField = objcClass.getMethodCachePropertiesField(objcVisitor);