* See: <rdar://problem/8289209>, <rdar://problem/8351271>, <rdar://problem/8359348>
*/
-#if defined(__i386__) || defined(__x86_64__)
+#include <TargetConditionals.h>
+
+#if (defined(__i386__) || defined(__x86_64__)) && !TARGET_OS_DRIVERKIT
#define SYM(sym) \
__asm__(".globl R8289209$_" #sym "; R8289209$_" #sym ": jmp _" #sym)
SYM(unlink);
SYM(write);
-#endif /* defined(__i386__) || defined(__x86_64__) */
+#endif /* (defined(__i386__) || defined(__x86_64__)) && !TARGET_OS_DRIVERKIT*/
// 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_1 = YES
-ASAN_IN_NORMAL_VARIANT_0 = NO
-ASAN_IN_NORMAL_VARIANT_ = NO
-ASAN_IN_NORMAL_VARIANT = $(ASAN_IN_NORMAL_VARIANT_$(RC_SUPPORT_ADDRESS_SANITIZATION))
+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))
ASAN_CFLAGS_ =
ASAN_CFLAGS_YES = -DCURRENT_VARIANT_asan=1
ASAN_IN_NORMAL_VARIANT_CFLAGS = $(ASAN_CFLAGS_$(ASAN_IN_NORMAL_VARIANT))
ASAN_IN_NORMAL_VARIANT_LDFLAGS = $(ASAN_LDFLAGS_$(ASAN_IN_NORMAL_VARIANT))
-BUILD_VARIANTS = normal debug asan
+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
+BUILD_VARIANTS_driverkit = normal debug
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator
-INSTALL_PATH = /usr/lib
+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 $(ASAN_IN_NORMAL_VARIANT_CFLAGS)
-OTHER_LDFLAGS = -Wl,-search_paths_first -nodefaultlibs @$(BUILT_PRODUCTS_DIR)/linker_arguments.$(CURRENT_ARCH).$(CURRENT_VARIANT).txt $(ASAN_IN_NORMAL_VARIANT_LDFLAGS)
+OTHER_LDFLAGS = -Wl,-search_paths_first -nodefaultlibs @$(BUILT_PRODUCTS_DIR)/linker_arguments.$(CURRENT_ARCH).$(CURRENT_VARIANT).txt $(ASAN_IN_NORMAL_VARIANT_LDFLAGS) $(DRIVERKIT_LDFLAGS)
OTHER_LDFLAGS_asan = $(ASAN_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 = /usr/local/include/os
-LIBRARY_SEARCH_PATHS = $(SDKROOT)/usr/lib/system $(SDKROOT)/usr/local/lib/system
+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
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
// override presence of $(EXECUTABLE_VARIANT_SUFFIX) in the default EXECUTABLE_NAME rdar://26234727
DYLIB_INSTALL_NAME_EXECUTABLE_NAME = $(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)
objects = {
/* Begin PBXAggregateTarget section */
+ 923662F4212762D7001FB3E7 /* Sanitizer Support */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 923662F6212762D7001FB3E7 /* Build configuration list for PBXAggregateTarget "Sanitizer Support" */;
+ buildPhases = (
+ 923662F7212762EA001FB3E7 /* Copy enable_asan_mode */,
+ 923662FB21276319001FB3E7 /* Run create_asan_override_file.sh */,
+ );
+ dependencies = (
+ );
+ name = "Sanitizer Support";
+ productName = "Sanitizer Support";
+ };
BA5511CF136CA8480012B9B5 /* Generate Linker Arguments */ = {
isa = PBXAggregateTarget;
buildConfigurationList = BA5511D0136CA8480012B9B5 /* Build configuration list for PBXAggregateTarget "Generate Linker Arguments" */;
name = "Generate Symlinks";
productName = "Generate Symlinks";
};
+ E47E982E221DFDFC006E312E /* Libsystem_driverkit */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = E47E9830221DFDFC006E312E /* Build configuration list for PBXAggregateTarget "Libsystem_driverkit" */;
+ buildPhases = (
+ );
+ dependencies = (
+ E47E983D221DFE8B006E312E /* PBXTargetDependency */,
+ E47E983F221DFE90006E312E /* PBXTargetDependency */,
+ E47E9841221DFE94006E312E /* PBXTargetDependency */,
+ );
+ name = Libsystem_driverkit;
+ productName = Libsystem_driverkit;
+ };
+ E47E9831221DFE23006E312E /* Libsystem */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = E47E9832221DFE23006E312E /* Build configuration list for PBXAggregateTarget "Libsystem" */;
+ buildPhases = (
+ );
+ dependencies = (
+ E47E9835221DFE4A006E312E /* PBXTargetDependency */,
+ E47E9837221DFE4F006E312E /* PBXTargetDependency */,
+ E47E9839221DFE58006E312E /* PBXTargetDependency */,
+ E47E983B221DFE5E006E312E /* PBXTargetDependency */,
+ );
+ name = Libsystem;
+ productName = Libsystem;
+ };
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
- 8C0BF12A1F58E51E00706493 /* enable_asan_mode in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C0BF1291F58E51D00706493 /* enable_asan_mode */; };
+ 923662F821276300001FB3E7 /* enable_asan_mode in Copy enable_asan_mode */ = {isa = PBXBuildFile; fileRef = 8C0BF1291F58E51D00706493 /* enable_asan_mode */; };
BA2BD900136D282200FF78C0 /* Info.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = BA5511B6136C9D780012B9B5 /* Info.plist */; };
BA2FABC5136DBF45004383E5 /* linker_arguments_changed.c in Sources */ = {isa = PBXBuildFile; fileRef = BA2FABC4136DBF45004383E5 /* linker_arguments_changed.c */; };
BA5511C9136C9E4D0012B9B5 /* CompatibilityHacks.c in Sources */ = {isa = PBXBuildFile; fileRef = BA5511B4136C9D780012B9B5 /* CompatibilityHacks.c */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- BA5511D2136CA8550012B9B5 /* PBXContainerItemProxy */ = {
+ E47E9834221DFE4A006E312E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 923662F4212762D7001FB3E7;
+ remoteInfo = "Sanitizer Support";
+ };
+ E47E9836221DFE4F006E312E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = BA5511D6136D22ED0012B9B5;
+ remoteInfo = "Generate Symlinks";
+ };
+ E47E9838221DFE58006E312E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BA5511CF136CA8480012B9B5;
remoteInfo = "Generate Linker Arguments";
};
- BA5511DA136D23EE0012B9B5 /* PBXContainerItemProxy */ = {
+ E47E983A221DFE5E006E312E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = BA5511C3136C9E2E0012B9B5;
+ remoteInfo = System;
+ };
+ E47E983C221DFE8B006E312E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BA5511D6136D22ED0012B9B5;
remoteInfo = "Generate Symlinks";
};
+ E47E983E221DFE90006E312E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = BA5511CF136CA8480012B9B5;
+ remoteInfo = "Generate Linker Arguments";
+ };
+ E47E9840221DFE94006E312E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BA5511A9136C9D400012B9B5 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = BA5511C3136C9E2E0012B9B5;
+ remoteInfo = System;
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
- 8C0BF1281F58E4B400706493 /* CopyFiles */ = {
+ 923662F7212762EA001FB3E7 /* Copy enable_asan_mode */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = "$(INSTALL_PATH_PREFIX)/usr/local/bin";
dstSubfolderSpec = 0;
files = (
- 8C0BF12A1F58E51E00706493 /* enable_asan_mode in CopyFiles */,
+ 923662F821276300001FB3E7 /* enable_asan_mode in Copy enable_asan_mode */,
);
+ name = "Copy enable_asan_mode";
runOnlyForDeploymentPostprocessing = 1;
};
BA2BD8FF136D27FE00FF78C0 /* CopyFiles */ = {
/* Begin PBXFileReference section */
8C0BF1291F58E51D00706493 /* enable_asan_mode */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = enable_asan_mode; sourceTree = "<group>"; };
+ 923662FC212B442C001FB3E7 /* create_asan_override_file.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = create_asan_override_file.sh; sourceTree = "<group>"; };
BA2FABC4136DBF45004383E5 /* linker_arguments_changed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = linker_arguments_changed.c; sourceTree = BUILT_PRODUCTS_DIR; };
BA5511B3136C9D780012B9B5 /* APPLE_LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = APPLE_LICENSE; sourceTree = "<group>"; };
BA5511B4136C9D780012B9B5 /* CompatibilityHacks.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CompatibilityHacks.c; sourceTree = "<group>"; };
C64EE1D9136F644700676C52 /* linker_arguments.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = linker_arguments.sh; sourceTree = "<group>"; };
C9A43CAB15374DB200388D0C /* alloc_once_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = alloc_once_private.h; sourceTree = "<group>"; };
C9B56C55153751A600C153A8 /* Libsystem.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Libsystem.xcconfig; sourceTree = "<group>"; };
+ E43B88B32245778F00215272 /* requiredlibs_driverkit */ = {isa = PBXFileReference; lastKnownFileType = text; path = requiredlibs_driverkit; sourceTree = "<group>"; };
+ E43B88B42245778F00215272 /* optionallibs_driverkit */ = {isa = PBXFileReference; lastKnownFileType = text; path = optionallibs_driverkit; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
BA5511B7136C9D780012B9B5 /* init.c */,
BA5511B9136C9D780012B9B5 /* optionallibs */,
BA5511BA136C9D780012B9B5 /* requiredlibs */,
+ E43B88B42245778F00215272 /* optionallibs_driverkit */,
+ E43B88B32245778F00215272 /* requiredlibs_driverkit */,
8C0BF1291F58E51D00706493 /* enable_asan_mode */,
C64EE1D6136F644700676C52 /* xcodescripts */,
BA5511C5136C9E2E0012B9B5 /* Products */,
C64EE1D6136F644700676C52 /* xcodescripts */ = {
isa = PBXGroup;
children = (
+ 923662FC212B442C001FB3E7 /* create_asan_override_file.sh */,
C64EE1D7136F644700676C52 /* create_dylib_symlinks.sh */,
C64EE1D8136F644700676C52 /* create_system_framework.sh */,
C64EE1D9136F644700676C52 /* linker_arguments.sh */,
BA5511C0136C9E2E0012B9B5 /* Sources */,
BA5511C1136C9E2E0012B9B5 /* Frameworks */,
BA5511C2136C9E2E0012B9B5 /* Headers */,
- 8C0BF1281F58E4B400706493 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
- BA5511DB136D23EE0012B9B5 /* PBXTargetDependency */,
- BA5511D3136CA8550012B9B5 /* PBXTargetDependency */,
);
name = System;
productName = System;
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
+ TargetAttributes = {
+ 923662F4212762D7001FB3E7 = {
+ CreatedOnToolsVersion = 10.0;
+ ProvisioningStyle = Automatic;
+ };
+ E47E982E221DFDFC006E312E = {
+ CreatedOnToolsVersion = 11.0;
+ };
+ E47E9831221DFE23006E312E = {
+ CreatedOnToolsVersion = 11.0;
+ };
+ };
};
buildConfigurationList = BA5511AC136C9D400012B9B5 /* Build configuration list for PBXProject "Libsystem" */;
compatibilityVersion = "Xcode 3.2";
projectDirPath = "";
projectRoot = "";
targets = (
+ E47E9831221DFE23006E312E /* Libsystem */,
+ E47E982E221DFDFC006E312E /* Libsystem_driverkit */,
BA5511C3136C9E2E0012B9B5 /* System */,
BA5511CF136CA8480012B9B5 /* Generate Linker Arguments */,
BA5511D6136D22ED0012B9B5 /* Generate Symlinks */,
+ 923662F4212762D7001FB3E7 /* Sanitizer Support */,
);
};
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
+ 923662FB21276319001FB3E7 /* Run create_asan_override_file.sh */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ name = "Run create_asan_override_file.sh";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "set -x\nset -e\n\n\"${SRCROOT}/xcodescripts/create_asan_override_file.sh\"\n";
+ };
BA2BD8FE136D271D00FF78C0 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "set -x\nset -e\n\n\"${SRCROOT}/xcodescripts/linker_arguments.sh\" \"${ARCHS}\" \"${BUILD_VARIANTS}\" \"${BUILT_PRODUCTS_DIR}\" \"${SDKROOT}\" \"${SRCROOT}\"\n";
+ shellScript = "set -x\nset -e\n\n# workaround 48125283\n[ -n \"$DRIVERKIT_DEPLOYMENT_TARGET\" ] && unset MACOSX_DEPLOYMENT_TARGET\n\n\"${SRCROOT}/xcodescripts/linker_arguments.sh\" \"${ARCHS}\" \"${BUILD_VARIANTS}\" \"${BUILT_PRODUCTS_DIR}\" \"${SDKROOT}\" \"${SRCROOT}\"\n";
};
BA5511D9136D23110012B9B5 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- BA5511D3136CA8550012B9B5 /* PBXTargetDependency */ = {
+ E47E9835221DFE4A006E312E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 923662F4212762D7001FB3E7 /* Sanitizer Support */;
+ targetProxy = E47E9834221DFE4A006E312E /* PBXContainerItemProxy */;
+ };
+ E47E9837221DFE4F006E312E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = BA5511D6136D22ED0012B9B5 /* Generate Symlinks */;
+ targetProxy = E47E9836221DFE4F006E312E /* PBXContainerItemProxy */;
+ };
+ E47E9839221DFE58006E312E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BA5511CF136CA8480012B9B5 /* Generate Linker Arguments */;
- targetProxy = BA5511D2136CA8550012B9B5 /* PBXContainerItemProxy */;
+ targetProxy = E47E9838221DFE58006E312E /* PBXContainerItemProxy */;
+ };
+ E47E983B221DFE5E006E312E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = BA5511C3136C9E2E0012B9B5 /* System */;
+ targetProxy = E47E983A221DFE5E006E312E /* PBXContainerItemProxy */;
};
- BA5511DB136D23EE0012B9B5 /* PBXTargetDependency */ = {
+ E47E983D221DFE8B006E312E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BA5511D6136D22ED0012B9B5 /* Generate Symlinks */;
- targetProxy = BA5511DA136D23EE0012B9B5 /* PBXContainerItemProxy */;
+ targetProxy = E47E983C221DFE8B006E312E /* PBXContainerItemProxy */;
+ };
+ E47E983F221DFE90006E312E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = BA5511CF136CA8480012B9B5 /* Generate Linker Arguments */;
+ targetProxy = E47E983E221DFE90006E312E /* PBXContainerItemProxy */;
+ };
+ E47E9841221DFE94006E312E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = BA5511C3136C9E2E0012B9B5 /* System */;
+ targetProxy = E47E9840221DFE94006E312E /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
+ 923662F5212762D7001FB3E7 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
BA5511AF136C9D400012B9B5 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = C9B56C55153751A600C153A8 /* Libsystem.xcconfig */;
isa = XCBuildConfiguration;
baseConfigurationReference = C9B56C55153751A600C153A8 /* Libsystem.xcconfig */;
buildSettings = {
- PRODUCT_NAME = "$(TARGET_NAME).B";
+ PRODUCT_NAME = "$(TARGET_NAME)$(DYLIB_NAME_VERSION_SUFFIX)";
SDKROOT = macosx.internal;
};
name = Release;
};
name = Release;
};
+ E47E982F221DFDFC006E312E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+ E47E9833221DFE23006E312E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 923662F6212762D7001FB3E7 /* Build configuration list for PBXAggregateTarget "Sanitizer Support" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 923662F5212762D7001FB3E7 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
BA5511AC136C9D400012B9B5 /* Build configuration list for PBXProject "Libsystem" */ = {
isa = XCConfigurationList;
buildConfigurations = (
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ E47E9830221DFDFC006E312E /* Build configuration list for PBXAggregateTarget "Libsystem_driverkit" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E47E982F221DFDFC006E312E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ E47E9832221DFE23006E312E /* Build configuration list for PBXAggregateTarget "Libsystem" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E47E9833221DFE23006E312E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
/* End XCConfigurationList section */
};
rootObject = BA5511A9136C9D400012B9B5 /* Project object */;
#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_CORESERVICES 19
#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_SYMPTOMS 20
#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_PLATFORM_ASL 21
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_FEATUREFLAGS 22
/* Keys OS_ALLOC_ONCE_KEY_MAX - 10 upwards are reserved for the system. */
#define OS_ALLOC_ONCE_KEY_RESERVED_0 (OS_ALLOC_ONCE_KEY_MAX - 10)
exit 1
fi
-if [ "$1" == "enable" ]; then
- if [[ $(id -u) != 0 ]]; then echo "Must be run as root." 1>&2; exit 1; fi
-
- if [ -f /usr/lib/libSystem.B.dylib-asan-mode-backup ]; then
- if [ "`md5 -q /usr/lib/libSystem.B.dylib-asan-mode-backup`" != "`md5 -q /usr/lib/libSystem.B.dylib`" ]; then
- echo "Looks like your system already has ASan mode enabled, or you have a custom /usr/lib/libSystem.B.dylib file. Not activating." 1>&2
- exit 1
- fi
- fi
+LIBSYSTEM_B="/usr/lib/libSystem.B.dylib"
+LIBSYSTEM_B_BACKUP="${LIBSYSTEM_B}-asan-mode-backup"
+LIBSYSTEM_B_ASAN="/usr/lib/libSystem.B_asan.dylib"
- ditto /usr/lib/libSystem.B.dylib /usr/lib/libSystem.B.dylib-asan-mode-backup
- ditto /usr/lib/libSystem.B_asan.dylib /usr/lib/libSystem.B.dylib
- echo "ASan mode activated. You probably want to reboot now." 1>&2
- exit 0
-elif [ "$1" == "disable" ]; then
- if [[ $(id -u) != 0 ]]; then echo "Must be run as root." 1>&2; exit 1; fi
- ditto /usr/lib/libSystem.B.dylib-asan-mode-backup /usr/lib/libSystem.B.dylib
- echo "ASan mode deactivated. You probably want to reboot now." 1>&2
- exit 0
-elif [ "$1" == "status" ]; then
- if [ ! -f /usr/lib/libSystem.B.dylib-asan-mode-backup ]; then
- echo "ASan mode is disabled." 1>&2
- exit 0
- fi
+# If this file is present on the system and we are using a development build
+# then the usual memory resource limits won't be applied.
+# rdar://problem/43520116
+DISABLE_MEM_LIMIT_COOKIE_FILE="/usr/local/share/launchd-disable-memory-limits"
+DISABLE_MEM_LIMIT_COOKIE_CONTENTS="kEnableAsanDisableMemLimit"
- if [ "`md5 -q /usr/lib/libSystem.B.dylib-asan-mode-backup`" == "`md5 -q /usr/lib/libSystem.B.dylib`" ]; then
- echo "ASan mode is disabled." 1>&2
- exit 0
- fi
+function is_mac_os() {
+ if [ $(sw_vers -productName | grep -c '^Mac OS') -ne 0 ]; then
+ # Mac OS.
+ return 0
+ else
+ # Something else.
+ return 1
+ fi
+}
- if [ "`md5 -q /usr/lib/libSystem.B_asan.dylib`" == "`md5 -q /usr/lib/libSystem.B.dylib`" ]; then
- echo "ASan mode is enabled." 1>&2
- exit 0
- fi
+function show_have_asan_mode_on_msg() {
+ echo "Looks like your system already has ASan mode enabled, or you have a custom ${LIBSYSTEM_B} file. Not activating." 1>&2
+}
- echo "Cannot tell whether ASan mode is enabled or not. You seem to have a custom /usr/lib/libSystem.B.dylib file." 1>&2
- exit 1
-else
- echo "Invalid argument. Run '$0' for usage instructions." 1>&2
- exit 1
+if ! is_mac_os; then
+ # Check assumption that ${LIBSYSTEM_B} is in the dyld shared cache.
+ if [ "$(dyld_shared_cache_util -list | grep -c "^${LIBSYSTEM_B}$")" -eq 0 ]; then
+ echo "Error: Non macOS platform detected but ${LIBSYSTEM_B} is not in your dyld shared cache." 1>&2
+ exit 1
+ fi
fi
+
+case "$1" in
+ enable)
+ if [[ $(id -u) != 0 ]]; then echo "Must be run as root." 1>&2; exit 1; fi
+
+ if is_mac_os; then
+ if [ -f ${LIBSYSTEM_B_BACKUP} ]; then
+ if [ "`md5 -q ${LIBSYSTEM_B_BACKUP}`" != "`md5 -q ${LIBSYSTEM_B}`" ]; then
+ show_have_asan_mode_on_msg
+ exit 1
+ fi
+ fi
+ ditto ${LIBSYSTEM_B} ${LIBSYSTEM_B_BACKUP}
+ else
+ # libSystem.B.dylib does not exist on non-macos platforms because it
+ # lives in the dyld cache so we don't have a back up file. Instead
+ # the presence of `libSystem.B.dylib` indicates that we are using ASan mode.
+ if [ -f ${LIBSYSTEM_B} ]; then
+ show_have_asan_mode_on_msg
+ exit 1
+ fi
+ # Disable memory limits because ASan adds memory overhead.
+ echo "${DISABLE_MEM_LIMIT_COOKIE_CONTENTS}" > "${DISABLE_MEM_LIMIT_COOKIE_FILE}"
+ fi
+
+ ditto ${LIBSYSTEM_B_ASAN} ${LIBSYSTEM_B}
+ echo "ASan mode activated. You probably want to reboot now." 1>&2
+ exit 0
+ ;;
+ disable)
+ if [[ $(id -u) != 0 ]]; then echo "Must be run as root." 1>&2; exit 1; fi
+ if is_mac_os; then
+ ditto ${LIBSYSTEM_B_BACKUP} ${LIBSYSTEM_B}
+ else
+ if [ ! -f "${LIBSYSTEM_B}" ]; then
+ echo "ASan mode cannot be disabled if it is not already enabled" 2>&1
+ exit 1
+ fi
+ if [ "`md5 -q ${LIBSYSTEM_B_ASAN}`" != "`md5 -q ${LIBSYSTEM_B}`" ]; then
+ echo "You appear to have a custom ${LIBSYSTEM_B} file. Not deactivating." 1>&2
+ exit 1
+ fi
+ # Safe to do because we've checked this is the ASan version and the normal versions
+ # lives in the dyld shared cache.
+ rm -f ${LIBSYSTEM_B}
+ if [ ! -f "${DISABLE_MEM_LIMIT_COOKIE_FILE}" ] ; then
+ echo "Warning: Can't find \"${DISABLE_MEM_LIMIT_COOKIE_FILE}\" so skipping delete" 2>&1
+ else
+ # Check the contents of the cookie file and only delete if it matches.
+ # If it doesn't match we don't delete because we assume the user wants
+ # to keep the cookie file around.
+ if [ "$(grep -c "^${DISABLE_MEM_LIMIT_COOKIE_CONTENTS}$" "${DISABLE_MEM_LIMIT_COOKIE_FILE}")" -eq 1 ]; then
+ rm -f "${DISABLE_MEM_LIMIT_COOKIE_FILE}"
+ else
+ echo "Warning: Not removing \"${DISABLE_MEM_LIMIT_COOKIE_FILE}\" because it has been modified" 2>&1
+ fi
+ fi
+ fi
+ echo "ASan mode deactivated. You probably want to reboot now." 1>&2
+ exit 0
+ ;;
+ status)
+ if is_mac_os; then
+ if [ ! -f ${LIBSYSTEM_B_BACKUP} ]; then
+ echo "ASan mode is disabled." 1>&2
+ exit 0
+ fi
+
+ if [ "`md5 -q ${LIBSYSTEM_B_BACKUP}`" == "`md5 -q ${LIBSYSTEM_B}`" ]; then
+ echo "ASan mode is disabled." 1>&2
+ exit 0
+ fi
+ else
+ if [ ! -f ${LIBSYSTEM_B} ]; then
+ echo "ASan mode is disabled." 1>&2
+ exit 0
+ fi
+ fi
+
+ if [ "`md5 -q ${LIBSYSTEM_B_ASAN}`" == "`md5 -q ${LIBSYSTEM_B}`" ]; then
+ echo "ASan mode is enabled." 1>&2
+ exit 0
+ fi
+
+ echo "Cannot tell whether ASan mode is enabled or not. You seem to have a custom ${LIBSYSTEM_B} file." 1>&2
+ exit 1
+ ;;
+ *)
+ echo "Invalid argument. Run '$0' for usage instructions." 1>&2
+ exit 1
+ ;;
+esac
* Copyright (c) 2007, 2008, 2011-2013 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#include <stddef.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <corecrypto/cc_priv.h>
#include <libc_private.h>
#include <pthread.h>
#include <pthread/private.h>
+#if !TARGET_OS_DRIVERKIT
#include <dlfcn.h>
+#endif
#include <fcntl.h>
#include <errno.h>
+#include <sys/kdebug.h>
#include <_libkernel_init.h> // Must be after voucher_private.h
+#include <malloc_implementation.h>
#include <mach-o/dyld_priv.h>
extern void __libdarwin_init(void); // from libsystem_darwin.dylib
-// signal malloc stack logging that initialisation has finished
-extern void __stack_logging_early_finished(void); // form libsystem_c.dylib
-
// clear qos tsd (from pthread)
extern void _pthread_clear_qos_tsd(mach_port_t) __attribute__((weak_import));
extern void _mach_fork_child(void);
extern void _notify_fork_child(void);
+extern void _dyld_atfork_prepare(void);
+extern void _dyld_atfork_parent(void);
extern void _dyld_fork_child(void);
extern void xpc_atfork_prepare(void);
extern void xpc_atfork_parent(void);
const char *__asan_default_options(void);
#endif
+static inline void
+_libSystem_ktrace4(uint32_t code, uint64_t a, uint64_t b, uint64_t c, uint64_t d)
+{
+ if (__builtin_expect(*(volatile uint32_t *)_COMM_PAGE_KDEBUG_ENABLE == 0, 1)) return;
+ kdebug_trace(code, a, b, c, d);
+}
+#define _libSystem_ktrace3(code, a, b, c) _libSystem_ktrace4(code, a, b, c, 0)
+#define _libSystem_ktrace2(code, a, b) _libSystem_ktrace4(code, a, b, 0, 0)
+#define _libSystem_ktrace1(code, a) _libSystem_ktrace4(code, a, 0, 0, 0)
+#define _libSystem_ktrace0(code) _libSystem_ktrace4(code, 0, 0, 0, 0)
+
+/*
+ * these define stable Ariadne tracepoints. If initializers are removed, or
+ * added, then old tracepoints MUST NOT be recycled.
+ */
+enum {
+ ARIADNE_LIFECYCLE_libsystem_init = ARIADNEDBG_CODE(220, 4),
+};
+
+/*
+ * These represent the initializer "name"
+ *
+ * They happen to match the order of the initializers at some point in time,
+ * but there's no guarantee made that traecepoints will appear in numerical
+ * order. As initializers come and go, new codes shall be allocated,
+ * and no slots reused.
+ */
+enum init_func {
+ INIT_SYSTEM = 0,
+ INIT_KERNEL = 1,
+ INIT_PLATFORM = 2,
+ INIT_PTHREAD = 3,
+ INIT_LIBC = 4,
+ INIT_MALLOC = 5,
+ INIT_KEYMGR = 6,
+ INIT_DYLD = 7,
+ INIT_LIBDISPATCH = 8,
+ INIT_LIBXPC = 9,
+ INIT_LIBTRACE = 10,
+ INIT_SECINIT = 11,
+ INIT_CONTAINERMGR = 12,
+ INIT_DARWIN = 13,
+};
+
+#define _libSystem_ktrace_init_func(what) \
+ _libSystem_ktrace1(ARIADNE_LIFECYCLE_libsystem_init | DBG_FUNC_NONE, INIT_##what)
+
// libsyscall_initializer() initializes all of libSystem.dylib
// <rdar://problem/4892197>
__attribute__((constructor))
static const struct _libkernel_functions libkernel_funcs = {
.version = 3,
// V1 functions
+#if !TARGET_OS_DRIVERKIT
.dlsym = dlsym,
+#endif
.malloc = malloc,
.free = free,
.realloc = realloc,
.malloc = malloc,
.free = free,
};
-
+
static const struct _libc_functions libc_funcs = {
.version = 1,
.atfork_prepare = libSystem_atfork_prepare,
.dirhelper = _dirhelper,
#endif
};
+
+ static const struct _malloc_functions malloc_funcs = {
+ .version = 1,
+#if !TARGET_OS_DRIVERKIT
+ .dlopen = dlopen,
+ .dlsym = dlsym,
+#endif
+ };
+
+ _libSystem_ktrace0(ARIADNE_LIFECYCLE_libsystem_init | DBG_FUNC_START);
__libkernel_init(&libkernel_funcs, envp, apple, vars);
+ _libSystem_ktrace_init_func(KERNEL);
__libplatform_init(NULL, envp, apple, vars);
+ _libSystem_ktrace_init_func(PLATFORM);
__pthread_init(&libpthread_funcs, envp, apple, vars);
+ _libSystem_ktrace_init_func(PTHREAD);
_libc_initializer(&libc_funcs, envp, apple, vars);
+ _libSystem_ktrace_init_func(LIBC);
// TODO: Move __malloc_init before __libc_init after breaking malloc's upward link to Libc
__malloc_init(apple);
+ _libSystem_ktrace_init_func(MALLOC);
#if TARGET_OS_OSX
/* <rdar://problem/9664631> */
__keymgr_initializer();
+ _libSystem_ktrace_init_func(KEYMGR);
#endif
// No ASan interceptors are invoked before this point. ASan is normally initialized via the malloc interceptor:
// _dyld_initializer() -> tlv_load_notification -> wrap_malloc -> ASanInitInternal
_dyld_initializer();
+ _libSystem_ktrace_init_func(DYLD);
libdispatch_init();
+ _libSystem_ktrace_init_func(LIBDISPATCH);
+
+#if !TARGET_OS_DRIVERKIT
_libxpc_initializer();
+ _libSystem_ktrace_init_func(LIBXPC);
#if CURRENT_VARIANT_asan
setenv("DT_BYPASS_LEAKS_CHECK", "1", 1);
#endif
+#endif // !TARGET_OS_DRIVERKIT
// must be initialized after dispatch
_libtrace_init();
+ _libSystem_ktrace_init_func(LIBTRACE);
-#if !(TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR)
+#if !TARGET_OS_DRIVERKIT
+#if defined(HAVE_SYSTEM_SECINIT)
_libsecinit_initializer();
+ _libSystem_ktrace_init_func(SECINIT);
#endif
#if defined(HAVE_SYSTEM_CONTAINERMANAGER)
_container_init(apple);
+ _libSystem_ktrace_init_func(CONTAINERMGR);
#endif
__libdarwin_init();
+ _libSystem_ktrace_init_func(DARWIN);
+#endif // !TARGET_OS_DRIVERKIT
- __stack_logging_early_finished();
+ __stack_logging_early_finished(&malloc_funcs);
#if !TARGET_OS_IPHONE
- /* <rdar://problem/22139800> - Preserve the old behavior of apple[] for
- * programs that haven't linked against newer SDK.
+ /* <rdar://problem/22139800> - Preserve the old behavior of apple[] for
+ * programs that haven't linked against newer SDK.
*/
#define APPLE0_PREFIX "executable_path="
if (dyld_get_program_sdk_version() < DYLD_MACOSX_VERSION_10_11){
}
#endif
+ _libSystem_ktrace0(ARIADNE_LIFECYCLE_libsystem_init | DBG_FUNC_END);
+
/* <rdar://problem/11588042>
* C99 standard has the following in section 7.5(3):
* "The value of errno is zero at program startup, but is never set
// second call hardwired fork prepare handlers for Libsystem components
// in the _reverse_ order of library initalization above
+#if !TARGET_OS_DRIVERKIT
_libSC_info_fork_prepare();
xpc_atfork_prepare();
+#endif // !TARGET_OS_DRIVERKIT
dispatch_atfork_prepare();
+ _dyld_atfork_prepare();
+ cc_atfork_prepare();
_malloc_fork_prepare();
_pthread_atfork_prepare();
}
// in the order of library initalization above
_pthread_atfork_parent();
_malloc_fork_parent();
+ cc_atfork_parent();
+ _dyld_atfork_parent();
dispatch_atfork_parent();
+#if !TARGET_OS_DRIVERKIT
xpc_atfork_parent();
_libSC_info_fork_parent();
+#endif // !TARGET_OS_DRIVERKIT
// second call client parent handlers registered with pthread_atfork()
_pthread_atfork_parent_handlers();
{
// first call hardwired fork child handlers for Libsystem components
// in the order of library initalization above
- _dyld_fork_child();
- _pthread_atfork_child();
_mach_fork_child();
+ _pthread_atfork_child();
_malloc_fork_child();
+ cc_atfork_child();
_libc_fork_child(); // _arc4_fork_child calls malloc
+ _dyld_fork_child();
dispatch_atfork_child();
+#if !TARGET_OS_DRIVERKIT
#if defined(HAVE_SYSTEM_CORESERVICES)
_libcoreservices_fork_child();
#endif
_asl_fork_child();
_notify_fork_child();
xpc_atfork_child();
+#endif // !TARGET_OS_DRIVERKIT
_libtrace_fork_child();
+#if !TARGET_OS_DRIVERKIT
_libSC_info_fork_child();
+#endif // !TARGET_OS_DRIVERKIT
// second call client parent handlers registered with pthread_atfork()
_pthread_atfork_child_handlers();
}
#if CURRENT_VARIANT_asan
+#define DEFAULT_ASAN_OPTIONS "color=never" \
+ ":handle_segv=0:handle_sigbus=0:handle_sigill=0:handle_sigfpe=0" \
+ ":external_symbolizer_path=" \
+ ":log_path=stderr:log_exe_name=0" \
+ ":halt_on_error=0" \
+ ":print_module_map=2" \
+ ":start_deactivated=1" \
+ ":detect_odr_violation=0"
char dynamic_asan_opts[1024] = {0};
const char *__asan_default_options(void) {
+ char executable_path[4096] = {0};
+ uint32_t size = sizeof(executable_path);
+ const char *process_name = "";
+ if (_NSGetExecutablePath(executable_path, &size) == 0) {
+ process_name = strrchr(executable_path, '/') + 1;
+ }
+
int fd = open("/System/Library/Preferences/com.apple.asan.options", O_RDONLY);
if (fd != -1) {
ssize_t remaining_size = sizeof(dynamic_asan_opts) - 1;
}
}
- return "color=never:handle_segv=0:handle_sigbus=0:handle_sigill=0:handle_sigfpe=0";
+ return DEFAULT_ASAN_OPTIONS;
}
#endif
-/*
+/*
* Old crt1.o glue used to call through mach_init_routine which was used to initialize libSystem.
* LibSystem now auto-initializes but mach_init_routine is left for binary compatibility.
*/
keymgr
+launch
quarantine
system_containermanager
-system_network
+system_featureflags
system_networkextension
system_secinit
system_symptoms
corecrypto
dispatch
dyld
-launch
macho
removefile
system_asl
--- /dev/null
+compiler_rt
+corecrypto
+dispatch
+dyld
+macho
+system_blocks
+system_c
+system_kernel
+system_m
+system_malloc
+system_platform
+system_pthread
+system_trace
--- /dev/null
+#!/bin/bash -x
+
+if [ "${RC_SUPPORT_ADDRESS_SANITIZATION}" == "1" -a "${ACTION}" == "install" ]; then
+ mkdir -p "${DSTROOT}/usr/local/share/"
+ echo "please" > "${DSTROOT}/usr/local/share/launchd-disable-memory-limits"
+fi
exit 1
fi
+if [[ "${DRIVERKIT}" == "1" ]]; then exit 0; fi; # No compatibility symlinks in DriverKit SDK
+
DSTROOT="$1${INSTALL_PATH_PREFIX}"
ACTION="$2"
VARIANTS="$3"
exit 1
fi
-DSTROOT="$1${INSTALL_PATH_PREFIX}"
+DSTROOT="$1${INSTALL_PATH_FRAMEWORK_PREFIX}"
SRCROOT="$2"
ACTION="$3"
ARCHS="$4"
ln -sf "B" "${DSTROOT}/${FPATH}/Versions/Current" || exit 1
ln -sf "Versions/Current/PrivateHeaders" "${DSTROOT}/${FPATH}/PrivateHeaders" || exit 1
+if [[ "${DRIVERKIT}" == "1" ]]; then exit 0; fi; # No compatibility symlinks in DriverKit SDK
+
if [[ "${PLATFORM_NAME}" =~ macosx ]]; then
ln -sf "Versions/Current/Resources" "${DSTROOT}/${FPATH}/Resources" || exit 1
exit 1
fi
+shopt -s nullglob
+
ARCHS="$1"
VARIANTS="$2"
OUTPUTDIR="$3"
SDKROOT="$4"
SRCROOT="$5"
-LIBSYS="${SDKROOT}/usr/local/lib/system"
-LSYS="${SDKROOT}/usr/lib/system"
+LIBSYS="${SDKROOT}/${SDK_INSTALL_ROOT}/usr/local/lib/system"
+LSYS="${SDKROOT}/${SDK_INSTALL_ROOT}/usr/lib/system"
mkdir -p "${OUTPUTDIR}"
OUTPUTCONFIG="${OUTPUTDIR}/config.${arch}.${variant}.h"
TEMPDIR="${OUTPUTDIR}/linker_arguments_tmp"
+ SDK_INSTALL_VARIANT="${DRIVERKIT:+_driverkit}"
+
mkdir -p "${TEMPDIR}"
ACTUALLIBS="${TEMPDIR}/${arch}.${variant}.actuallibs"
INUSRLOCALLIBSYSTEM="${TEMPDIR}/${arch}.${variant}.inusrlocallibsystem"
MISSINGLIBS="${TEMPDIR}/${arch}.${variant}.missinglibs"
POSSIBLEUSRLOCALLIBSYSTEM="${TEMPDIR}/${arch}.${variant}.possibleusrlocallibsystem"
- OPTIONALLIBS="${SRCROOT}/optionallibs"
- REQUIREDLIBS="${SRCROOT}/requiredlibs"
+ OPTIONALLIBS="${SRCROOT}/optionallibs${SDK_INSTALL_VARIANT}"
+ REQUIREDLIBS="${SRCROOT}/requiredlibs${SDK_INSTALL_VARIANT}"
if [ ${variant} = "normal" ]; then
SUFFIX=""
echo "${l}"
fi
done | sed -E -e 's/^lib//' -e 's/\..*$$//' | sort -u > ${INUSRLIBSYSTEM}
- cd ${LIBSYS} && ls lib*.a | sed -E -e 's/_(debug|profile|static)\././' | while read l; do
+ [ -d ${LIBSYS} ] && cd ${LIBSYS} && ls lib*.a | sed -E -e 's/_(debug|profile|static)\././' | while read l; do
xcrun -sdk "${SDKROOT}" lipo "${LIBSYS}/${l}" -verify_arch "${arch}" 2>/dev/null
if [ $? -eq 0 ]; then
echo "${l}"