#include "/Makefiles/CoreOS/Xcode/BSD.xcconfig" // NO means only libSystem.B_asan.dylib will be ASanified. // YES means even the normal variant, libSystem.B.dylib, will be ASanified. // // XBS sets RC_SUPPORT_ADDRESS_SANITIZATION=1 to trigger the ASanified normal variant. ASAN_IN_NORMAL_VARIANT_DK_ = YES ASAN_IN_NORMAL_VARIANT_DK_1 = NO ASAN_IN_NORMAL_VARIANT_RC_1 = $(ASAN_IN_NORMAL_VARIANT_DK_$(DRIVERKIT)) ASAN_IN_NORMAL_VARIANT_RC_ = NO ASAN_IN_NORMAL_VARIANT = $(ASAN_IN_NORMAL_VARIANT_RC_$(RC_SUPPORT_ADDRESS_SANITIZATION)) // Apple Internal Sanitizer dylib path SANITIZER_DYLIB_DIR = /usr/appleinternal/lib/sanitizers ASAN_CFLAGS_NO = ASAN_CFLAGS_YES = -DSUPPORT_ASAN=1 ASAN_LDFLAGS_NO = SHARED_ASAN_LDFLAGS = -L $(SDKROOT)$(SANITIZER_DYLIB_DIR) -Xlinker -not_for_dyld_shared_cache -rpath $(SANITIZER_DYLIB_DIR)/ ASAN_LDFLAGS_YES[sdk=macosx*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_osx_dynamic ASAN_LDFLAGS_YES[sdk=iphoneos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_ios_dynamic ASAN_LDFLAGS_YES[sdk=watchos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_watchos_dynamic ASAN_LDFLAGS_YES[sdk=appletvos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_tvos_dynamic ASAN_LDFLAGS_YES[sdk=bridgeos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_bridgeos_dynamic // "no_asan" variant // // The "no_asan" variant is only built when ASAN_IN_NORMAL_VARIANT=YES. // The variant exists to provide a way to opt-out processes from the // "Whole OS ASan" mode. It should be identical to the "normal" variant // except it does **not** upward link the ASan runtime. Despite the name, // this does not enforce that ASan is not used. This is because an ASan // instrumented binary could also cause the ASan runtime to be loaded. NOASAN_CFLAGS_YES = $(ASAN_CFLAGS_YES) NOASAN_LDFLAGS_YES = EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT_NO = EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT_YES = no_asan EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT = $(EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT_$(ASAN_IN_NORMAL_VARIANT)) SDK_INSTALL_VARIANT = $(SDK_INSTALL_VARIANT_$(DRIVERKIT)) SDK_INSTALL_VARIANT_1 = driverkit SDK_INSTALL_VARIANT_ = default SDK_INSTALL_ROOT = $(SDK_INSTALL_ROOT_$(SDK_INSTALL_VARIANT)) SDK_INSTALL_ROOT_driverkit = $(DRIVERKITROOT) SDK_INSTALL_HEADERS_ROOT = $(SDK_INSTALL_HEADERS_ROOT_$(SDK_INSTALL_VARIANT)) SDK_INSTALL_HEADERS_ROOT_driverkit = $(SDK_INSTALL_ROOT)/$(SDK_RUNTIME_HEADERS_PREFIX) SDK_RUNTIME_HEADERS_PREFIX = Runtime BUILD_VARIANTS = $(BUILD_VARIANTS_$(SDK_INSTALL_VARIANT)) BUILD_VARIANTS_default = normal debug asan $(EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT) BUILD_VARIANTS_driverkit = normal debug SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator INSTALL_PATH = $(SDK_INSTALL_ROOT)/usr/lib INSTALL_PATH_PREFIX = $(SDK_INSTALL_ROOT) INSTALL_PATH_FRAMEWORK_PREFIX = $(SDK_INSTALL_HEADERS_ROOT) DYLIB_CURRENT_VERSION = $(CURRENT_VERSION_STRING_$(RC_XBS)) // used in PRODUCT_NAME of dylib target DYLIB_NAME_VERSION_SUFFIX = .B DYLIB_NAME_VERSION_SUFFIX[sdk=driverkit*] = ORDER_FILE = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libSystem.order ORDER_FILE[sdk=iphonesimulator*] = ORDER_FILE[sdk=driverkit*] = SYSTEM_HEADER_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/usr/local/include $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/usr/include SYSTEM_FRAMEWORK_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/PrivateFrameworks $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks OTHER_CFLAGS = -include $(BUILT_PRODUCTS_DIR)/config.$(CURRENT_ARCH).$(CURRENT_VARIANT).h -DCURRENT_VARIANT_$(CURRENT_VARIANT)=1 OTHER_CFLAGS_normal = $(ASAN_CFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO)) // Preserve existing behaviour of modifying debug variant. OTHER_CFLAGS_debug = $(ASAN_CFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO)) OTHER_CFLAGS_asan = $(ASAN_CFLAGS_YES) OTHER_CFLAGS_no_asan = $(NOASAN_CFLAGS_YES) OTHER_LDFLAGS = -Wl,-search_paths_first -nodefaultlibs @$(BUILT_PRODUCTS_DIR)/linker_arguments.$(CURRENT_ARCH).$(CURRENT_VARIANT).txt $(DRIVERKIT_LDFLAGS) OTHER_LDFLAGS_normal = $(ASAN_LDFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO)) // Preserve existing behaviour of modifying debug variant. OTHER_LDFLAGS_debug = $(ASAN_LDFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO)) OTHER_LDFLAGS_asan = $(ASAN_LDFLAGS_YES) OTHER_LDFLAGS_no_asan = $(NOASAN_LDFLAGS_YES) // whitelist of libraries in DriverKit SDK allowed to link directly against libSystem.dylib (outside of the umbrella) DRIVERKIT_LDFLAGS[sdk=driverkit*] = -Wl,-allowable_client,c++ -Wl,-allowable_client,c++abi -Wl,-allowable_client,DriverKit LD_GENERATE_MAP_FILE = YES EXECUTABLE_PREFIX = lib PRIVATE_HEADERS_FOLDER_PATH = $(SDK_INSTALL_HEADERS_ROOT)/usr/local/include/os LIBRARY_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_ROOT)/usr/lib/system $(SDKROOT)/$(SDK_INSTALL_ROOT)/usr/local/lib/system GCC_NO_COMMON_BLOCKS = YES GCC_WARN_64_TO_32_BIT_CONVERSION = YES GCC_WARN_ABOUT_RETURN_TYPE = YES GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES GCC_TREAT_WARNINGS_AS_ERRORS = YES GCC_WARN_UNUSED_VARIABLE = YES CURRENT_VERSION_STRING_ = 159 CURRENT_VERSION_STRING_YES = $(CURRENT_PROJECT_VERSION) INFOPLIST_INSTALL_PATH = Versions/B/Resources INFOPLIST_INSTALL_PATH[sdk=iphoneos*] = INFOPLIST_INSTALL_PATH[sdk=*simulator*] = INFOPLIST_INSTALL_PATH[sdk=watchos*] = INFOPLIST_OUTPUT_FORMAT = binary INFOPLIST_OUTPUT_FORMAT[sdk=macosx*] = xml APPLY_RULES_IN_COPY_FILES = YES PLIST_FILE_OUTPUT_FORMAT = binary PLIST_FILE_OUTPUT_FORMAT[sdk=macosx*] = xml EXCLUDED_SOURCE_FILE_NAMES[sdk=driverkit*] = Info.plist EXCLUDED_SOURCE_FILE_NAMES = $(inherited) i386.c INCLUDED_SOURCE_FILE_NAMES[sdk=macos*][arch=i386] = $(inherited) i386.c EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*][arch=i386] = $(inherited) init.c CompatibilityHacks.c // override presence of $(EXECUTABLE_VARIANT_SUFFIX) in the default EXECUTABLE_NAME rdar://26234727 DYLIB_INSTALL_NAME_EXECUTABLE_NAME = $(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX) DYLIB_INSTALL_NAME_EXECUTABLE_PATH = $(DYLIB_INSTALL_NAME_EXECUTABLE_NAME) LD_DYLIB_INSTALL_NAME = $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(DYLIB_INSTALL_NAME_EXECUTABLE_PATH) IS_ZIPPERED = YES