dyld_priv.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*-
  2. *
  3. * Copyright (c) 2003-2010 Apple Inc. All rights reserved.
  4. *
  5. * @APPLE_LICENSE_HEADER_START@
  6. *
  7. * This file contains Original Code and/or Modifications of Original Code
  8. * as defined in and that are subject to the Apple Public Source License
  9. * Version 2.0 (the 'License'). You may not use this file except in
  10. * compliance with the License. Please obtain a copy of the License at
  11. * http://www.opensource.apple.com/apsl/ and read it before using this
  12. * file.
  13. *
  14. * The Original Code and all software distributed under the License are
  15. * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  16. * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  17. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  19. * Please see the License for the specific language governing rights and
  20. * limitations under the License.
  21. *
  22. * @APPLE_LICENSE_HEADER_END@
  23. */
  24. #ifndef _MACH_O_DYLD_PRIV_H_
  25. #define _MACH_O_DYLD_PRIV_H_
  26. #include <assert.h>
  27. #include <stdbool.h>
  28. #include <unistd.h>
  29. #include <Availability.h>
  30. #include <TargetConditionals.h>
  31. #include <mach-o/dyld.h>
  32. #include <uuid/uuid.h>
  33. #if __cplusplus
  34. extern "C" {
  35. #endif /* __cplusplus */
  36. #define DYLD_MACOSX_VERSION_10_11 0x000A0B00
  37. #define DYLD_MACOSX_VERSION_10_12 0x000A0C00
  38. #define DYLD_MACOSX_VERSION_10_13 0x000A0D00
  39. #define DYLD_MACOSX_VERSION_10_14 0x000A0E00
  40. //
  41. // private interface between libSystem.dylib and dyld
  42. //
  43. extern void _dyld_atfork_prepare(void);
  44. extern void _dyld_atfork_parent(void);
  45. extern void _dyld_fork_child(void);
  46. typedef void (*_dyld_objc_notify_mapped)(unsigned count, const char* const paths[], const struct mach_header* const mh[]);
  47. typedef void (*_dyld_objc_notify_init)(const char* path, const struct mach_header* mh);
  48. typedef void (*_dyld_objc_notify_unmapped)(const char* path, const struct mach_header* mh);
  49. //
  50. // Note: only for use by objc runtime
  51. // Register handlers to be called when objc images are mapped, unmapped, and initialized.
  52. // Dyld will call back the "mapped" function with an array of images that contain an objc-image-info section.
  53. // Those images that are dylibs will have the ref-counts automatically bumped, so objc will no longer need to
  54. // call dlopen() on them to keep them from being unloaded. During the call to _dyld_objc_notify_register(),
  55. // dyld will call the "mapped" function with already loaded objc images. During any later dlopen() call,
  56. // dyld will also call the "mapped" function. Dyld will call the "init" function when dyld would be called
  57. // initializers in that image. This is when objc calls any +load methods in that image.
  58. //
  59. void _dyld_objc_notify_register(_dyld_objc_notify_mapped mapped,
  60. _dyld_objc_notify_init init,
  61. _dyld_objc_notify_unmapped unmapped);
  62. //
  63. // get slide for a given loaded mach_header
  64. // Mac OS X 10.6 and later
  65. //
  66. extern intptr_t _dyld_get_image_slide(const struct mach_header* mh);
  67. struct dyld_unwind_sections
  68. {
  69. const struct mach_header* mh;
  70. const void* dwarf_section;
  71. uintptr_t dwarf_section_length;
  72. const void* compact_unwind_section;
  73. uintptr_t compact_unwind_section_length;
  74. };
  75. //
  76. // Returns true iff some loaded mach-o image contains "addr".
  77. // info->mh mach header of image containing addr
  78. // info->dwarf_section pointer to start of __TEXT/__eh_frame section
  79. // info->dwarf_section_length length of __TEXT/__eh_frame section
  80. // info->compact_unwind_section pointer to start of __TEXT/__unwind_info section
  81. // info->compact_unwind_section_length length of __TEXT/__unwind_info section
  82. //
  83. // Exists in Mac OS X 10.6 and later
  84. #if !__USING_SJLJ_EXCEPTIONS__
  85. extern bool _dyld_find_unwind_sections(void* addr, struct dyld_unwind_sections* info);
  86. #endif
  87. //
  88. // This is an optimized form of dladdr() that only returns the dli_fname field.
  89. //
  90. // Exists in Mac OS X 10.6 and later
  91. extern const char* dyld_image_path_containing_address(const void* addr);
  92. //
  93. // This is an optimized form of dladdr() that only returns the dli_fbase field.
  94. // Return NULL, if address is not in any image tracked by dyld.
  95. //
  96. // Exists in Mac OS X 10.11 and later
  97. extern const struct mach_header* dyld_image_header_containing_address(const void* addr);
  98. typedef uint32_t dyld_platform_t;
  99. typedef struct {
  100. dyld_platform_t platform;
  101. uint32_t version;
  102. } dyld_build_version_t;
  103. // Returns the active platform of the process
  104. // extern dyld_platform_t dyld_get_active_platform(void) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  105. extern dyld_platform_t dyld_get_active_platform(void) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  106. // Base platforms are platforms that have version numbers (macOS, iOS, watchos, tvOS, bridgeOS)
  107. // All other platforms are mapped to a base platform for version checks
  108. // extern dyld_platform_t dyld_get_base_platform(dyld_platform_t platform) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  109. extern dyld_platform_t dyld_get_base_platform(dyld_platform_t platform) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  110. // SPI to ask if a platform is a simulation platform
  111. // extern bool dyld_is_simulator_platform(dyld_platform_t platform) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  112. extern bool dyld_is_simulator_platform(dyld_platform_t platform) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  113. // Takes a version and returns if the image was built againt that SDK or newer
  114. // In the case of multi_plaform mach-o's it tests against the active platform
  115. // extern bool dyld_sdk_at_least(const struct mach_header* mh, dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  116. extern bool dyld_sdk_at_least(const struct mach_header* mh, dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  117. // Takes a version and returns if the image was built with that minos version or newer
  118. // In the case of multi_plaform mach-o's it tests against the active platform
  119. // extern bool dyld_minos_at_least(const struct mach_header* mh, dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  120. extern bool dyld_minos_at_least(const struct mach_header* mh, dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  121. // Convenience versions of the previous two functions that run against the the main executable
  122. // extern bool dyld_program_sdk_at_least(dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  123. extern bool dyld_program_sdk_at_least(dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  124. // extern bool dyld_program_minos_at_least(dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  125. extern bool dyld_program_minos_at_least(dyld_build_version_t version) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  126. // Function that walks through the load commands and calls the internal block for every version found
  127. // Intended as a fallback for very complex (and rare) version checks, or for tools that need to
  128. // print our everything for diagnostic reasons
  129. // extern void dyld_get_image_versions(const struct mach_header* mh, void (^callback)(dyld_platform_t platform, uint32_t sdk_version, uint32_t min_version)) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0), bridgeos(3.0));
  130. extern void dyld_get_image_versions(const struct mach_header* mh, void (^callback)(dyld_platform_t platform, uint32_t sdk_version, uint32_t min_version)) __API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
  131. // Convienence constants for dyld version SPIs.
  132. //@VERSION_SET_DEFS@
  133. //@MACOS_PLATFORM_VERSION_DEFS@
  134. //@IOS_PLATFORM_VERSION_DEFS@
  135. //@WATCHOS_PLATFORM_VERSION_DEFS@
  136. //@TVOS_PLATFORM_VERSION_DEFS@
  137. //@BRIDGEOS_PLATFORM_VERSION_DEFS@
  138. // Convienence constants for return values from dyld_get_sdk_version() and friends.
  139. //@MAC_VERSION_DEFS@
  140. //@IOS_VERSION_DEFS@
  141. //@WATCHOS_VERSION_DEFS@
  142. //@TVOS_VERSION_DEFS@
  143. //@BRIDGEOS_VERSION_DEFS@
  144. //
  145. // This finds the SDK version a binary was built against.
  146. // Returns zero on error, or if SDK version could not be determined.
  147. //
  148. // Exists in Mac OS X 10.8 and later
  149. // Exists in iOS 6.0 and later
  150. extern uint32_t dyld_get_sdk_version(const struct mach_header* mh);
  151. //
  152. // This finds the SDK version that the main executable was built against.
  153. // Returns zero on error, or if SDK version could not be determined.
  154. //
  155. // Note on watchOS, this returns the equivalent iOS SDK version number
  156. // (i.e an app built against watchOS 2.0 SDK returne 9.0). To see the
  157. // platform specific sdk version use dyld_get_program_sdk_watch_os_version().
  158. //
  159. // Exists in Mac OS X 10.8 and later
  160. // Exists in iOS 6.0 and later
  161. extern uint32_t dyld_get_program_sdk_version(void);
  162. #if TARGET_OS_WATCH
  163. // watchOS only.
  164. // This finds the Watch OS SDK version that the main executable was built against.
  165. // Exists in Watch OS 2.0 and later
  166. extern uint32_t dyld_get_program_sdk_watch_os_version(void) __API_AVAILABLE(watchos(2.0));
  167. // watchOS only.
  168. // This finds the Watch min OS version that the main executable was built to run on.
  169. // Note: dyld_get_program_min_os_version() returns the iOS equivalent (e.g. 9.0)
  170. // whereas this returns the raw watchOS version (e.g. 2.0).
  171. // Exists in Watch OS 3.0 and later
  172. extern uint32_t dyld_get_program_min_watch_os_version(void) __API_AVAILABLE(watchos(3.0));
  173. #endif
  174. #if TARGET_OS_BRIDGE
  175. // bridgeOS only.
  176. // This finds the bridgeOS SDK version that the main executable was built against.
  177. // Exists in bridgeOSOS 2.0 and later
  178. extern uint32_t dyld_get_program_sdk_bridge_os_version(void) __API_AVAILABLE(bridgeos(2.0));
  179. // bridgeOS only.
  180. // This finds the Watch min OS version that the main executable was built to run on.
  181. // Note: dyld_get_program_min_os_version() returns the iOS equivalent (e.g. 9.0)
  182. // whereas this returns the raw bridgeOS version (e.g. 2.0).
  183. // Exists in bridgeOS 2.0 and later
  184. extern uint32_t dyld_get_program_min_bridge_os_version(void) __API_AVAILABLE(bridgeos(2.0));
  185. #endif
  186. //
  187. // This finds the min OS version a binary was built to run on.
  188. // Returns zero on error, or if no min OS recorded in binary.
  189. //
  190. // Exists in Mac OS X 10.8 and later
  191. // Exists in iOS 6.0 and later
  192. extern uint32_t dyld_get_min_os_version(const struct mach_header* mh);
  193. //
  194. // This finds the min OS version the main executable was built to run on.
  195. // Returns zero on error, or if no min OS recorded in binary.
  196. //
  197. // Exists in Mac OS X 10.8 and later
  198. // Exists in iOS 6.0 and later
  199. extern uint32_t dyld_get_program_min_os_version(void);
  200. //
  201. // Returns if any OS dylib has overridden its copy in the shared cache
  202. //
  203. // Exists in iPhoneOS 3.1 and later
  204. // Exists in Mac OS X 10.10 and later
  205. extern bool dyld_shared_cache_some_image_overridden(void);
  206. //
  207. // Returns if the process is setuid or is code signed with entitlements.
  208. //
  209. // Exists in Mac OS X 10.9 and later
  210. extern bool dyld_process_is_restricted(void);
  211. //
  212. // Returns path used by dyld for standard dyld shared cache file for the current arch.
  213. //
  214. // Exists in Mac OS X 10.11 and later
  215. extern const char* dyld_shared_cache_file_path(void);
  216. //
  217. // Returns if there are any inserted (via DYLD_INSERT_LIBRARIES) or interposing libraries.
  218. //
  219. // Exists in Mac OS X 10.15 and later
  220. extern bool dyld_has_inserted_or_interposing_libraries(void);
  221. //
  222. // <rdar://problem/13820686> for OpenGL to tell dyld it is ok to deallocate a memory based image when done.
  223. //
  224. // Exists in Mac OS X 10.9 and later
  225. #define NSLINKMODULE_OPTION_CAN_UNLOAD 0x20
  226. //
  227. // Update all bindings on specified image.
  228. // Looks for uses of 'replacement' and changes it to 'replacee'.
  229. // NOTE: this is less safe than using static interposing via DYLD_INSERT_LIBRARIES
  230. // because the running program may have already copy the pointer values to other
  231. // locations that dyld does not know about.
  232. //
  233. struct dyld_interpose_tuple {
  234. const void* replacement;
  235. const void* replacee;
  236. };
  237. extern void dyld_dynamic_interpose(const struct mach_header* mh, const struct dyld_interpose_tuple array[], size_t count);
  238. struct dyld_shared_cache_dylib_text_info {
  239. uint64_t version; // current version 1
  240. // following fields all exist in version 1
  241. uint64_t loadAddressUnslid;
  242. uint64_t textSegmentSize;
  243. uuid_t dylibUuid;
  244. const char* path; // pointer invalid at end of iterations
  245. // following fields all exist in version 2
  246. uint64_t textSegmentOffset; // offset from start of cache
  247. };
  248. typedef struct dyld_shared_cache_dylib_text_info dyld_shared_cache_dylib_text_info;
  249. #ifdef __BLOCKS__
  250. //
  251. // Given the UUID of a dyld shared cache file, this function will attempt to locate the cache
  252. // file and if found iterate all images, returning info about each one. Returns 0 on success.
  253. //
  254. // Exists in Mac OS X 10.11 and later
  255. // iOS 9.0 and later
  256. extern int dyld_shared_cache_iterate_text(const uuid_t cacheUuid, void (^callback)(const dyld_shared_cache_dylib_text_info* info));
  257. //
  258. // Given the UUID of a dyld shared cache file, and a NULL terminated array of extra directory paths to search,
  259. // this function will scan the standard and extra directories looking for a cache file that matches the UUID
  260. // and if found iterate all images, returning info about each one. Returns 0 on success.
  261. //
  262. // Exists in Mac OS X 10.12 and later
  263. // iOS 10.0 and later
  264. extern int dyld_shared_cache_find_iterate_text(const uuid_t cacheUuid, const char* extraSearchDirs[], void (^callback)(const dyld_shared_cache_dylib_text_info* info));
  265. #endif /* __BLOCKS */
  266. //
  267. // Returns if the specified address range is in a dyld owned memory
  268. // that is mapped read-only and will never be unloaded.
  269. //
  270. // Exists in Mac OS X 10.12 and later
  271. // iOS 10.0 and later
  272. extern bool _dyld_is_memory_immutable(const void* addr, size_t length);
  273. //
  274. // Finds the UUID (from LC_UUID load command) of given image.
  275. // Returns false if LC_UUID is missing or mach_header is malformed.
  276. //
  277. // Exists in Mac OS X 10.12 and later
  278. // Exists in iOS 10.0 and later
  279. extern bool _dyld_get_image_uuid(const struct mach_header* mh, uuid_t uuid);
  280. //
  281. // Gets the UUID of the dyld shared cache in the current process.
  282. // Returns false if there is no dyld shared cache in use by the processes.
  283. //
  284. // Exists in Mac OS X 10.12 and later
  285. // Exists in iOS 10.0 and later
  286. extern bool _dyld_get_shared_cache_uuid(uuid_t uuid);
  287. //
  288. // Returns the start address of the dyld cache in the process and sets length to the size of the cache.
  289. // Returns NULL if the process is not using a dyld shared cache
  290. //
  291. // Exists in Mac OS X 10.13 and later
  292. // Exists in iOS 11.0 and later
  293. extern const void* _dyld_get_shared_cache_range(size_t* length);
  294. //
  295. // Returns if the currently active dyld shared cache is optimized.
  296. // Note: macOS does not use optimized caches and will always return false.
  297. //
  298. // Exists in Mac OS X 10.15 and later
  299. // Exists in iOS 13.0 and later
  300. extern bool _dyld_shared_cache_optimized(void);
  301. //
  302. // Returns if the currently active dyld shared cache was built locally.
  303. //
  304. // Exists in Mac OS X 10.15 and later
  305. // Exists in iOS 13.0 and later
  306. extern bool _dyld_shared_cache_is_locally_built(void);
  307. //
  308. // Returns if the given app needs a closure built.
  309. //
  310. // Exists in Mac OS X 10.15 and later
  311. // Exists in iOS 13.0 and later
  312. extern bool dyld_need_closure(const char* execPath, const char* tempDir);
  313. struct dyld_image_uuid_offset {
  314. uuid_t uuid;
  315. uint64_t offsetInImage;
  316. const struct mach_header* image;
  317. };
  318. //
  319. // Given an array of addresses, returns info about each address.
  320. // Common usage is the array or addresses was produced by a stack backtrace.
  321. // For each address, returns the where that image was loaded, the offset
  322. // of the address in the image, and the image's uuid. If a specified
  323. // address is unknown to dyld, all fields will be returned a zeros.
  324. //
  325. // Exists in macOS 10.14 and later
  326. // Exists in iOS 12.0 and later
  327. extern void _dyld_images_for_addresses(unsigned count, const void* addresses[], struct dyld_image_uuid_offset infos[]);
  328. //
  329. // Lets you register a callback which is called each time an image is loaded and provides the mach_header*, path, and
  330. // whether the image may be unloaded later. During the call to _dyld_register_for_image_loads(), the callback is called
  331. // once for each image currently loaded.
  332. //
  333. // Exists in macOS 10.14 and later
  334. // Exists in iOS 12.0 and later
  335. extern void _dyld_register_for_image_loads(void (*func)(const struct mach_header* mh, const char* path, bool unloadable));
  336. //
  337. // Lets you register a callback which is called for bulk notifications of images loaded. During the call to
  338. // _dyld_register_for_bulk_image_loads(), the callback is called once with all images currently loaded.
  339. // Then later during dlopen() the callback is called once with all newly images.
  340. //
  341. // Exists in macOS 10.15 and later
  342. // Exists in iOS 13.0 and later
  343. extern void _dyld_register_for_bulk_image_loads(void (*func)(unsigned imageCount, const struct mach_header* mhs[], const char* paths[]));
  344. //
  345. // DriverKit main executables do not have an LC_MAIN. Instead DriverKit.framework's initializer calls
  346. // _dyld_register_driverkit_main() with a function pointer that dyld should call into instead
  347. // of using LC_MAIN.
  348. //
  349. extern void _dyld_register_driverkit_main(void (*mainFunc)(void));
  350. //
  351. // When dyld must terminate a process because of a required dependent dylib
  352. // could not be loaded or a symbol is missing, dyld calls abort_with_reason()
  353. // using one of the following error codes.
  354. //
  355. #define DYLD_EXIT_REASON_DYLIB_MISSING 1
  356. #define DYLD_EXIT_REASON_DYLIB_WRONG_ARCH 2
  357. #define DYLD_EXIT_REASON_DYLIB_WRONG_VERSION 3
  358. #define DYLD_EXIT_REASON_SYMBOL_MISSING 4
  359. #define DYLD_EXIT_REASON_CODE_SIGNATURE 5
  360. #define DYLD_EXIT_REASON_FILE_SYSTEM_SANDBOX 6
  361. #define DYLD_EXIT_REASON_MALFORMED_MACHO 7
  362. #define DYLD_EXIT_REASON_OTHER 9
  363. //
  364. // When it has more information about the termination, dyld will use abort_with_payload().
  365. // The payload is a dyld_abort_payload structure. The fixed fields are offsets into the
  366. // payload for the corresponding string. If the offset is zero, that string is not available.
  367. //
  368. struct dyld_abort_payload {
  369. uint32_t version; // first version is 1
  370. uint32_t flags; // 0x00000001 means dyld terminated at launch, backtrace not useful
  371. uint32_t targetDylibPathOffset; // offset in payload of path string to dylib that could not be loaded
  372. uint32_t clientPathOffset; // offset in payload of path string to image requesting dylib
  373. uint32_t symbolOffset; // offset in payload of symbol string that could not be found
  374. // string data
  375. };
  376. typedef struct dyld_abort_payload dyld_abort_payload;
  377. // These global variables are implemented in libdyld.dylib
  378. // Old programs that used crt1.o also defined these globals.
  379. // The ones in dyld are not used when an old program is run.
  380. extern int NXArgc;
  381. extern const char** NXArgv;
  382. extern char** environ; // POSIX says this not const, because it pre-dates const
  383. extern const char* __progname;
  384. // called by libSystem_initializer only
  385. extern void _dyld_initializer(void);
  386. // never called from source code. Used by static linker to implement lazy binding
  387. extern void dyld_stub_binder(void) __asm__("dyld_stub_binder");
  388. // never call from source code. Used by closure builder to bind missing lazy symbols to
  389. extern void _dyld_missing_symbol_abort(void);
  390. // Called only by objc to see if dyld has uniqued this selector.
  391. // Returns the value if dyld has uniqued it, or nullptr if it has not.
  392. // Note, this function must be called after _dyld_objc_notify_register.
  393. //
  394. // Exists in Mac OS X 10.15 and later
  395. // Exists in iOS 13.0 and later
  396. extern const char* _dyld_get_objc_selector(const char* selName);
  397. // Called only by objc to see if dyld has pre-optimized classes with this name.
  398. // The callback will be called once for each class with the given name where
  399. // isLoaded is true if that class is in a binary which has been previously passed
  400. // to the objc load notifier.
  401. // Note you can set stop to true to stop iterating.
  402. // Also note, this function must be called after _dyld_objc_notify_register.
  403. //
  404. // Exists in Mac OS X 10.15 and later
  405. // Exists in iOS 13.0 and later
  406. extern void _dyld_for_each_objc_class(const char* className,
  407. void (^callback)(void* classPtr, bool isLoaded, bool* stop));
  408. // Called only by objc to see if dyld has pre-optimized protocols with this name.
  409. // The callback will be called once for each protocol with the given name where
  410. // isLoaded is true if that protocol is in a binary which has been previously passed
  411. // to the objc load notifier.
  412. // Note you can set stop to true to stop iterating.
  413. // Also note, this function must be called after _dyld_objc_notify_register.
  414. //
  415. // Exists in Mac OS X 10.15 and later
  416. // Exists in iOS 13.0 and later
  417. extern void _dyld_for_each_objc_protocol(const char* protocolName,
  418. void (^callback)(void* protocolPtr, bool isLoaded, bool* stop));
  419. // called by exit() before it calls cxa_finalize() so that thread_local
  420. // objects are destroyed before global objects.
  421. extern void _tlv_exit(void);
  422. // temp exports to keep tapi happy, until ASan stops using dyldVersionNumber
  423. extern double dyldVersionNumber;
  424. extern const char* dyldVersionString;
  425. #if __cplusplus
  426. }
  427. #endif /* __cplusplus */
  428. #endif /* _MACH_O_DYLD_PRIV_H_ */