Loading...
common/Defines.h dyld-1340 dyld-960
--- dyld/dyld-1340/common/Defines.h
+++ dyld/dyld-960/common/Defines.h
@@ -22,21 +22,18 @@
 * @APPLE_LICENSE_HEADER_END@
 */
 
-// Centralize convenience macros and configuration options
+// For now just for compact info, but in the long run we can use this to centralize convenience macros and configuration options
 
 #ifndef DYLD_DEFINES_H
 #define DYLD_DEFINES_H
 
-#if __has_include(<AppleFeatures/AppleFeatures.h>)
-#include <AppleFeatures/AppleFeatures.h>
-#endif
-
 #include <TargetConditionals.h>
 
-#ifndef TARGET_OS_EXCLAVEKIT
-//TODO: EXCLAVES remove
-#define TARGET_OS_EXCLAVEKIT 0
-#endif
+#define VIS_HIDDEN __attribute__((visibility("hidden")))
+
+#define TRIVIAL_ABI [[clang::trivial_abi]]
+
+#define SUPPORT_ROSETTA (TARGET_OS_OSX && __x86_64__)
 
 #if TARGET_OS_OSX && defined(__x86_64__)
 #define SUPPPORT_PRE_LC_MAIN (1)
@@ -50,10 +47,6 @@
 
 #ifndef BUILDING_UNIT_TESTS
 #define BUILDING_UNIT_TESTS 0
-#endif
-
-#ifndef BUILDING_ALLOCATOR_UNIT_TESTS
-#define BUILDING_ALLOCATOR_UNIT_TESTS 0
 #endif
 
 #ifndef BUILDING_DYLD
@@ -72,163 +65,11 @@
 #define BUILDING_CACHE_BUILDER 0
 #endif
 
-#define VIS_HIDDEN      __attribute__((visibility("hidden")))
-#define TRIVIAL_ABI     [[clang::trivial_abi]]
-#define NO_DEBUG        [[gnu::nodebug]]
-#define ALWAYS_INLINE   __attribute__((always_inline))
-
-#if __x86_64__
-    #define DYLD_PAGE_SIZE (4096)
+#if !TARGET_OS_DRIVERKIT && (BUILDING_LIBDYLD || BUILDING_DYLD)
+  #include <CrashReporterClient.h>
 #else
-    #define DYLD_PAGE_SIZE (16384)
-#endif
-#define DYLD_PAGE_MASK  (DYLD_PAGE_SIZE-1)
-
-#define SUPPORT_IMAGE_UNLOADING (BUILDING_DYLD && !TARGET_OS_EXCLAVEKIT)
-
-// Rosetta support is defined by whether or not a platform has librosetta_trap
-#define SUPPORT_ROSETTA (__has_include(<Rosetta/Dyld/Traps.h>) && (__x86_64__ || __arm64e__))
-
-
-#define SUPPORT_PRIVATE_EXTERNS_WORKAROUND (BUILDING_DYLD && TARGET_OS_OSX && __x86_64__)
-
-// The cache builder and associated tests don't support MachOAnalyzer or anything assuming
-// VM layout of binaries/caches
-#define SUPPORT_VM_LAYOUT (!BUILDING_CACHE_BUILDER && !BUILDING_CACHE_BUILDER_UNIT_TESTS)
-
-#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-// Host tools can only use introspection APIs starting in macOS 12
-#define SUPPORT_HOST_INTROSPECTION (__MAC_OS_X_VERSION_MIN_REQUIRED >= 120000)
-#else
-// Assume introspection is available when building for native targets
-#define SUPPORT_HOST_INTROSPECTION (1)
-#endif
-
-#define HAS_EXTERNAL_STATE (BUILDING_DYLD)
-
-#define SUPPORT_PREBUILTLOADERS ((BUILDING_DYLD && !TARGET_OS_SIMULATOR && !TARGET_OS_EXCLAVEKIT) || BUILDING_CACHE_BUILDER || BUILDING_CACHE_BUILDER_UNIT_TESTS || BUILDING_CLOSURE_UTIL)
-#define SUPPORT_ON_DISK_PREBUILTLOADERS (SUPPORT_PREBUILTLOADERS && BUILDING_DYLD && !TARGET_OS_OSX)
-#define SUPPORT_CREATING_PREMAPPEDLOADERS (BUILDING_DYLD && TARGET_OS_EXCLAVEKIT)
-
-// Controls the creation of the modern atlas based process informtation
-#define DYLD_FEATURE_ATLAS_GENERATION (BUILDING_DYLD && !(TARGET_OS_SIMULATOR || TARGET_OS_EXCLAVEKIT))
-
-#define DYLD_FEATURE_COMPACT_INFO_GENERATION (BUILDING_DYLD && !(TARGET_OS_SIMULATOR || TARGET_OS_EXCLAVEKIT))
-
-// Controls whether or to update the legacy all image info
-#define DYLD_FEATURE_LEGACY_IMAGE_INFO (BUILDING_DYLD)
-
-// Controls whether or not the breakpoint based notifiers hould be called after image list changes
-#define DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS (BUILDING_DYLD)
-
-// Controls whether or not the mach port base remote notifiers should be called when dyld's state changes
-#define DYLD_FEATURE_MACH_PORT_NOTIFICATIONS (BUILDING_DYLD && !TARGET_OS_SIMULATOR && !TARGET_OS_EXCLAVEKIT)
-
-// Controls whether legacy data carrying mach message notifiers are active
-#define DYLD_FEATURE_LEGACY_MACH_PORT_NOTIFICATIONS (BUILDING_DYLD && !TARGET_OS_SIMULATOR && !TARGET_OS_EXCLAVEKIT)
-
-// Controls whether or not the notifications should be sent through the simulator interfaces to a host dyld
-#define DYLD_FEATURE_SIMULATOR_NOTIFICATIONS (BUILDING_DYLD && TARGET_OS_SIMULATOR)
-
-// Controls whether or not
-#define DYLD_FEATURE_SIMULATOR_NOTIFICATION_HOST_SUPPORT (BUILDING_DYLD && TARGET_OS_OSX && !TARGET_OS_EXCLAVEKIT)
-
-#if __cplusplus
-
-#if DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS
-    static_assert(DYLD_FEATURE_LEGACY_IMAGE_INFO, "DYLD_FEATURE_LEGACY_IMAGE_INFO depends on DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS");
-#endif /* DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS */
-
-#if DYLD_FEATURE_SIMULATOR_NOTIFICATIONS
-    static_assert(DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS, "DYLD_FEATURE_SIMULATOR_NOTIFICATIONS depends on DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS");
-#endif /* DYLD_FEATURE_BREAKPOINT_NOTIFICATIONS */
-
-
-static_assert((DYLD_FEATURE_SIMULATOR_NOTIFICATION_HOST_SUPPORT && DYLD_FEATURE_SIMULATOR_NOTIFICATIONS) == 0,
-              "A single build cannot both send simulator notifications and host simulator notifications");
-
-#endif // __cplusplus
-
-// Default to a 16MB pool for most uses cases, but we want a smaller 256KB pool when:
-// 1. We are building dyld, since most of the time we only allocate 2-3 pages and we can hand pack a bunch of virtual address spacew
-// OR
-// 2. We are running anything on 32 bit hardware where we have limited address space
-#define ALLOCATOR_DEFAULT_POOL_SIZE (128*1024)
-
-// Exclaves does not have access to vm_allocate, but it also use a smaller fixed set of libraries, so dyld can embed a simple page allocator as a replacement
-#if TARGET_OS_EXCLAVEKIT
-#define DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR (1)
-#define DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR_PAGE_COUNT (34)
-#else
-#define DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR (0)
-#endif
-
-#define SUPPORT_CLASSIC_RELOCS (!TARGET_OS_EXCLAVEKIT && (!BUILDING_DYLD || TARGET_OS_OSX) )
-
-#if TARGET_OS_DRIVERKIT || TARGET_OS_EXCLAVEKIT || BUILDING_ALLOCATOR_UNIT_TESTS
-    #define ENABLE_CRASH_REPORTER (0)
-    #define CRSetCrashLogMessage(x)
-    #define CRSetCrashLogMessage2(x)
-#else
-    #define ENABLE_CRASH_REPORTER (1)
-#endif
-
-#define DYLD_FEATURE_USE_INTERNAL_ALLOCATOR (BUILDING_DYLD || BUILDING_ALLOCATOR_UNIT_TESTS)
-
-// Memory accounting support for Jetsam
-#define DYLD_FEATURE_MEMORY_ACCOUNTING (BUILDING_DYLD && (TARGET_OS_IPHONE && !TARGET_OS_EXCLAVEKIT && !TARGET_OS_SIMULATOR))
-
-#define ALLOCATOR_LOGGING_ENABLED (0)
-#define ALLOCATOR_MAKE_TRACE (0)
-
-#if defined(DEBUG) && DEBUG
-#define contract assert
-#define ALLOCATOR_VALIDATION    (0)
-#define BTREE_VALIDATION        (0)
-#else
-#define contract __builtin_assume
-#define ALLOCATOR_VALIDATION    (0)
-#define BTREE_VALIDATION        (0)
-#endif
-
-// note: keep in sync with ProtectedStack.s
-#if (BUILDING_DYLD || BUILDING_UNIT_TESTS || BUILDING_ALLOCATOR_UNIT_TESTS) && __arm64e__ && !TARGET_OS_EXCLAVEKIT && !TARGET_OS_SIMULATOR
-#define DYLD_FEATURE_USE_HW_TPRO (1)
-#else
-#define DYLD_FEATURE_USE_HW_TPRO (0)
-#endif /* (BUILDING_DYLD || BUILDING_UNIT_TESTS) && __arm64e__ && !TARGET_OS_EXCLAVEKIT && !TARGET_OS_SIMULATOR */
-
-#if (BUILDING_DYLD || BUILDING_UNIT_TESTS || BUILDING_ALLOCATOR_UNIT_TESTS) && !TARGET_OS_EXCLAVEKIT
-#define DYLD_FEATURE_MPROTECT_ALLOCATOR (1)
-#else
-#define DYLD_FEATURE_MPROTECT_ALLOCATOR (0)
-#endif
-
-#if DYLD_FEATURE_USE_HW_TPRO
-#define TPRO_SECTION(_name, _align) __attribute__((section("__TPRO_CONST," #_name),aligned(_align))) static
-#else
-#define TPRO_SECTION(_name, _align) static __attribute__((aligned(_align)))
-#endif
-
-#define TPRO_SEGMENT(_align) TPRO_SECTION(__data, _align)
-
-#define remote_memory_audit_start()
-#define remote_memory_audit_end()
-
-#ifndef PATH_MAX
-  #define PATH_MAX 1024
-#endif
-
-#if TARGET_OS_EXCLAVEKIT
-   #define PAGE_SIZE (16384)
-   #define trunc_page(x)   ((x) & (~(PAGE_SIZE - 1)))
-   #define round_page(x)   trunc_page((x) + (PAGE_SIZE - 1))
-   #define bzero(p, s) memset(p, 0, s)
-#endif
-
-// INTERNAL_BUILD is set on command line building ld or dyld_info for OS toolchains
-#ifndef INTERNAL_BUILD
-    #define INTERNAL_BUILD DEBUG
+  #define CRSetCrashLogMessage(x)
+  #define CRSetCrashLogMessage2(x)
 #endif
 
 #endif /* DYLD_DEFINES_H */