Loading...
--- dyld/dyld-655.1.1/dyld3/libdyldEntryVector.cpp
+++ dyld/dyld-750.5/dyld3/libdyldEntryVector.cpp
@@ -22,8 +22,9 @@
*/
#include <stdarg.h>
+#include <mach-o/dyld_priv.h>
+#include <mach-o/dyld_images.h>
-#include "dyld_priv.h"
#include "libdyldEntryVector.h"
#include "AllImages.h"
#include "Array.h"
@@ -92,25 +93,25 @@
}
static void entry_setNotifyMonitoringDyldMain(void (*notifyMonitoringDyldMain)()) {
+#if !TARGET_OS_DRIVERKIT
setNotifyMonitoringDyldMain(notifyMonitoringDyldMain);
+#endif
}
static void entry_setNotifyMonitoringDyld(void (*notifyMonitoringDyld)(bool unloading,unsigned imageCount,
const struct mach_header* loadAddresses[],
const char* imagePaths[])) {
+#if !TARGET_OS_DRIVERKIT
setNotifyMonitoringDyld(notifyMonitoringDyld);
+#endif
}
static void entry_setInitialImageList(const closure::LaunchClosure* closure,
const DyldSharedCache* dyldCacheLoadAddress, const char* dyldCachePath,
- const Array<LoadedImage>& initialImages, const LoadedImage& libSystem)
+ const Array<LoadedImage>& initialImages, LoadedImage& libSystem)
{
gAllImages.init(closure, dyldCacheLoadAddress, dyldCachePath, initialImages);
gAllImages.applyInterposingToDyldCache(closure);
-
- const char* mainPath = _simple_getenv(appleParams, "executable_path");
- if ( (mainPath != nullptr) && (mainPath[0] == '/') )
- gAllImages.setMainPath(mainPath);
// run initializer for libSytem.B.dylib
// this calls back into _dyld_initializer which calls gAllIimages.addImages()
@@ -123,7 +124,9 @@
static void entry_runInitialzersBottomUp(const mach_header* mainExecutableImageLoadAddress)
{
gAllImages.runStartupInitialzers();
+#if !TARGET_OS_DRIVERKIT
gAllImages.notifyMonitorMain();
+#endif
}
static void entry_setChildForkFunction(void (*func)() )
@@ -131,10 +134,26 @@
sChildForkFunction = func;
}
-static void entry_setRestrictions(bool allowAtPaths, bool allowEnvPaths)
+static void entry_setRestrictions(bool allowAtPaths, bool allowEnvPaths, bool allowFallbackPaths)
{
gAllImages.setRestrictions(allowAtPaths, allowEnvPaths);
+ closure::gPathOverrides.setFallbackPathHandling(allowFallbackPaths ?
+ dyld3::closure::PathOverrides::FallbackPathMode::classic :
+ dyld3::closure::PathOverrides::FallbackPathMode::restricted);
}
+
+static void entry_setHasCacheOverrides(bool someCacheImageOverriden)
+{
+ gAllImages.setHasCacheOverrides(someCacheImageOverriden);
+}
+
+
+static void entry_setProgramVars(ProgramVars* progVars)
+{
+ gAllImages.setProgramVars((AllImages::ProgramVars*)progVars);
+}
+
+static_assert((closure::kFormatVersion & LibDyldEntryVector::kBinaryFormatVersionMask) == closure::kFormatVersion, "binary format version overflow");
const LibDyldEntryVector entryVectorForDyld = {
LibDyldEntryVector::kCurrentVectorVersion,
@@ -149,12 +168,28 @@
&entry_setLogFunction,
&entry_setRestrictions,
&entry_setNotifyMonitoringDyldMain,
- &entry_setNotifyMonitoringDyld
+ &entry_setNotifyMonitoringDyld,
+ &entry_setHasCacheOverrides,
+ &entry_setProgramVars,
};
+
+VIS_HIDDEN void _dyld_atfork_prepare()
+{
+ gAllImages.takeLockBeforeFork();
+}
+
+VIS_HIDDEN void _dyld_atfork_parent()
+{
+ gAllImages.releaseLockInForkParent();
+}
VIS_HIDDEN void _dyld_fork_child()
{
+ // Note the child fork function updates the data structures inside dyld
(*sChildForkFunction)();
+
+ // And we then need to update the structures for dyld3 in libdyld
+ gAllImages.resetLockInForkChild();
}