1 #include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
3 // NO means only libSystem.B_asan.dylib will be ASanified.
4 // YES means even the normal variant, libSystem.B.dylib, will be ASanified.
6 // XBS sets RC_SUPPORT_ADDRESS_SANITIZATION=1 to trigger the ASanified normal variant.
7 ASAN_IN_NORMAL_VARIANT_DK_ = YES
8 ASAN_IN_NORMAL_VARIANT_DK_1 = NO
9 ASAN_IN_NORMAL_VARIANT_RC_1 = $(ASAN_IN_NORMAL_VARIANT_DK_$(DRIVERKIT))
10 ASAN_IN_NORMAL_VARIANT_RC_ = NO
11 ASAN_IN_NORMAL_VARIANT = $(ASAN_IN_NORMAL_VARIANT_RC_$(RC_SUPPORT_ADDRESS_SANITIZATION))
13 // Apple Internal Sanitizer dylib path
14 SANITIZER_DYLIB_DIR = /usr/appleinternal/lib/sanitizers
17 ASAN_CFLAGS_YES = -DSUPPORT_ASAN=1
19 SHARED_ASAN_LDFLAGS = -L $(SDKROOT)$(SANITIZER_DYLIB_DIR) -Xlinker -not_for_dyld_shared_cache -rpath $(SANITIZER_DYLIB_DIR)/
20 ASAN_LDFLAGS_YES[sdk=macosx*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_osx_dynamic
21 ASAN_LDFLAGS_YES[sdk=iphoneos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_ios_dynamic
22 ASAN_LDFLAGS_YES[sdk=watchos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_watchos_dynamic
23 ASAN_LDFLAGS_YES[sdk=appletvos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_tvos_dynamic
24 ASAN_LDFLAGS_YES[sdk=bridgeos*] = $(SHARED_ASAN_LDFLAGS) -Xlinker -upward-lclang_rt.asan_bridgeos_dynamic
28 // The "no_asan" variant is only built when ASAN_IN_NORMAL_VARIANT=YES.
29 // The variant exists to provide a way to opt-out processes from the
30 // "Whole OS ASan" mode. It should be identical to the "normal" variant
31 // except it does **not** upward link the ASan runtime. Despite the name,
32 // this does not enforce that ASan is not used. This is because an ASan
33 // instrumented binary could also cause the ASan runtime to be loaded.
34 NOASAN_CFLAGS_YES = $(ASAN_CFLAGS_YES)
36 EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT_NO =
37 EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT_YES = no_asan
38 EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT = $(EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT_$(ASAN_IN_NORMAL_VARIANT))
40 SDK_INSTALL_VARIANT = $(SDK_INSTALL_VARIANT_$(DRIVERKIT))
41 SDK_INSTALL_VARIANT_1 = driverkit
42 SDK_INSTALL_VARIANT_ = default
43 SDK_INSTALL_ROOT = $(SDK_INSTALL_ROOT_$(SDK_INSTALL_VARIANT))
44 SDK_INSTALL_ROOT_driverkit = $(DRIVERKITROOT)
45 SDK_INSTALL_HEADERS_ROOT = $(SDK_INSTALL_HEADERS_ROOT_$(SDK_INSTALL_VARIANT))
46 SDK_INSTALL_HEADERS_ROOT_driverkit = $(SDK_INSTALL_ROOT)/$(SDK_RUNTIME_HEADERS_PREFIX)
47 SDK_RUNTIME_HEADERS_PREFIX = Runtime
49 BUILD_VARIANTS = $(BUILD_VARIANTS_$(SDK_INSTALL_VARIANT))
50 BUILD_VARIANTS_default = normal debug asan $(EXTRA_BUILD_VARIANTS_ASAN_IN_NORMAL_VARIANT)
51 BUILD_VARIANTS_driverkit = normal debug
52 SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator
53 INSTALL_PATH = $(SDK_INSTALL_ROOT)/usr/lib
54 INSTALL_PATH_PREFIX = $(SDK_INSTALL_ROOT)
55 INSTALL_PATH_FRAMEWORK_PREFIX = $(SDK_INSTALL_HEADERS_ROOT)
56 DYLIB_CURRENT_VERSION = $(CURRENT_VERSION_STRING_$(RC_XBS))
57 // used in PRODUCT_NAME of dylib target
58 DYLIB_NAME_VERSION_SUFFIX = .B
59 DYLIB_NAME_VERSION_SUFFIX[sdk=driverkit*] =
60 ORDER_FILE = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libSystem.order
61 ORDER_FILE[sdk=iphonesimulator*] =
62 ORDER_FILE[sdk=driverkit*] =
63 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
64 SYSTEM_FRAMEWORK_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/PrivateFrameworks $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks
66 OTHER_CFLAGS = -include $(BUILT_PRODUCTS_DIR)/config.$(CURRENT_ARCH).$(CURRENT_VARIANT).h -DCURRENT_VARIANT_$(CURRENT_VARIANT)=1
67 OTHER_CFLAGS_normal = $(ASAN_CFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO))
68 // Preserve existing behaviour of modifying debug variant.
69 OTHER_CFLAGS_debug = $(ASAN_CFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO))
70 OTHER_CFLAGS_asan = $(ASAN_CFLAGS_YES)
71 OTHER_CFLAGS_no_asan = $(NOASAN_CFLAGS_YES)
73 OTHER_LDFLAGS = -Wl,-search_paths_first -nodefaultlibs @$(BUILT_PRODUCTS_DIR)/linker_arguments.$(CURRENT_ARCH).$(CURRENT_VARIANT).txt $(DRIVERKIT_LDFLAGS)
74 OTHER_LDFLAGS_normal = $(ASAN_LDFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO))
75 // Preserve existing behaviour of modifying debug variant.
76 OTHER_LDFLAGS_debug = $(ASAN_LDFLAGS_$(ASAN_IN_NORMAL_VARIANT:default=NO))
77 OTHER_LDFLAGS_asan = $(ASAN_LDFLAGS_YES)
78 OTHER_LDFLAGS_no_asan = $(NOASAN_LDFLAGS_YES)
81 // whitelist of libraries in DriverKit SDK allowed to link directly against libSystem.dylib (outside of the umbrella)
82 DRIVERKIT_LDFLAGS[sdk=driverkit*] = -Wl,-allowable_client,c++ -Wl,-allowable_client,c++abi -Wl,-allowable_client,DriverKit
83 LD_GENERATE_MAP_FILE = YES
84 EXECUTABLE_PREFIX = lib
85 PRIVATE_HEADERS_FOLDER_PATH = $(SDK_INSTALL_HEADERS_ROOT)/usr/local/include/os
86 LIBRARY_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_ROOT)/usr/lib/system $(SDKROOT)/$(SDK_INSTALL_ROOT)/usr/local/lib/system
87 GCC_NO_COMMON_BLOCKS = YES
88 GCC_WARN_64_TO_32_BIT_CONVERSION = YES
89 GCC_WARN_ABOUT_RETURN_TYPE = YES
90 GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
91 GCC_TREAT_WARNINGS_AS_ERRORS = YES
92 GCC_WARN_UNUSED_VARIABLE = YES
93 CURRENT_VERSION_STRING_ = 159
94 CURRENT_VERSION_STRING_YES = $(CURRENT_PROJECT_VERSION)
95 INFOPLIST_INSTALL_PATH = Versions/B/Resources
96 INFOPLIST_INSTALL_PATH[sdk=iphoneos*] =
97 INFOPLIST_INSTALL_PATH[sdk=*simulator*] =
98 INFOPLIST_INSTALL_PATH[sdk=watchos*] =
99 INFOPLIST_OUTPUT_FORMAT = binary
100 INFOPLIST_OUTPUT_FORMAT[sdk=macosx*] = xml
101 APPLY_RULES_IN_COPY_FILES = YES
102 PLIST_FILE_OUTPUT_FORMAT = binary
103 PLIST_FILE_OUTPUT_FORMAT[sdk=macosx*] = xml
104 EXCLUDED_SOURCE_FILE_NAMES[sdk=driverkit*] = Info.plist
106 EXCLUDED_SOURCE_FILE_NAMES = $(inherited) i386.c
107 INCLUDED_SOURCE_FILE_NAMES[sdk=macos*][arch=i386] = $(inherited) i386.c
108 EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*][arch=i386] = $(inherited) init.c CompatibilityHacks.c
110 // override presence of $(EXECUTABLE_VARIANT_SUFFIX) in the default EXECUTABLE_NAME rdar://26234727
111 DYLIB_INSTALL_NAME_EXECUTABLE_NAME = $(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)
112 DYLIB_INSTALL_NAME_EXECUTABLE_PATH = $(DYLIB_INSTALL_NAME_EXECUTABLE_NAME)
113 LD_DYLIB_INSTALL_NAME = $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(DYLIB_INSTALL_NAME_EXECUTABLE_PATH)