1*f6217f89SApple OSS Distributions# -*- mode: makefile;-*- 2*f6217f89SApple OSS Distributions# 3*f6217f89SApple OSS Distributions# Copyright (C) 1999-2025 Apple Inc. All rights reserved. 4*f6217f89SApple OSS Distributions# 5*f6217f89SApple OSS Distributions# MakeInc.def contains global definitions for building, 6*f6217f89SApple OSS Distributions# linking, and installing files. 7*f6217f89SApple OSS Distributions# 8*f6217f89SApple OSS Distributions 9*f6217f89SApple OSS Distributions# 10*f6217f89SApple OSS Distributions# Architecture Configuration options 11*f6217f89SApple OSS Distributions# 12*f6217f89SApple OSS DistributionsSUPPORTED_ARCH_CONFIGS := X86_64 X86_64H ARM64 13*f6217f89SApple OSS Distributions 14*f6217f89SApple OSS Distributions# 15*f6217f89SApple OSS Distributions# Kernel Configuration options 16*f6217f89SApple OSS Distributions# 17*f6217f89SApple OSS DistributionsSUPPORTED_KERNEL_CONFIGS = RELEASE DEVELOPMENT DEBUG PROFILE KASAN SPTM 18*f6217f89SApple OSS Distributions 19*f6217f89SApple OSS Distributions 20*f6217f89SApple OSS Distributions# 21*f6217f89SApple OSS Distributions# Machine Configuration options 22*f6217f89SApple OSS Distributions# 23*f6217f89SApple OSS Distributions 24*f6217f89SApple OSS DistributionsSUPPORTED_X86_64_MACHINE_CONFIGS = NONE 25*f6217f89SApple OSS DistributionsSUPPORTED_X86_64H_MACHINE_CONFIGS = NONE 26*f6217f89SApple OSS Distributions 27*f6217f89SApple OSS Distributionsifneq ($(findstring _Sim,$(RC_ProjectName)),) 28*f6217f89SApple OSS DistributionsSUPPORTED_ARM64_MACHINE_CONFIGS = NONE 29*f6217f89SApple OSS Distributionselse ifneq ($(findstring _host,$(RC_ProjectName)),) 30*f6217f89SApple OSS DistributionsSUPPORTED_ARM64_MACHINE_CONFIGS = NONE 31*f6217f89SApple OSS Distributionselse 32*f6217f89SApple OSS DistributionsSUPPORTED_ARM64_MACHINE_CONFIGS = T6000 T6020 T6030 T6031 T6041 T8101 T8103 T8112 T8122 T8132 VMAPPLE 33*f6217f89SApple OSS Distributions 34*f6217f89SApple OSS DistributionsSPTM_ENABLED_SOCS_MacOSX = t8112 t6020 t8122 t6030 t6031 t8132 t6041 35*f6217f89SApple OSS Distributions 36*f6217f89SApple OSS Distributions 37*f6217f89SApple OSS Distributionsendif 38*f6217f89SApple OSS Distributions 39*f6217f89SApple OSS Distributions# 40*f6217f89SApple OSS Distributions# Setup up *_LC variables during recursive invocations 41*f6217f89SApple OSS Distributions# 42*f6217f89SApple OSS Distributions 43*f6217f89SApple OSS Distributionsifndef CURRENT_ARCH_CONFIG_LC 44*f6217f89SApple OSS Distributions export CURRENT_ARCH_CONFIG_LC := $(shell printf "%s" "$(CURRENT_ARCH_CONFIG)" | $(TR) A-Z a-z) 45*f6217f89SApple OSS Distributionsendif 46*f6217f89SApple OSS Distributions 47*f6217f89SApple OSS Distributionsifndef CURRENT_KERNEL_CONFIG_LC 48*f6217f89SApple OSS Distributions export CURRENT_KERNEL_CONFIG_LC := $(shell printf "%s" "$(CURRENT_KERNEL_CONFIG)" | $(TR) A-Z a-z) 49*f6217f89SApple OSS Distributionsendif 50*f6217f89SApple OSS Distributions 51*f6217f89SApple OSS Distributionsifndef CURRENT_MACHINE_CONFIG_LC 52*f6217f89SApple OSS Distributions export CURRENT_MACHINE_CONFIG_LC := $(shell printf "%s" "$(CURRENT_MACHINE_CONFIG)" | $(TR) A-Z a-z) 53*f6217f89SApple OSS Distributionsendif 54*f6217f89SApple OSS Distributions 55*f6217f89SApple OSS DistributionsARM64_EXTRA_BUILD_FLAGS = 56*f6217f89SApple OSS Distributions 57*f6217f89SApple OSS Distributions# Enable BTI by default for all ARM64 targets 58*f6217f89SApple OSS DistributionsBTI_BUILD = 1 59*f6217f89SApple OSS Distributions 60*f6217f89SApple OSS Distributions 61*f6217f89SApple OSS Distributions# -mkernel contains BTI by default 62*f6217f89SApple OSS Distributionsifeq ($(BTI_BUILD),1) 63*f6217f89SApple OSS Distributions ARM64_EXTRA_BUILD_FLAGS += -DXNU_BUILT_WITH_BTI 64*f6217f89SApple OSS Distributionselse 65*f6217f89SApple OSS Distributions ARM64_EXTRA_BUILD_FLAGS += -fno-branch-target-identification -UXNU_BUILT_WITH_BTI 66*f6217f89SApple OSS Distributionsendif 67*f6217f89SApple OSS Distributions 68*f6217f89SApple OSS Distributions 69*f6217f89SApple OSS Distributions# 70*f6217f89SApple OSS Distributions# Component List 71*f6217f89SApple OSS Distributions# 72*f6217f89SApple OSS DistributionsCOMPONENT_LIST = osfmk bsd libkern iokit pexpert libsa security san 73*f6217f89SApple OSS DistributionsCOMPONENT = $(if $(word 2,$(subst /, ,$(RELATIVE_SOURCE_PATH))),$(word 2,$(subst /, ,$(RELATIVE_SOURCE_PATH))),$(firstword $(subst /, ,$(RELATIVE_SOURCE_PATH)))) 74*f6217f89SApple OSS DistributionsCOMPONENT_IMPORT_LIST = $(filter-out $(COMPONENT),$(COMPONENT_LIST)) 75*f6217f89SApple OSS Distributions 76*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T8101 = -DARM64_BOARD_CONFIG_T8101 -mcpu=apple-a14 77*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T8103 = -DARM64_BOARD_CONFIG_T8103 -mcpu=apple-a14 78*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T6000 = -DARM64_BOARD_CONFIG_T6000 -mcpu=apple-a14 79*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T6020 = -DARM64_BOARD_CONFIG_T6020 -mcpu=apple-a15 80*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T8112 = -DARM64_BOARD_CONFIG_T8112 -mcpu=apple-a15 81*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T6030 = -DARM64_BOARD_CONFIG_T6030 -mcpu=apple-m3 82*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T6031 = -DARM64_BOARD_CONFIG_T6031 -mcpu=apple-m3 83*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T6041 = -DARM64_BOARD_CONFIG_T6041 -mcpu=apple-m4 84*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T8122 = -DARM64_BOARD_CONFIG_T8122_T8130 -mcpu=apple-m3 85*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_T8132 = -DARM64_BOARD_CONFIG_T8132 -mcpu=apple-m4 86*f6217f89SApple OSS Distributions 87*f6217f89SApple OSS DistributionsMACHINE_FLAGS_ARM64_VMAPPLE = -DARM64_BOARD_CONFIG_VMAPPLE -march=armv8.5a+sme2 88*f6217f89SApple OSS Distributions 89*f6217f89SApple OSS Distributions 90*f6217f89SApple OSS Distributions# 91*f6217f89SApple OSS Distributions# Deployment target flag 92*f6217f89SApple OSS Distributions# 93*f6217f89SApple OSS Distributionsifeq ($(PLATFORM),MacOSX) 94*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -mmacosx-version-min=$(SDKVERSION) -DXNU_TARGET_OS_OSX 95*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = -Wl,-macosx_version_min,$(SDKVERSION) 96*f6217f89SApple OSS Distributionselse ifeq ($(PLATFORM),DriverKit) 97*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -target apple-driverkit$(SDKVERSION) -DXNU_TARGET_OS_OSX 98*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = -Wl,-target,apple-driverkit$(SDKVERSION) 99*f6217f89SApple OSS Distributionselse ifeq ($(PLATFORM),WatchOS) 100*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -mwatchos-version-min=$(SDKVERSION) -DXNU_TARGET_OS_WATCH 101*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = 102*f6217f89SApple OSS Distributionselse ifeq ($(PLATFORM),tvOS) 103*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION) -DXNU_TARGET_OS_TV 104*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = 105*f6217f89SApple OSS Distributionselse ifeq ($(PLATFORM),AppleTVOS) 106*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION) -DXNU_TARGET_OS_TV 107*f6217f89SApple OSS Distributionselse ifeq ($(PLATFORM),BridgeOS) 108*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -mbridgeos-version-min=$(SDKVERSION) -DXNU_TARGET_OS_BRIDGE 109*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = 110*f6217f89SApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),) 111*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = -miphoneos-version-min=$(SDKVERSION) -DXNU_TARGET_OS_IOS 112*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = -Wl,-ios_version_min,$(SDKVERSION) 113*f6217f89SApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),) 114*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = 115*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = 116*f6217f89SApple OSS Distributionselse 117*f6217f89SApple OSS Distributions DEPLOYMENT_TARGET_FLAGS = 118*f6217f89SApple OSS Distributions DEPLOYMENT_LINKER_FLAGS = 119*f6217f89SApple OSS Distributionsendif 120*f6217f89SApple OSS Distributions 121*f6217f89SApple OSS Distributions 122*f6217f89SApple OSS DistributionsDEPLOYMENT_TARGET_DEFINES = -DXNU_PLATFORM_$(PLATFORM) 123*f6217f89SApple OSS Distributions 124*f6217f89SApple OSS Distributions 125*f6217f89SApple OSS Distributions# 126*f6217f89SApple OSS Distributions# Standard defines list 127*f6217f89SApple OSS Distributions# 128*f6217f89SApple OSS DistributionsDEFINES = -DAPPLE -DKERNEL -DKERNEL_PRIVATE -DXNU_KERNEL_PRIVATE \ 129*f6217f89SApple OSS Distributions -DPRIVATE -D__MACHO__=1 -Dvolatile=__volatile -DXNU_KERN_EVENT_DATA_IS_VLA \ 130*f6217f89SApple OSS Distributions -DCURRENT_MACHINE_CONFIG_LC=$(CURRENT_MACHINE_CONFIG_LC) \ 131*f6217f89SApple OSS Distributions $(CONFIG_DEFINES) $(SEED_DEFINES) 132*f6217f89SApple OSS Distributions 133*f6217f89SApple OSS Distributions# Append experimental definition 134*f6217f89SApple OSS Distributionsifneq ($(RC_EXPERIMENTAL_SYSTEM_VERSION_COMPAT),) 135*f6217f89SApple OSS DistributionsDEFINES += -DXNU_EXPERIMENTAL_SYSTEM_VERSION_COMPAT 136*f6217f89SApple OSS Distributionsendif 137*f6217f89SApple OSS Distributions 138*f6217f89SApple OSS Distributions# Enable caching with `make CCACHE=ccache` 139*f6217f89SApple OSS Distributions# This intentionally does not override $(CC) because that will confuse 140*f6217f89SApple OSS Distributions# utilities like mig. 141*f6217f89SApple OSS DistributionsCCACHE ?= 142*f6217f89SApple OSS Distributions 143*f6217f89SApple OSS Distributions# 144*f6217f89SApple OSS Distributions# Compiler command 145*f6217f89SApple OSS Distributions# 146*f6217f89SApple OSS DistributionsKCC = $(CCACHE) $(CC) 147*f6217f89SApple OSS DistributionsKC++ = $(CCACHE) $(CXX) 148*f6217f89SApple OSS Distributions 149*f6217f89SApple OSS DistributionsGENASSYM_KCC = $(CCACHE) $(CC) 150*f6217f89SApple OSS Distributions 151*f6217f89SApple OSS Distributions# 152*f6217f89SApple OSS Distributions# Compiler warning flags 153*f6217f89SApple OSS Distributions# 154*f6217f89SApple OSS Distributions 155*f6217f89SApple OSS DistributionsUSE_WERROR := 1 156*f6217f89SApple OSS Distributionsifneq ($(BUILD_WERROR),) 157*f6217f89SApple OSS DistributionsUSE_WERROR := $(BUILD_WERROR) 158*f6217f89SApple OSS Distributionsendif 159*f6217f89SApple OSS Distributions 160*f6217f89SApple OSS Distributionsifeq ($(USE_WERROR),1) 161*f6217f89SApple OSS DistributionsWERROR := -Werror 162*f6217f89SApple OSS Distributionsendif 163*f6217f89SApple OSS Distributions 164*f6217f89SApple OSS Distributions# Shared C/C++ warning flags 165*f6217f89SApple OSS Distributions# NOTE: order matters here. -Wno-xxx goes before opt-in of ones we want 166*f6217f89SApple OSS DistributionsWARNFLAGS_STD := \ 167*f6217f89SApple OSS Distributions -Weverything \ 168*f6217f89SApple OSS Distributions -Wundef-prefix=TARGET_OS_ \ 169*f6217f89SApple OSS Distributions -Wundef-prefix=LCK_GRP_USE_ARG \ 170*f6217f89SApple OSS Distributions -Wno-pedantic \ 171*f6217f89SApple OSS Distributions $(WERROR) \ 172*f6217f89SApple OSS Distributions -Wno-bad-function-cast \ 173*f6217f89SApple OSS Distributions -Wno-bitwise-instead-of-logical \ 174*f6217f89SApple OSS Distributions -Wno-c++-compat \ 175*f6217f89SApple OSS Distributions -Wno-c++98-compat \ 176*f6217f89SApple OSS Distributions -Wno-conditional-uninitialized \ 177*f6217f89SApple OSS Distributions -Wno-covered-switch-default \ 178*f6217f89SApple OSS Distributions -Wno-disabled-macro-expansion \ 179*f6217f89SApple OSS Distributions -Wno-documentation-unknown-command \ 180*f6217f89SApple OSS Distributions -Wno-extra-semi-stmt \ 181*f6217f89SApple OSS Distributions -Wno-format-non-iso \ 182*f6217f89SApple OSS Distributions -Wno-language-extension-token \ 183*f6217f89SApple OSS Distributions -Wno-missing-variable-declarations \ 184*f6217f89SApple OSS Distributions -Wno-packed \ 185*f6217f89SApple OSS Distributions -Wno-padded \ 186*f6217f89SApple OSS Distributions -Wno-partial-availability \ 187*f6217f89SApple OSS Distributions -Wno-reserved-id-macro \ 188*f6217f89SApple OSS Distributions -Wno-shift-sign-overflow \ 189*f6217f89SApple OSS Distributions -Wno-switch-enum \ 190*f6217f89SApple OSS Distributions -Wno-unaligned-access \ 191*f6217f89SApple OSS Distributions -Wno-undef \ 192*f6217f89SApple OSS Distributions -Wno-invalid-offsetof \ 193*f6217f89SApple OSS Distributions -Wno-unused-macros \ 194*f6217f89SApple OSS Distributions -Wno-used-but-marked-unused \ 195*f6217f89SApple OSS Distributions -Wno-variadic-macros \ 196*f6217f89SApple OSS Distributions -Wno-zero-length-array \ 197*f6217f89SApple OSS Distributions -Wno-packed \ 198*f6217f89SApple OSS Distributions -Wno-cast-function-type-strict \ 199*f6217f89SApple OSS Distributions -Wno-incompatible-function-pointer-types-strict 200*f6217f89SApple OSS Distributions 201*f6217f89SApple OSS Distributions# When a new clang has new warnings disable them here until the kernel is fixed. 202*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 203*f6217f89SApple OSS Distributions -Wno-unknown-warning-option \ 204*f6217f89SApple OSS Distributions -Wno-anon-enum-enum-conversion \ 205*f6217f89SApple OSS Distributions -Wno-error=enum-enum-conversion \ 206*f6217f89SApple OSS Distributions -Wno-error=c99-designator \ 207*f6217f89SApple OSS Distributions -Wno-error=reorder-init-list \ 208*f6217f89SApple OSS Distributions -Wno-error=switch-default \ 209*f6217f89SApple OSS Distributions -Wno-error=four-char-constants \ 210*f6217f89SApple OSS Distributions -Wno-error=suggest-override \ 211*f6217f89SApple OSS Distributions -Wno-error=suggest-destructor-override \ 212*f6217f89SApple OSS Distributions -Wno-error=tautological-value-range-compare \ 213*f6217f89SApple OSS Distributions -Wno-error=null-pointer-subtraction \ 214*f6217f89SApple OSS Distributions -Wno-deprecated-volatile \ 215*f6217f89SApple OSS Distributions -Wno-error=incompatible-function-pointer-types-strict \ 216*f6217f89SApple OSS Distributions -Wno-cast-function-type-strict 217*f6217f89SApple OSS Distributions 218*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 219*f6217f89SApple OSS Distributions -Wno-declaration-after-statement 220*f6217f89SApple OSS Distributions 221*f6217f89SApple OSS Distributions# Hand-written sign conversion diagnostics are resolved, but the 222*f6217f89SApple OSS Distributions# auto-generated ones need mig and iig to be updated to fix. Disable the 223*f6217f89SApple OSS Distributions# diagnostic here until we've completed that: 224*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 225*f6217f89SApple OSS Distributions -Wno-sign-compare \ 226*f6217f89SApple OSS Distributions -Wno-sign-conversion 227*f6217f89SApple OSS Distributions 228*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 229*f6217f89SApple OSS Distributions -Wno-pre-c11-compat 230*f6217f89SApple OSS Distributions 231*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 232*f6217f89SApple OSS Distributions -Wno-missing-designated-field-initializers 233*f6217f89SApple OSS Distributions 234*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 235*f6217f89SApple OSS Distributions -Wno-format-signedness 236*f6217f89SApple OSS Distributions 237*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 238*f6217f89SApple OSS Distributions -Wno-switch-default 239*f6217f89SApple OSS Distributions 240*f6217f89SApple OSS Distributions# Opt-ins: 241*f6217f89SApple OSS DistributionsWARNFLAGS_STD := $(WARNFLAGS_STD) \ 242*f6217f89SApple OSS Distributions -Wpointer-arith \ 243*f6217f89SApple OSS Distributions -Wxnu-typed-allocators 244*f6217f89SApple OSS Distributions 245*f6217f89SApple OSS Distributions 246*f6217f89SApple OSS DistributionsCWARNFLAGS_STD = \ 247*f6217f89SApple OSS Distributions $(WARNFLAGS_STD) 248*f6217f89SApple OSS Distributions 249*f6217f89SApple OSS Distributions 250*f6217f89SApple OSS Distributions# Can be overridden in Makefile.template or Makefile.$arch 251*f6217f89SApple OSS Distributionsexport CWARNFLAGS ?= $(CWARNFLAGS_STD) 252*f6217f89SApple OSS Distributions 253*f6217f89SApple OSS Distributionsdefine add_perfile_cflags 254*f6217f89SApple OSS Distributions$(1)_CWARNFLAGS_ADD += $2 255*f6217f89SApple OSS Distributionsendef 256*f6217f89SApple OSS Distributions 257*f6217f89SApple OSS Distributionsdefine rm_perfile_cflags 258*f6217f89SApple OSS Distributions$(1)_CFLAGS_RM += $2 259*f6217f89SApple OSS Distributionsendef 260*f6217f89SApple OSS Distributions 261*f6217f89SApple OSS DistributionsCXXWARNFLAGS_STD = \ 262*f6217f89SApple OSS Distributions $(WARNFLAGS_STD) \ 263*f6217f89SApple OSS Distributions -Wno-c++98-compat-pedantic \ 264*f6217f89SApple OSS Distributions -Wno-exit-time-destructors \ 265*f6217f89SApple OSS Distributions -Wno-global-constructors \ 266*f6217f89SApple OSS Distributions -Wno-old-style-cast 267*f6217f89SApple OSS Distributions 268*f6217f89SApple OSS Distributions# Can be overridden in Makefile.template or Makefile.$arch 269*f6217f89SApple OSS Distributionsexport CXXWARNFLAGS ?= $(CXXWARNFLAGS_STD) 270*f6217f89SApple OSS Distributions 271*f6217f89SApple OSS Distributionsdefine add_perfile_cxxflags 272*f6217f89SApple OSS Distributions$(1)_CXXWARNFLAGS_ADD += $2 273*f6217f89SApple OSS Distributionsendef 274*f6217f89SApple OSS Distributions 275*f6217f89SApple OSS Distributions# 276*f6217f89SApple OSS Distributions# Default ARCH_FLAGS, for use with compiler/linker/assembler/mig drivers 277*f6217f89SApple OSS Distributions 278*f6217f89SApple OSS DistributionsARCH_FLAGS_X86_64 = -arch x86_64 279*f6217f89SApple OSS DistributionsARCH_FLAGS_X86_64H = -arch x86_64h 280*f6217f89SApple OSS Distributions 281*f6217f89SApple OSS Distributionsifeq ($(RC_ProjectName),xnu_libraries) 282*f6217f89SApple OSS DistributionsBUILD_STATIC_LINK := 1 283*f6217f89SApple OSS DistributionsBUILD_XNU_LIBRARY := 1 284*f6217f89SApple OSS DistributionsRC_NONARCH_CFLAGS += -D__BUILDING_XNU_LIBRARY__=1 285*f6217f89SApple OSS Distributionsifneq ($(XNU_LibFlavour),) 286*f6217f89SApple OSS DistributionsRC_NONARCH_CFLAGS += -D__BUILDING_XNU_LIB_$(XNU_LibFlavour)__=1 287*f6217f89SApple OSS Distributionsendif 288*f6217f89SApple OSS Distributionsendif 289*f6217f89SApple OSS Distributions 290*f6217f89SApple OSS Distributionsifneq ($(filter ARM ARM64,$(CURRENT_ARCH_CONFIG)),) 291*f6217f89SApple OSS Distributions 292*f6217f89SApple OSS Distributionsifneq ($(findstring _Sim,$(RC_ProjectName)),) 293*f6217f89SApple OSS DistributionsARCH_FLAGS_ARM64 = -arch arm64e 294*f6217f89SApple OSS Distributionselse ifneq ($(findstring _host,$(RC_ProjectName)),) 295*f6217f89SApple OSS DistributionsARCH_FLAGS_ARM64 = -arch arm64e 296*f6217f89SApple OSS Distributionselse 297*f6217f89SApple OSS Distributions 298*f6217f89SApple OSS DistributionsARCH_STRING_FOR_CURRENT_MACHINE_CONFIG ?= 299*f6217f89SApple OSS Distributions 300*f6217f89SApple OSS Distributionsifeq ($(ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG),) 301*f6217f89SApple OSS Distributions 302*f6217f89SApple OSS Distributionsifneq ($(EMBEDDED_DEVICE_MAP),) 303*f6217f89SApple OSS Distributionsexport ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -list -query SELECT DISTINCT KernelMachOArchitecture FROM Targets WHERE KernelPlatform IS \"$(CURRENT_MACHINE_CONFIG_LC)\" LIMIT 1 || echo UNKNOWN ) 304*f6217f89SApple OSS Distributionsifeq ($(ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG),) 305*f6217f89SApple OSS Distributionsifeq ($(filter $(EXTRA_TARGET_CONFIGS_$(CURRENT_KERNEL_CONFIG)),$(CURRENT_MACHINE_CONFIG)),) 306*f6217f89SApple OSS Distributions$(error Machine config $(CURRENT_MACHINE_CONFIG_LC) not found in EmbeddedDeviceMap) 307*f6217f89SApple OSS Distributionsendif 308*f6217f89SApple OSS Distributionsendif 309*f6217f89SApple OSS Distributionsendif 310*f6217f89SApple OSS Distributions 311*f6217f89SApple OSS Distributionsendif 312*f6217f89SApple OSS Distributions 313*f6217f89SApple OSS Distributionsifeq ($(ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG),) 314*f6217f89SApple OSS Distributions 315*f6217f89SApple OSS Distributions# Without embdedded device map, use a default arch string 316*f6217f89SApple OSS Distributionsexport ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG := $(shell echo $(CURRENT_ARCH_CONFIG) | tr A-Z a-z) 317*f6217f89SApple OSS Distributionsifneq ($(filter arm64,$(ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG)),) 318*f6217f89SApple OSS Distributionsexport ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG := arm64e 319*f6217f89SApple OSS Distributionsendif 320*f6217f89SApple OSS Distributions 321*f6217f89SApple OSS Distributionsendif 322*f6217f89SApple OSS Distributions 323*f6217f89SApple OSS Distributions 324*f6217f89SApple OSS DistributionsBUILD_STATIC_LINK := 1 325*f6217f89SApple OSS Distributions 326*f6217f89SApple OSS DistributionsARCH_FLAGS_ARM64 = -arch $(ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG) 327*f6217f89SApple OSS Distributions 328*f6217f89SApple OSS Distributionsendif 329*f6217f89SApple OSS Distributions 330*f6217f89SApple OSS Distributionselse 331*f6217f89SApple OSS Distributions# non arm machine config string 332*f6217f89SApple OSS Distributionsifndef ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG 333*f6217f89SApple OSS Distributionsexport ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG := $(shell echo $(CURRENT_ARCH_CONFIG) | tr A-Z a-z) 334*f6217f89SApple OSS Distributionsendif 335*f6217f89SApple OSS Distributions 336*f6217f89SApple OSS Distributionsendif 337*f6217f89SApple OSS Distributions 338*f6217f89SApple OSS Distributions# 339*f6217f89SApple OSS Distributions# Default CFLAGS 340*f6217f89SApple OSS Distributions# 341*f6217f89SApple OSS Distributionsifdef RC_NONARCH_CFLAGS 342*f6217f89SApple OSS DistributionsOTHER_CFLAGS = $(RC_NONARCH_CFLAGS) 343*f6217f89SApple OSS Distributionsendif 344*f6217f89SApple OSS Distributions 345*f6217f89SApple OSS Distributions# 346*f6217f89SApple OSS Distributions# Debug info 347*f6217f89SApple OSS Distributions# 348*f6217f89SApple OSS DistributionsDSYMINFODIR = Contents 349*f6217f89SApple OSS DistributionsDSYMKGMACROSDIR = Contents/Resources 350*f6217f89SApple OSS DistributionsDSYMLLDBMACROSDIR = Contents/Resources/Python 351*f6217f89SApple OSS DistributionsDSYMDWARFDIR = Contents/Resources/DWARF 352*f6217f89SApple OSS Distributions 353*f6217f89SApple OSS DistributionsDEBUG_CFLAGS := -g 354*f6217f89SApple OSS DistributionsBUILD_DSYM := 1 355*f6217f89SApple OSS Distributions 356*f6217f89SApple OSS Distributions# 357*f6217f89SApple OSS Distributions# We must not use -fno-keep-inline-functions, or it will remove the dtrace 358*f6217f89SApple OSS Distributions# probes from the kernel. 359*f6217f89SApple OSS Distributions# 360*f6217f89SApple OSS DistributionsCFLAGS_GEN = $(DEBUG_CFLAGS) -nostdlibinc \ 361*f6217f89SApple OSS Distributions -ferror-limit=10000 \ 362*f6217f89SApple OSS Distributions -fno-builtin \ 363*f6217f89SApple OSS Distributions -fno-common \ 364*f6217f89SApple OSS Distributions -ftrivial-auto-var-init=zero \ 365*f6217f89SApple OSS Distributions -fsigned-bitfields \ 366*f6217f89SApple OSS Distributions -fmerge-all-constants \ 367*f6217f89SApple OSS Distributions -fno-c++-static-destructors \ 368*f6217f89SApple OSS Distributions -Wframe-larger-than=0 -Wno-frame-larger-than \ 369*f6217f89SApple OSS Distributions $(OTHER_CFLAGS) 370*f6217f89SApple OSS Distributions 371*f6217f89SApple OSS DistributionsCFLAGS_RELEASE = 372*f6217f89SApple OSS DistributionsCFLAGS_DEVELOPMENT = 373*f6217f89SApple OSS DistributionsCFLAGS_DEBUG = 374*f6217f89SApple OSS DistributionsCFLAGS_KASAN = $(CFLAGS_DEVELOPMENT) 375*f6217f89SApple OSS DistributionsCFLAGS_PROFILE = -pg 376*f6217f89SApple OSS Distributions 377*f6217f89SApple OSS DistributionsCFLAGS_X86_64 = -Dx86_64 -DX86_64 -D__X86_64__ -DLP64 \ 378*f6217f89SApple OSS Distributions -DPAGE_SIZE_FIXED -mkernel -msoft-float 379*f6217f89SApple OSS Distributions 380*f6217f89SApple OSS DistributionsCFLAGS_X86_64H = $(CFLAGS_X86_64) 381*f6217f89SApple OSS Distributions 382*f6217f89SApple OSS Distributions# By default, all ARM64 targets use the small memory config 383*f6217f89SApple OSS DistributionsARM64_LARGE_MEMORY = 0 384*f6217f89SApple OSS DistributionsARM64_PLKSEG_ADDR = 0xfffffff004004000 385*f6217f89SApple OSS DistributionsARM64_LINK_ADDR = 0xfffffff007004000 386*f6217f89SApple OSS Distributions 387*f6217f89SApple OSS Distributions# Use ARM_LARGE_MEMORY config for all MacOSX targets. 388*f6217f89SApple OSS Distributionsifneq ($(filter $(PLATFORM),MacOSX),) 389*f6217f89SApple OSS DistributionsARM64_LARGE_MEMORY = 1 390*f6217f89SApple OSS DistributionsARM64_PLKSEG_ADDR = 0xfffffe0004004000 391*f6217f89SApple OSS DistributionsARM64_LINK_ADDR = 0xfffffe0007004000 392*f6217f89SApple OSS Distributionsendif 393*f6217f89SApple OSS Distributions 394*f6217f89SApple OSS Distributions 395*f6217f89SApple OSS Distributionsifeq ($(ARM64_LARGE_MEMORY),1) 396*f6217f89SApple OSS Distributions ARM64_EXTRA_BUILD_FLAGS += -DARM_LARGE_MEMORY=1 397*f6217f89SApple OSS Distributionselse 398*f6217f89SApple OSS Distributions ARM64_EXTRA_BUILD_FLAGS += -UARM_LARGE_MEMORY 399*f6217f89SApple OSS Distributionsendif 400*f6217f89SApple OSS Distributions 401*f6217f89SApple OSS Distributionsifeq ($(ARM64_LARGE_MEMORY_KERNONLY),1) 402*f6217f89SApple OSS Distributions ARM64_EXTRA_BUILD_FLAGS += -DARM_LARGE_MEMORY_KERNONLY=1 403*f6217f89SApple OSS Distributionselse 404*f6217f89SApple OSS Distributions ARM64_EXTRA_BUILD_FLAGS += -UARM_LARGE_MEMORY_KERNONLY 405*f6217f89SApple OSS Distributionsendif 406*f6217f89SApple OSS Distributions 407*f6217f89SApple OSS Distributions 408*f6217f89SApple OSS Distributions 409*f6217f89SApple OSS Distributionsifeq ($(BUILD_XNU_LIBRARY),1) 410*f6217f89SApple OSS Distributions# __static_testable makes some static function not static and generate these warnings 411*f6217f89SApple OSS DistributionsCFLAGS_KERNEL = -Wno-missing-prototypes 412*f6217f89SApple OSS Distributionselse 413*f6217f89SApple OSS DistributionsCFLAGS_KERNEL = -mkernel 414*f6217f89SApple OSS Distributionsendif 415*f6217f89SApple OSS Distributions 416*f6217f89SApple OSS DistributionsCFLAGS_ARM64 = -Darm64 -DARM64 -D__ARM64__ -DLP64 -DPAGE_SIZE_FIXED -DVM_KERNEL_LINK_ADDRESS=$(ARM64_LINK_ADDR) \ 417*f6217f89SApple OSS Distributions $(ARM64_EXTRA_BUILD_FLAGS) -mno-implicit-sme -momit-leaf-frame-pointer -fno-strict-aliasing -D__API__=v4 $(CFLAGS_KERNEL) 418*f6217f89SApple OSS Distributions 419*f6217f89SApple OSS DistributionsCXXFLAGS_ARM64 = $(ARM64_EXTRA_BUILD_FLAGS) 420*f6217f89SApple OSS Distributions 421*f6217f89SApple OSS DistributionsCFLAGS_RELEASEX86_64 = -O2 422*f6217f89SApple OSS DistributionsCFLAGS_DEVELOPMENTX86_64 = -O2 423*f6217f89SApple OSS DistributionsCFLAGS_KASANX86_64 = $(CFLAGS_DEVELOPMENTX86_64) 424*f6217f89SApple OSS Distributions# No space optimization for the DEBUG kernel for the benefit of gdb: 425*f6217f89SApple OSS DistributionsCFLAGS_DEBUGX86_64 = -O0 426*f6217f89SApple OSS DistributionsCFLAGS_PROFILEX86_64 = -O2 427*f6217f89SApple OSS Distributions 428*f6217f89SApple OSS DistributionsCFLAGS_RELEASEX86_64H = -O2 429*f6217f89SApple OSS DistributionsCFLAGS_DEVELOPMENTX86_64H = -O2 430*f6217f89SApple OSS DistributionsCFLAGS_KASANX86_64H = $(CFLAGS_DEVELOPMENTX86_64H) 431*f6217f89SApple OSS Distributions# No space optimization for the DEBUG kernel for the benefit of gdb: 432*f6217f89SApple OSS DistributionsCFLAGS_DEBUGX86_64H = -O0 433*f6217f89SApple OSS DistributionsCFLAGS_PROFILEX86_64H = -O2 434*f6217f89SApple OSS Distributions 435*f6217f89SApple OSS DistributionsCFLAGS_RELEASEARM = -O2 436*f6217f89SApple OSS DistributionsCFLAGS_DEVELOPMENTARM = -O2 437*f6217f89SApple OSS DistributionsCFLAGS_DEBUGARM = -O0 438*f6217f89SApple OSS DistributionsCFLAGS_PROFILEARM = -O2 439*f6217f89SApple OSS Distributions 440*f6217f89SApple OSS DistributionsCFLAGS_RELEASEARM64 = -O2 441*f6217f89SApple OSS DistributionsCFLAGS_DEVELOPMENTARM64 = -O2 442*f6217f89SApple OSS DistributionsCFLAGS_KASANARM64 = $(CFLAGS_DEVELOPMENTARM64) 443*f6217f89SApple OSS DistributionsCFLAGS_DEBUGARM64 = -O0 444*f6217f89SApple OSS DistributionsCFLAGS_SPTMARM64 = $(CFLAGS_DEVELOPMENTARM64) 445*f6217f89SApple OSS DistributionsCFLAGS_PROFILEARM64 = -O2 446*f6217f89SApple OSS Distributions 447*f6217f89SApple OSS Distributions# 448*f6217f89SApple OSS Distributions# bounds-safety support 449*f6217f89SApple OSS Distributions# 450*f6217f89SApple OSS Distributions# Controlling flags: 451*f6217f89SApple OSS Distributions# 452*f6217f89SApple OSS Distributions# BOUND_CHECKS controls the support for the bounds-safety features. 453*f6217f89SApple OSS Distributions# - On x86_64, bounds-safety features are disabled. 454*f6217f89SApple OSS Distributions# - On other platforms, explicitly setting BOUND_CHECKS=0 455*f6217f89SApple OSS Distributions# disables the support for the bounds-safety features 456*f6217f89SApple OSS Distributions# - Otherwise, the support for the bounds-safety features 457*f6217f89SApple OSS Distributions# is dynamically detected. 458*f6217f89SApple OSS Distributions# 459*f6217f89SApple OSS Distributions# BOUND_CHECKS_SOFT controls the support for the resumption of the bounds-safety traps. 460*f6217f89SApple OSS Distributions# - On x86_64, resumption of bounds-safety traps is not available. 461*f6217f89SApple OSS Distributions# - On other platforms, explicitly setting BOUND_CHECKS_SOFT=0 462*f6217f89SApple OSS Distributions# disables the support for the bounds-safety resumption 463*f6217f89SApple OSS Distributions# - Otherwise, the support for the bounds-safety features 464*f6217f89SApple OSS Distributions# is dynamically detected. 465*f6217f89SApple OSS Distributions# 466*f6217f89SApple OSS Distributions# Note: while it is generally expected that BOUND_CHECKS_SOFT will always 467*f6217f89SApple OSS Distributions# be accompanied with BOUND_CHECKS, a developer is allowed to use 468*f6217f89SApple OSS Distributions# BOUND_CHECKS_SOFT=1 as a shortcut for BOUND_CHECKS=1 BOUND_CHECKS_SOFT=1 469*f6217f89SApple OSS Distributions# The combination BOUND_CHECKS_SOFT=1 BOUND_CHECKS=0 is not supported. 470*f6217f89SApple OSS Distributions# 471*f6217f89SApple OSS Distributions# 472*f6217f89SApple OSS Distributionsifndef BOUND_CHECKS 473*f6217f89SApple OSS Distributions ifeq ($(shell $(CC) -E -fbounds-safety /dev/null 2>/dev/null && echo 1),1) 474*f6217f89SApple OSS Distributions BOUND_CHECKS := 1 475*f6217f89SApple OSS Distributions else 476*f6217f89SApple OSS Distributions BOUND_CHECKS := 0 477*f6217f89SApple OSS Distributions endif 478*f6217f89SApple OSS Distributions export BOUND_CHECKS 479*f6217f89SApple OSS Distributionsendif # ifndef BOUND_CHECKS 480*f6217f89SApple OSS Distributions 481*f6217f89SApple OSS Distributionsifndef BOUND_CHECKS_SOFT 482*f6217f89SApple OSS Distributions ifeq ($(shell $(CC) -E -fbounds-safety -ftrap-function-returns /dev/null 2>/dev/null && echo 1),1) 483*f6217f89SApple OSS Distributions BOUND_CHECKS_SOFT := 1 484*f6217f89SApple OSS Distributions else 485*f6217f89SApple OSS Distributions BOUND_CHECKS_SOFT := 0 486*f6217f89SApple OSS Distributions endif 487*f6217f89SApple OSS Distributions export BOUND_CHECKS_SOFT 488*f6217f89SApple OSS Distributionsendif # ifndef BOUND_CHECKS_SOFT 489*f6217f89SApple OSS Distributions 490*f6217f89SApple OSS Distributions# On x86_64, the bounds-safety features are disabled 491*f6217f89SApple OSS Distributionsifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64) 492*f6217f89SApple OSS Distributions BOUND_CHECKS := 0 493*f6217f89SApple OSS Distributions BOUND_CHECKS_SOFT := 0 494*f6217f89SApple OSS Distributionsendif # x86_64 495*f6217f89SApple OSS Distributions 496*f6217f89SApple OSS Distributions# if BOUND_CHECKS_SOFT is enabled, ensure that BOUND_CHECKS is enabled as well 497*f6217f89SApple OSS Distributionsifneq ($(BOUND_CHECKS_SOFT),0) 498*f6217f89SApple OSS Distributions ifeq ($(BOUND_CHECKS),0) 499*f6217f89SApple OSS Distributions BOUND_CHECKS := 1 500*f6217f89SApple OSS Distributions endif # ifeq ($(BOUND_CHECKS),0) 501*f6217f89SApple OSS Distributionsendif # ifneq($(BOUND_CHECKS_SOFT),0) 502*f6217f89SApple OSS Distributions 503*f6217f89SApple OSS Distributions# Set the values for the CFLAGS_BOUND_CHECKS* variables. 504*f6217f89SApple OSS Distributions# Notes: 505*f6217f89SApple OSS Distributions# 1. If building at desk, and the developer had set any of 506*f6217f89SApple OSS Distributions# CFLAGS_BOUND_CHECKS, CFLAGS_BOUND_CHECKS_SOFT, or CFLAGS_BOUND_CHECKS_DEBUG 507*f6217f89SApple OSS Distributions# the values are preserved. For B&I builds the values are reset. 508*f6217f89SApple OSS Distributions# 2. The CFLAGS_BOUND_CHECKS_PENDING, CFLAGS_BOUND_CHECKS_ENABLE_NEW_CHECKS, 509*f6217f89SApple OSS Distributions# and CFLAGS_BOUND_CHECKS_DISABLE_NEW_CHECKS variables do not take into 510*f6217f89SApple OSS Distributions# consideration any pre-existing value. 511*f6217f89SApple OSS Distributions# 512*f6217f89SApple OSS Distributionsifeq ($(RC_XBS),YES) 513*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS := 514*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_SOFT := 515*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_DEBUG := 516*f6217f89SApple OSS Distributionselse # ifeq ($(RC_XBS),YES) 517*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS ?= 518*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_SOFT ?= 519*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_DEBUG ?= 520*f6217f89SApple OSS Distributionsendif # ifeq ($(RC_XBS),YES) 521*f6217f89SApple OSS Distributions 522*f6217f89SApple OSS Distributionsexport CFLAGS_BOUND_CHECKS 523*f6217f89SApple OSS Distributionsexport CFLAGS_BOUND_CHECKS_SOFT 524*f6217f89SApple OSS Distributionsexport CFLAGS_BOUND_CHECKS_DEBUG 525*f6217f89SApple OSS DistributionsCFLAGS_BOUND_CHECKS_PENDING = -DBOUND_CHECKS_PENDING=1 -Wno-self-assign 526*f6217f89SApple OSS Distributionsexport CFLAGS_BOUND_CHECKS_PENDING 527*f6217f89SApple OSS Distributionsexport CFLAGS_BOUND_CHECKS_ENABLE_NEW_CHECKS 528*f6217f89SApple OSS Distributionsexport CFLAGS_BOUND_CHECKS_DISABLE_NEW_CHECKS 529*f6217f89SApple OSS Distributions 530*f6217f89SApple OSS Distributions# If bounds-safety is available, update the CFLAGS_BOUND_CHECKS accordingly. 531*f6217f89SApple OSS Distributionsifneq ($(BOUND_CHECKS),0) 532*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS += -fbounds-safety 533*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_ENABLE_NEW_CHECKS := -fbounds-safety-bringup-missing-checks 534*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_DISABLE_NEW_CHECKS := -fno-bounds-safety-bringup-missing-checks 535*f6217f89SApple OSS Distributionselse # ifneq($(BOUND_CHECKS),0) 536*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS += -Wno-error=self-assign 537*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_ENABLE_NEW_CHECKS := 538*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_DISABLE_NEW_CHECKS := 539*f6217f89SApple OSS Distributionsendif # ifneq($(BOUND_CHECKS),0) 540*f6217f89SApple OSS Distributions 541*f6217f89SApple OSS Distributions# Propagate the value of CFLAGS_BOUND_CHECKS CFLAGS_BOUND_CHECKS_{SOFT,DEBUG} variants, 542*f6217f89SApple OSS Distributions# and set the appropriate flags if trap resumption is supported. 543*f6217f89SApple OSS DistributionsCFLAGS_BOUND_CHECKS_SOFT += $(CFLAGS_BOUND_CHECKS) 544*f6217f89SApple OSS DistributionsCFLAGS_BOUND_CHECKS_DEBUG = $(CFLAGS_BOUND_CHECKS_SOFT) 545*f6217f89SApple OSS Distributionsifneq ($(BOUND_CHECKS_SOFT),0) 546*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_SOFT += -ftrap-function=ml_bound_chk_soft_trap -ftrap-function-returns 547*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS_DEBUG += -DBOUND_CHECKS_DEBUG=1 548*f6217f89SApple OSS Distributionsendif # ifneq($(BOUND_CHECKS_SOFT),0) 549*f6217f89SApple OSS Distributions 550*f6217f89SApple OSS Distributions# Bounds-safety adoption mode 551*f6217f89SApple OSS Distributions# 552*f6217f89SApple OSS Distributions# * Tells Clang to run in bounds-safety adoption mode which is allowed to 553*f6217f89SApple OSS Distributions# produce better diagnostics but a slower build. 554*f6217f89SApple OSS Distributions# * Doesn't try to suppress any warnings in staging (see Bounds-safety warning 555*f6217f89SApple OSS Distributions# staging) 556*f6217f89SApple OSS Distributions# 557*f6217f89SApple OSS DistributionsBOUNDS_SAFETY_ADOPTION_MODE ?= 0 558*f6217f89SApple OSS Distributionsifneq ($(BOUNDS_SAFETY_ADOPTION_MODE),0) 559*f6217f89SApple OSS Distributions ifeq ($(BOUND_CHECKS),0) 560*f6217f89SApple OSS Distributions $(error BOUNDS_SAFETY_ADOPTION_MODE cannot be enabled when BOUND_CHECKS=0) 561*f6217f89SApple OSS Distributions endif 562*f6217f89SApple OSS Distributions ifeq ($(RC_XBS),YES) 563*f6217f89SApple OSS Distributions # This mode should **only** be used at engineers' desks and not in B&I 564*f6217f89SApple OSS Distributions # builds because it may add compile-time overhead. 565*f6217f89SApple OSS Distributions $(error BOUNDS_SAFETY_ADOPTION_MODE should not be enabled in B&I builds) 566*f6217f89SApple OSS Distributions endif 567*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS += -fbounds-safety-adoption-mode 568*f6217f89SApple OSS Distributionsendif 569*f6217f89SApple OSS Distributions 570*f6217f89SApple OSS Distributions# Bounds-safety warning staging 571*f6217f89SApple OSS Distributions# 572*f6217f89SApple OSS Distributions# To prevent new bounds-safety warnings in a soon to be submitted Clang from 573*f6217f89SApple OSS Distributions# breaking the build they can be explicitly be prevented from being errors by 574*f6217f89SApple OSS Distributions# adding `-Wno-error=<new_warning_name>` to 575*f6217f89SApple OSS Distributions# `BOUNDS_SAFETY_DOWNGRADED_UPCOMING_WARNFLAGS`. 576*f6217f89SApple OSS Distributions# 577*f6217f89SApple OSS Distributions# A warning in `BOUNDS_SAFETY_DOWNGRADED_UPCOMING_WARNFLAGS` should be 578*f6217f89SApple OSS Distributions# removed once the new Clang with the warning is in the OS and the code builds 579*f6217f89SApple OSS Distributions# without it firing. 580*f6217f89SApple OSS Distributions# 581*f6217f89SApple OSS DistributionsBOUNDS_SAFETY_DOWNGRADED_UPCOMING_WARNFLAGS = 582*f6217f89SApple OSS Distributions 583*f6217f89SApple OSS Distributionsifneq ($(words $(BOUNDS_SAFETY_DOWNGRADED_UPCOMING_WARNFLAGS)),0) 584*f6217f89SApple OSS Distributions ifeq ($(BOUNDS_SAFETY_ADOPTION_MODE),0) 585*f6217f89SApple OSS Distributions # Note this implicitly relies on `-Wno-unknown-warning-option` already being 586*f6217f89SApple OSS Distributions # passed to the compiler. 587*f6217f89SApple OSS Distributions CFLAGS_BOUND_CHECKS += $(BOUNDS_SAFETY_DOWNGRADED_UPCOMING_WARNFLAGS) 588*f6217f89SApple OSS Distributions endif 589*f6217f89SApple OSS Distributionsendif 590*f6217f89SApple OSS Distributions 591*f6217f89SApple OSS Distributions# 592*f6217f89SApple OSS Distributions# Sanitizers Support (KASan, UBSan) 593*f6217f89SApple OSS Distributions# 594*f6217f89SApple OSS Distributions 595*f6217f89SApple OSS Distributions# Which kernel configurations are built with KCOV enabled. 596*f6217f89SApple OSS DistributionsKCOV_RUNTIME := KASAN 597*f6217f89SApple OSS Distributions 598*f6217f89SApple OSS Distributionsifneq ($(filter RELEASE, $(KCOV_RUNTIME)),) 599*f6217f89SApple OSS Distributions$(error "Sanitizer runtime should not be enabled for RELEASE kernel.") 600*f6217f89SApple OSS Distributionsendif 601*f6217f89SApple OSS Distributions 602*f6217f89SApple OSS Distributions 603*f6217f89SApple OSS DistributionsSAN=0 604*f6217f89SApple OSS Distributions 605*f6217f89SApple OSS Distributions# KASan support 606*f6217f89SApple OSS Distributions# 607*f6217f89SApple OSS Distributions 608*f6217f89SApple OSS Distributionsifeq ($(CURRENT_KERNEL_CONFIG),KASAN) 609*f6217f89SApple OSS Distributions# KASan kernel config implicitly enables the KASan instrumentation. 610*f6217f89SApple OSS Distributions# Instrumentation for other sanitizers is enabled explicitly at build time. 611*f6217f89SApple OSS DistributionsKASAN = 1 612*f6217f89SApple OSS Distributionsendif 613*f6217f89SApple OSS Distributions 614*f6217f89SApple OSS Distributionsifeq ($(KASAN),1) 615*f6217f89SApple OSS DistributionsSAN=1 616*f6217f89SApple OSS DistributionsBUILD_LTO=0 617*f6217f89SApple OSS Distributions 618*f6217f89SApple OSS Distributions# KASan Light support 619*f6217f89SApple OSS Distributions# 620*f6217f89SApple OSS Distributions# Light mode omits the HWASAN stack instrumentation. 621*f6217f89SApple OSS Distributions# Not supported by KASan Classic at this moment. 622*f6217f89SApple OSS Distributions 623*f6217f89SApple OSS DistributionsKASAN_LIGHT_PLATFORM := WatchOS 624*f6217f89SApple OSS Distributions 625*f6217f89SApple OSS Distributionsifneq ($(filter $(PLATFORM), $(KASAN_LIGHT_PLATFORM)),) 626*f6217f89SApple OSS DistributionsKASAN_LIGHT=1 627*f6217f89SApple OSS DistributionsHWASAN_INSTRUMENT_STACK=0 628*f6217f89SApple OSS Distributionselse 629*f6217f89SApple OSS DistributionsKASAN_LIGHT=0 630*f6217f89SApple OSS DistributionsHWASAN_INSTRUMENT_STACK=1 631*f6217f89SApple OSS Distributionsendif 632*f6217f89SApple OSS Distributions 633*f6217f89SApple OSS DistributionsKASAN_DENYLIST=$(OBJROOT)/san/kasan-denylist-$(CURRENT_ARCH_CONFIG_LC) 634*f6217f89SApple OSS Distributions 635*f6217f89SApple OSS Distributions# To calculate the kasan offset, subtract the lowest KVA to sanitize, shifted right by KASAN_SCALE_$INSTRUMENTATION bits, 636*f6217f89SApple OSS Distributions# from the base address of the kasan shadow area, (e.g. for x86_64 solve the following equation: 637*f6217f89SApple OSS Distributions# OFFSET = {VA mapped by the first KASAN PML4 [Currently #494]} - (LOWEST_KVA >> 3) 638*f6217f89SApple OSS Distributions# OFFSET = (0ULL - (512GiB * (512 - 494))) - (LOWEST_SAN_KVA >> 3) 639*f6217f89SApple OSS Distributions# OFFSET = FFFFF70000000000 - ((0ULL - (512GiB * (512 - 496))) >> 3) [PML4 #496 is the first possible KVA] 640*f6217f89SApple OSS Distributions# OFFSET = FFFFF70000000000 - (FFFFF80000000000 >> 3) 641*f6217f89SApple OSS Distributions# OFFSET = DFFFF80000000000 642*f6217f89SApple OSS Distributions# ). 643*f6217f89SApple OSS DistributionsKASAN_OFFSET_X86_64=0xdffff80000000000 644*f6217f89SApple OSS DistributionsKASAN_OFFSET_X86_64H=$(KASAN_OFFSET_X86_64) 645*f6217f89SApple OSS DistributionsKASAN_OFFSET_ARM64=0xf000000000000000 646*f6217f89SApple OSS Distributions 647*f6217f89SApple OSS DistributionsKASAN_OFFSET=$($(addsuffix $(CURRENT_ARCH_CONFIG),KASAN_OFFSET_)) 648*f6217f89SApple OSS Distributions 649*f6217f89SApple OSS Distributions# CLANG HWASAN/KHWASAN instrumentation powers KASAN_TBI. HWASAN traditional prefixing 650*f6217f89SApple OSS Distributions# is replaced by __asan_ to commonize exports across models. 651*f6217f89SApple OSS DistributionsKASAN_SCALE_TBI=4 652*f6217f89SApple OSS DistributionsCFLAGS_KASAN_INSTRUMENTATION_TBI = -DKASAN_TBI=1 -DKASAN_SCALE=$(KASAN_SCALE_TBI) \ 653*f6217f89SApple OSS Distributions -fsanitize=kernel-hwaddress \ 654*f6217f89SApple OSS Distributions -fsanitize-ignorelist=$(KASAN_DENYLIST) \ 655*f6217f89SApple OSS Distributions -mllvm -hwasan-recover=0 \ 656*f6217f89SApple OSS Distributions -mllvm -hwasan-mapping-offset=$(KASAN_OFFSET) \ 657*f6217f89SApple OSS Distributions -mllvm -hwasan-instrument-atomics=1 \ 658*f6217f89SApple OSS Distributions -mllvm -hwasan-instrument-stack=$(HWASAN_INSTRUMENT_STACK) \ 659*f6217f89SApple OSS Distributions -mllvm -hwasan-generate-tags-with-calls=1 \ 660*f6217f89SApple OSS Distributions -mllvm -hwasan-instrument-with-calls=0 \ 661*f6217f89SApple OSS Distributions -mllvm -hwasan-use-short-granules=0 \ 662*f6217f89SApple OSS Distributions -mllvm -hwasan-memory-access-callback-prefix="__asan_" 663*f6217f89SApple OSS Distributions 664*f6217f89SApple OSS Distributions 665*f6217f89SApple OSS DistributionsKASAN_SCALE_CLASSIC=3 666*f6217f89SApple OSS DistributionsCFLAGS_KASAN_INSTRUMENTATION_CLASSIC = -DKASAN_CLASSIC=1 -DKASAN_SCALE=$(KASAN_SCALE_CLASSIC) \ 667*f6217f89SApple OSS Distributions -fsanitize=address \ 668*f6217f89SApple OSS Distributions -mllvm -asan-globals-live-support \ 669*f6217f89SApple OSS Distributions -mllvm -asan-mapping-offset=$(KASAN_OFFSET) \ 670*f6217f89SApple OSS Distributions -fsanitize-ignorelist=$(KASAN_DENYLIST) 671*f6217f89SApple OSS Distributions 672*f6217f89SApple OSS DistributionsCFLAGS_KASANARM64 += $(CFLAGS_KASAN_INSTRUMENTATION_TBI) 673*f6217f89SApple OSS DistributionsCFLAGS_KASANX86_64 += $(CFLAGS_KASAN_INSTRUMENTATION_CLASSIC) 674*f6217f89SApple OSS DistributionsCFLAGS_KASANX86_64H += $(CFLAGS_KASAN_INSTRUMENTATION_CLASSIC) 675*f6217f89SApple OSS DistributionsCFLAGS_GEN += -DKASAN=1 -DKASAN_OFFSET=$(KASAN_OFFSET) -DKASAN_LIGHT=$(KASAN_LIGHT) 676*f6217f89SApple OSS Distributions 677*f6217f89SApple OSS DistributionsSFLAGS_KASANARM64 += $(CFLAGS_KASAN_INSTRUMENTATION_TBI) 678*f6217f89SApple OSS DistributionsSFLAGS_KASANX86_64 += $(CFLAGS_KASAN_INSTRUMENTATION_CLASSIC) 679*f6217f89SApple OSS DistributionsSFLAGS_KASANX86_64H += $(CFLAGS_KASAN_INSTRUMENTATION_CLASSIC) 680*f6217f89SApple OSS DistributionsSFLAGS_GEN += -DKASAN=1 -DKASAN_OFFSET=$(KASAN_OFFSET) -DKASAN_LIGHT=$(KASAN_LIGHT) 681*f6217f89SApple OSS Distributions 682*f6217f89SApple OSS Distributionsendif 683*f6217f89SApple OSS Distributions 684*f6217f89SApple OSS Distributions# UBSan 685*f6217f89SApple OSS Distributions# 686*f6217f89SApple OSS Distributions# The Undefined Behavior sanitizer runtime is always built as part of, and only for, 687*f6217f89SApple OSS Distributions# KASAN variants. UBSan instrumentation is disabled by default and only enabled explicitly 688*f6217f89SApple OSS Distributions# when building with UBSAN=1. 689*f6217f89SApple OSS Distributions# 690*f6217f89SApple OSS Distributions# On iOS RELEASE and DEVELOPMENT kernels, a subset of UBSan checks is enabled along with a minimal 691*f6217f89SApple OSS Distributions# runtime that emulates trap mode (but makes it recoverable). 692*f6217f89SApple OSS Distributions 693*f6217f89SApple OSS Distributionsifeq ($(KASAN), 1) 694*f6217f89SApple OSS Distributions 695*f6217f89SApple OSS Distributionsifeq ($(UBSAN),1) 696*f6217f89SApple OSS DistributionsSAN=1 697*f6217f89SApple OSS Distributions 698*f6217f89SApple OSS DistributionsUBSAN_RUNTIME = 699*f6217f89SApple OSS DistributionsUBSAN_CHECKS += signed-integer-overflow shift pointer-overflow bounds object-size # non-fatal (calls runtime, can return) 700*f6217f89SApple OSS Distributions# UBSAN_CHECKS = undefined nullability unsigned-integer-overflow # everything 701*f6217f89SApple OSS DistributionsUBSAN_CHECKS_FATAL = # fatal (calls runtime, must not return) 702*f6217f89SApple OSS DistributionsUBSAN_CHECKS_TRAP = vla-bound builtin # emit a trap instruction (no runtime support) 703*f6217f89SApple OSS DistributionsUBSAN_DISABLED += vptr function # requires unsupported C++ runtime 704*f6217f89SApple OSS Distributions 705*f6217f89SApple OSS Distributions# UBSan alignment + KASan code size is too large 706*f6217f89SApple OSS Distributions# UBSan unreachable doesn't play nice with ASan (40723397) 707*f6217f89SApple OSS DistributionsUBSAN_DISABLED += alignment unreachable 708*f6217f89SApple OSS Distributions 709*f6217f89SApple OSS Distributionsendif 710*f6217f89SApple OSS Distributions 711*f6217f89SApple OSS Distributionselse 712*f6217f89SApple OSS Distributions 713*f6217f89SApple OSS Distributions# DEVELOPMENT and RELEASE variants 714*f6217f89SApple OSS Distributionsifeq ($(PLATFORM),iPhoneOS) 715*f6217f89SApple OSS Distributions 716*f6217f89SApple OSS Distributions# Currently we have to keep alive two separated UBSAN runtimes (minimal for DEVELOPMENT, 717*f6217f89SApple OSS Distributions# full for KASAN). This implies that we cannot use CFLAGS_$(CURRENT_KERNEL_CONFIG), because 718*f6217f89SApple OSS Distributions# CFLAGS_DEVELOPMENT is folded into CFLAGS_KASAN. For the time being we leave this check here, 719*f6217f89SApple OSS Distributions# as we work (independently) to both break the CFLAGS direct dependency and commonize the 720*f6217f89SApple OSS Distributions# sanitizer runtimes. 721*f6217f89SApple OSS DistributionsUBSAN_MINIMAL_RUNTIME := DEVELOPMENT DEBUG 722*f6217f89SApple OSS Distributionsifneq ($(filter $(CURRENT_KERNEL_CONFIG), $(UBSAN_MINIMAL_RUNTIME)),) 723*f6217f89SApple OSS Distributions 724*f6217f89SApple OSS Distributions# This is (unfortunately) intentional. Currently the "kasan" denylist, which folds both 725*f6217f89SApple OSS Distributions# ubsan and kasan specific files, is generated for all builds during the 726*f6217f89SApple OSS Distributions# setup phase. The denylist file itself is divided per-sanitizer, so won't 727*f6217f89SApple OSS Distributions# affect the UBSAN build outside of the entries that are legitimately 728*f6217f89SApple OSS Distributions# intended for it. 729*f6217f89SApple OSS DistributionsUBSAN_DENYLIST=$(OBJROOT)/san/kasan-denylist-$(CURRENT_ARCH_CONFIG_LC) 730*f6217f89SApple OSS Distributions 731*f6217f89SApple OSS DistributionsUBSAN_CHECKS = signed-integer-overflow 732*f6217f89SApple OSS DistributionsUBSAN_RUNTIME = -fsanitize-minimal-runtime -fsanitize-ignorelist=$(UBSAN_DENYLIST) 733*f6217f89SApple OSS DistributionsUBSAN_CHECKS_TRAP = 734*f6217f89SApple OSS DistributionsUBSAN_CHECKS_FATAL = 735*f6217f89SApple OSS DistributionsUBSAN_DISABLED = 736*f6217f89SApple OSS Distributionsendif 737*f6217f89SApple OSS Distributionsendif 738*f6217f89SApple OSS Distributions 739*f6217f89SApple OSS Distributionsendif 740*f6217f89SApple OSS Distributions 741*f6217f89SApple OSS DistributionsCFLAGS_GEN += $(UBSAN_RUNTIME) 742*f6217f89SApple OSS DistributionsCFLAGS_GEN += $(foreach x,$(UBSAN_CHECKS) $(UBSAN_CHECKS_FATAL) $(UBSAN_CHECKS_TRAP),-fsanitize=$(x)) 743*f6217f89SApple OSS DistributionsCFLAGS_GEN += $(foreach x,$(UBSAN_CHECKS_FATAL),-fno-sanitize-recover=$(x)) 744*f6217f89SApple OSS DistributionsCFLAGS_GEN += $(foreach x,$(UBSAN_CHECKS_TRAP),-fsanitize-trap=$(x)) 745*f6217f89SApple OSS DistributionsCFLAGS_GEN += $(foreach x,$(UBSAN_DISABLED),-fno-sanitize=$(x)) 746*f6217f89SApple OSS Distributions 747*f6217f89SApple OSS Distributionsifeq ($(KSANCOV),1) 748*f6217f89SApple OSS Distributions# Enable SanitizerCoverage instrumentation in xnu 749*f6217f89SApple OSS DistributionsSAN = 1 750*f6217f89SApple OSS DistributionsKCOV_DENYLIST := $(OBJROOT)/san/kcov-denylist-$(CURRENT_ARCH_CONFIG_LC) 751*f6217f89SApple OSS DistributionsKCOV_CFLAGS := -fsanitize-coverage=trace-pc-guard,trace-cmp -fsanitize-coverage-ignorelist=$(KCOV_DENYLIST) 752*f6217f89SApple OSS DistributionsCFLAGS_GEN += $(KCOV_CFLAGS) -DKSANCOV=1 753*f6217f89SApple OSS Distributionsendif 754*f6217f89SApple OSS Distributions 755*f6217f89SApple OSS Distributionsifeq ($(SAN),1) 756*f6217f89SApple OSS DistributionsCFLAGS_GEN += -fsanitize-ignorelist=$(OBJROOT)/san/kasan-denylist-$(CURRENT_ARCH_CONFIG_LC) 757*f6217f89SApple OSS Distributionsendif 758*f6217f89SApple OSS Distributions 759*f6217f89SApple OSS Distributions# Any extra flags that get passed at the command line during build. 760*f6217f89SApple OSS Distributionsifeq ($(CFLAGS_EXTRA),) 761*f6217f89SApple OSS DistributionsCFLAGS_EXTRA = 762*f6217f89SApple OSS Distributionsendif 763*f6217f89SApple OSS Distributions 764*f6217f89SApple OSS DistributionsCFLAGS = $(CFLAGS_GEN) \ 765*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_MACHINE_CONFIG),MACHINE_FLAGS_$(CURRENT_ARCH_CONFIG)_)) \ 766*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \ 767*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),CFLAGS_)) \ 768*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_KERNEL_CONFIG),CFLAGS_)) \ 769*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),CFLAGS_))) \ 770*f6217f89SApple OSS Distributions $(DEPLOYMENT_TARGET_FLAGS) \ 771*f6217f89SApple OSS Distributions $(DEPLOYMENT_TARGET_DEFINES) \ 772*f6217f89SApple OSS Distributions $(DEFINES) \ 773*f6217f89SApple OSS Distributions $(CFLAGS_EXTRA) 774*f6217f89SApple OSS Distributions 775*f6217f89SApple OSS Distributions# 776*f6217f89SApple OSS Distributions# Default C++ flags 777*f6217f89SApple OSS Distributions# 778*f6217f89SApple OSS Distributions 779*f6217f89SApple OSS DistributionsOTHER_CXXFLAGS = 780*f6217f89SApple OSS Distributions 781*f6217f89SApple OSS Distributionsifeq ($(BUILD_XNU_LIBRARY),1) 782*f6217f89SApple OSS DistributionsCXXFLAGS_KERNEL = -fno-exceptions -Wno-missing-prototypes 783*f6217f89SApple OSS Distributionselse 784*f6217f89SApple OSS DistributionsCXXFLAGS_KERNEL = -fapple-kext 785*f6217f89SApple OSS Distributionsendif 786*f6217f89SApple OSS Distributions 787*f6217f89SApple OSS DistributionsCXXFLAGS_GEN = -std=gnu++2b -fsized-deallocation $(CXXFLAGS_KERNEL) $(OTHER_CXXFLAGS) 788*f6217f89SApple OSS Distributions 789*f6217f89SApple OSS DistributionsCXXFLAGS = $(CXXFLAGS_GEN) \ 790*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),CXXFLAGS_)) \ 791*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_KERNEL_CONFIG),CXXFLAGS_)) 792*f6217f89SApple OSS Distributions 793*f6217f89SApple OSS Distributions# 794*f6217f89SApple OSS Distributions# Assembler command 795*f6217f89SApple OSS Distributions# 796*f6217f89SApple OSS DistributionsAS = $(CCACHE) $(CC) 797*f6217f89SApple OSS DistributionsS_KCC = $(CC) 798*f6217f89SApple OSS Distributions 799*f6217f89SApple OSS Distributions# 800*f6217f89SApple OSS Distributions# Default SFLAGS 801*f6217f89SApple OSS Distributions# 802*f6217f89SApple OSS DistributionsSFLAGS_GEN = -D__ASSEMBLER__ -DASSEMBLER $(OTHER_CFLAGS) 803*f6217f89SApple OSS Distributions 804*f6217f89SApple OSS DistributionsSFLAGS_RELEASE = 805*f6217f89SApple OSS DistributionsSFLAGS_DEVELOPMENT = 806*f6217f89SApple OSS Distributions 807*f6217f89SApple OSS Distributions# When making non-compatible changes to the XNU runtime, it can be useful to build 808*f6217f89SApple OSS Distributions# a KASAN kernel + runtime, but linked against a DEVELOPMENT kernel cache. 809*f6217f89SApple OSS Distributions# Uncomment the lines below to be able to build development, but passing KASAN=1. 810*f6217f89SApple OSS Distributions# #_ifeq ($(KASAN),1) 811*f6217f89SApple OSS Distributions# SFLAGS_DEVELOPMENT += -DKASAN=1 812*f6217f89SApple OSS Distributions# #_endif 813*f6217f89SApple OSS Distributions 814*f6217f89SApple OSS DistributionsSFLAGS_KASAN = $(SFLAGS_DEVELOPMENT) -DKASAN=1 815*f6217f89SApple OSS DistributionsSFLAGS_DEBUG = 816*f6217f89SApple OSS DistributionsSFLAGS_PROFILE = 817*f6217f89SApple OSS Distributions 818*f6217f89SApple OSS DistributionsSFLAGS_X86_64 = $(CFLAGS_X86_64) 819*f6217f89SApple OSS DistributionsSFLAGS_X86_64H = $(CFLAGS_X86_64H) 820*f6217f89SApple OSS DistributionsSFLAGS_ARM64 = $(CFLAGS_ARM64) 821*f6217f89SApple OSS Distributions 822*f6217f89SApple OSS DistributionsSFLAGS = $(SFLAGS_GEN) \ 823*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_MACHINE_CONFIG),MACHINE_FLAGS_$(CURRENT_ARCH_CONFIG)_)) \ 824*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \ 825*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),SFLAGS_)) \ 826*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_KERNEL_CONFIG),SFLAGS_)) \ 827*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),SFLAGS_))) \ 828*f6217f89SApple OSS Distributions $(DEPLOYMENT_TARGET_FLAGS) \ 829*f6217f89SApple OSS Distributions $(DEPLOYMENT_TARGET_DEFINES) \ 830*f6217f89SApple OSS Distributions $(DEFINES) 831*f6217f89SApple OSS Distributions 832*f6217f89SApple OSS Distributions# 833*f6217f89SApple OSS Distributions# Linker command 834*f6217f89SApple OSS Distributions# 835*f6217f89SApple OSS DistributionsLD = $(KC++) -nostdlib 836*f6217f89SApple OSS Distributions 837*f6217f89SApple OSS Distributions# 838*f6217f89SApple OSS Distributions# Default LDFLAGS 839*f6217f89SApple OSS Distributions# 840*f6217f89SApple OSS Distributions# Availability of DWARF allows DTrace CTF (compressed type format) to be constructed. 841*f6217f89SApple OSS Distributions# ctf_insert creates the CTF section. It needs reserved padding in the 842*f6217f89SApple OSS Distributions# headers for the load command segment and the CTF section structures. 843*f6217f89SApple OSS Distributions# 844*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_GEN = \ 845*f6217f89SApple OSS Distributions -nostdlib \ 846*f6217f89SApple OSS Distributions -fapple-kext \ 847*f6217f89SApple OSS Distributions -Wl,-e,__start \ 848*f6217f89SApple OSS Distributions -Wl,-sectalign,__TEXT,__text,0x1000 \ 849*f6217f89SApple OSS Distributions -Wl,-sectalign,__DATA,__common,0x1000 \ 850*f6217f89SApple OSS Distributions -Wl,-sectalign,__DATA,__bss,0x1000 \ 851*f6217f89SApple OSS Distributions -Wl,-sectcreate,__PRELINK_TEXT,__text,/dev/null \ 852*f6217f89SApple OSS Distributions -Wl,-segprot,__PRELINK_TEXT,r-x,r-x \ 853*f6217f89SApple OSS Distributions -Wl,-sectcreate,__PRELINK_INFO,__info,/dev/null \ 854*f6217f89SApple OSS Distributions -Wl,-pagezero_size,0x0 \ 855*f6217f89SApple OSS Distributions -Wl,-version_load_command \ 856*f6217f89SApple OSS Distributions -Wl,-function_starts \ 857*f6217f89SApple OSS Distributions -Wl,-headerpad,152 858*f6217f89SApple OSS Distributions 859*f6217f89SApple OSS Distributions# LDFLAGS_KERNEL_SDK = -L$(SDKROOT)/usr/local/lib/kernel -lfirehose_kernel 860*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_SDK = -L$(SDKROOT)/usr/local/lib/kernel -L$(SDKROOT)/usr/local/lib/kernel/platform 861*f6217f89SApple OSS Distributionsifneq ($(KDKROOT),) 862*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_SDK += -L$(KDKROOT)/usr/local/lib/kernel/platform 863*f6217f89SApple OSS Distributionsendif 864*f6217f89SApple OSS Distributions 865*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_RELEASE = 866*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEVELOPMENT = 867*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_KASAN = $(LDFLAGS_KERNEL_DEVELOPMENT) 868*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEBUG = 869*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_PROFILE = 870*f6217f89SApple OSS Distributions 871*f6217f89SApple OSS Distributions# Tightbeam finds modules in the "tightbeam" subdirectory. 872*f6217f89SApple OSS DistributionsTIGHTBEAM_MODULE_DIR = $(SDKROOT)/usr/local/lib/kernel/tightbeam 873*f6217f89SApple OSS Distributions 874*f6217f89SApple OSS Distributions# KASLR static slide config: 875*f6217f89SApple OSS Distributionsifndef SLIDE 876*f6217f89SApple OSS DistributionsSLIDE=0x00 877*f6217f89SApple OSS Distributionsendif 878*f6217f89SApple OSS DistributionsKERNEL_MIN_ADDRESS = 0xffffff8000000000 879*f6217f89SApple OSS DistributionsKERNEL_BASE_OFFSET = 0x100000 880*f6217f89SApple OSS Distributions# POSIX shells use signed long for their arithmetic expressions. However, 881*f6217f89SApple OSS Distributions# we're dealing with uintptr_t values here, so explicitly use bash which 882*f6217f89SApple OSS Distributions# is known to be able to handle such larger values. ksh also works; dash 883*f6217f89SApple OSS Distributions# and zsh both fail with different results (zsh even warns you). 884*f6217f89SApple OSS DistributionsKERNEL_STATIC_SLIDE = $(shell $(BASH) -c 'printf "0x%016x" \ 885*f6217f89SApple OSS Distributions $$(( $(SLIDE) << 21 ))') 886*f6217f89SApple OSS DistributionsKERNEL_STATIC_BASE = $(shell $(BASH) -c 'printf "0x%016x" \ 887*f6217f89SApple OSS Distributions $$(( $(KERNEL_MIN_ADDRESS) + $(KERNEL_BASE_OFFSET) ))') 888*f6217f89SApple OSS DistributionsKERNEL_HIB_SECTION_BASE = $(shell $(BASH) -c 'printf "0x%016x" \ 889*f6217f89SApple OSS Distributions $$(( $(KERNEL_STATIC_BASE) + $(KERNEL_STATIC_SLIDE) ))') 890*f6217f89SApple OSS DistributionsKERNEL_TEXT_BASE = $(shell $(BASH) -c 'printf "0x%016x" \ 891*f6217f89SApple OSS Distributions $$(( $(KERNEL_HIB_SECTION_BASE) + 0x100000 ))') 892*f6217f89SApple OSS Distributions 893*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_RELEASEX86_64 = \ 894*f6217f89SApple OSS Distributions -Wl,-pie \ 895*f6217f89SApple OSS Distributions -Wl,-segaddr,__HIB,$(KERNEL_HIB_SECTION_BASE) \ 896*f6217f89SApple OSS Distributions -Wl,-image_base,$(KERNEL_TEXT_BASE) \ 897*f6217f89SApple OSS Distributions -Wl,-seg_page_size,__TEXT,0x200000 \ 898*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__bootPT,0x1000 \ 899*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__desc,0x1000 \ 900*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__data,0x1000 \ 901*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__text,0x1000 \ 902*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__const,0x1000 \ 903*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__bss,0x1000 \ 904*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__common,0x1000 \ 905*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__llvm_prf_cnts,0x1000 \ 906*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__llvm_prf_names,0x1000 \ 907*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__llvm_prf_data,0x1000 \ 908*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__textcoal_nt,0x1000 \ 909*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__cstring,0x1000 \ 910*f6217f89SApple OSS Distributions -Wl,-sectalign,__DATA,__percpu,0x1000 \ 911*f6217f89SApple OSS Distributions -Wl,-rename_section,__DATA,__const,__DATA_CONST,__const \ 912*f6217f89SApple OSS Distributions -Wl,-segprot,__DATA_CONST,r--,r-- \ 913*f6217f89SApple OSS Distributions -Wl,-rename_section,__KLD,__const,__KLDDATA,__const \ 914*f6217f89SApple OSS Distributions -Wl,-rename_section,__KLD,__cstring,__KLDDATA,__cstring \ 915*f6217f89SApple OSS Distributions -Wl,-segprot,__KLDDATA,rw-,rw- \ 916*f6217f89SApple OSS Distributions -Wl,-segprot,__KLD,r-x,r-x \ 917*f6217f89SApple OSS Distributions -Wl,-no_zero_fill_sections \ 918*f6217f89SApple OSS Distributions $(LDFLAGS_NOSTRIP_FLAG) 919*f6217f89SApple OSS Distributions 920*f6217f89SApple OSS Distributionsifeq ($(SAN),1) 921*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_RELEASEX86_64 += \ 922*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__cstring,0x1000 923*f6217f89SApple OSS Distributionsendif 924*f6217f89SApple OSS Distributions 925*f6217f89SApple OSS Distributionsifeq ($(KSANCOV),1) 926*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_RELEASEX86_64 += \ 927*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__sancov_guards,0x1000 \ 928*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__sancov_pcs,0x1000 929*f6217f89SApple OSS Distributionsendif 930*f6217f89SApple OSS Distributions 931*f6217f89SApple OSS Distributions# Define KERNEL_BASE_OFFSET so known at compile time: 932*f6217f89SApple OSS DistributionsCFLAGS_X86_64 += -DKERNEL_BASE_OFFSET=$(KERNEL_BASE_OFFSET) 933*f6217f89SApple OSS DistributionsCFLAGS_X86_64H += -DKERNEL_BASE_OFFSET=$(KERNEL_BASE_OFFSET) 934*f6217f89SApple OSS Distributions 935*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEBUGX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64) 936*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEVELOPMENTX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64) 937*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_KASANX86_64 = $(LDFLAGS_KERNEL_DEVELOPMENTX86_64) \ 938*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__asan_globals,0x1000 \ 939*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__asan_liveness,0x1000 \ 940*f6217f89SApple OSS Distributions -Wl,-sectalign,__HIB,__mod_term_func,0x1000 \ 941*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__mod_init_func,__NULL,__mod_init_func \ 942*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__eh_frame,__NULL,__eh_frame 943*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_PROFILEX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64) 944*f6217f89SApple OSS Distributions 945*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_RELEASEX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64) 946*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEBUGX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H) 947*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEVELOPMENTX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H) 948*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_KASANX86_64H = $(LDFLAGS_KERNEL_KASANX86_64) 949*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_PROFILEX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H) 950*f6217f89SApple OSS Distributions 951*f6217f89SApple OSS Distributions# Offset image base by page to have iBoot load kernel TEXT correctly. 952*f6217f89SApple OSS Distributions# First page is used for various purposes : sleep token, reset vector. 953*f6217f89SApple OSS Distributions# We also need a 32MB offset, as this is the minimum block mapping size 954*f6217f89SApple OSS Distributions# for a 16KB page runtime, and we wish to use the first virtual block 955*f6217f89SApple OSS Distributions# to map the low globals page. We also need another 4MB to account for 956*f6217f89SApple OSS Distributions# the address space reserved by L4 (because the reservation is not a 957*f6217f89SApple OSS Distributions# multiple of the block size in alignment/length, we will implictly map 958*f6217f89SApple OSS Distributions# it with our block mapping, and we therefore must reflect that the 959*f6217f89SApple OSS Distributions# first 4MB of the block mapping for xnu do not belong to xnu). 960*f6217f89SApple OSS Distributions# For the moment, kaliber has a unique memory layout (monitor at the top 961*f6217f89SApple OSS Distributions# of memory). Support this by breaking 16KB on other platforms and 962*f6217f89SApple OSS Distributions# mandating 32MB alignment. Image base (i.e. __TEXT) must be 16KB 963*f6217f89SApple OSS Distributions# aligned since ld64 will link with 16KB alignment for ARM64. 964*f6217f89SApple OSS Distributions# 965*f6217f89SApple OSS Distributions# We currently offset by an additional 32MB in order to reclaim memory. 966*f6217f89SApple OSS Distributions# We need a dedicated virtual page for the low globals. Our bootloader 967*f6217f89SApple OSS Distributions# may have a significant chunk of memory (up to an L2 entry in size) 968*f6217f89SApple OSS Distributions# that lies before the kernel. The addition 32MB of virtual padding 969*f6217f89SApple OSS Distributions# ensures that we have enough virtual address space to map all of that 970*f6217f89SApple OSS Distributions# memory as part of the V-to-P mapping. 971*f6217f89SApple OSS Distributions# 23355738 - put __PRELINK_TEXT first. We reserve enough room 972*f6217f89SApple OSS Distributions# for 0x0000000003000000 = 48MB of kexts 973*f6217f89SApple OSS Distributions# 974*f6217f89SApple OSS Distributions# 0xfffffff000000000 (32MB range for low globals) 975*f6217f89SApple OSS Distributions# 0xfffffff002000000 (32MB range to allow for large page physical slide) 976*f6217f89SApple OSS Distributions# 0xfffffff004000000 (16KB range to reserve the first available page) 977*f6217f89SApple OSS Distributions# 0xfffffff004004000 (48MB range for kexts) 978*f6217f89SApple OSS Distributions# 0xfffffff007004000 (Start of xnu proper). 979*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_GENARM64 = \ 980*f6217f89SApple OSS Distributions -Wl,-pie \ 981*f6217f89SApple OSS Distributions -Wl,-static \ 982*f6217f89SApple OSS Distributions -Wl,-segaddr,__PRELINK_TEXT,$(ARM64_PLKSEG_ADDR) \ 983*f6217f89SApple OSS Distributions -Wl,-image_base,$(ARM64_LINK_ADDR) \ 984*f6217f89SApple OSS Distributions \ 985*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__text,__TEXT_EXEC,__hib_text \ 986*f6217f89SApple OSS Distributions \ 987*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__const,__DATA_CONST,__hib_const \ 988*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__cstring,__DATA_CONST,__hib_const \ 989*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__literal8,__DATA_CONST,__hib_const \ 990*f6217f89SApple OSS Distributions -Wl,-rename_section,__HIB,__literal16,__DATA_CONST,__hib_const \ 991*f6217f89SApple OSS Distributions \ 992*f6217f89SApple OSS Distributions -Wl,-rename_segment,__HIB,__HIBDATA \ 993*f6217f89SApple OSS Distributions \ 994*f6217f89SApple OSS Distributions -Wl,-sectalign,__DATA,__const,0x4000 \ 995*f6217f89SApple OSS Distributions -Wl,-sectalign,__DATA,__percpu,0x4000 \ 996*f6217f89SApple OSS Distributions -Wl,-sectalign,__DATA,__data,0x4000 \ 997*f6217f89SApple OSS Distributions -Wl,-rename_section,__DATA,__mod_init_func,__DATA_CONST,__mod_init_func \ 998*f6217f89SApple OSS Distributions -Wl,-rename_section,__DATA,__mod_term_func,__DATA_CONST,__mod_term_func \ 999*f6217f89SApple OSS Distributions -Wl,-rename_section,__DATA,__auth_ptr,__DATA_CONST,__auth_ptr \ 1000*f6217f89SApple OSS Distributions -Wl,-rename_section,__DATA,__auth_got,__DATA_CONST,__auth_got \ 1001*f6217f89SApple OSS Distributions -Wl,-rename_section,__DATA,__const,__DATA_CONST,__const \ 1002*f6217f89SApple OSS Distributions -Wl,-segprot,__DATA_CONST,r--,r-- \ 1003*f6217f89SApple OSS Distributions -Wl,-rename_section,__KLD,__const,__KLDDATA,__const \ 1004*f6217f89SApple OSS Distributions -Wl,-rename_section,__KLD,__cstring,__KLDDATA,__cstring \ 1005*f6217f89SApple OSS Distributions -Wl,-segprot,__KLDDATA,rw-,rw- \ 1006*f6217f89SApple OSS Distributions -Wl,-segprot,__KLD,r-x,r-x \ 1007*f6217f89SApple OSS Distributions -Wl,-rename_section,__TEXT,__text,__TEXT_EXEC,__text \ 1008*f6217f89SApple OSS Distributions -Wl,-rename_section,__TEXT,__stubs,__TEXT_EXEC,__stubs \ 1009*f6217f89SApple OSS Distributions -Wl,-sectcreate,"__PLK_TEXT_EXEC",__text,/dev/null \ 1010*f6217f89SApple OSS Distributions -Wl,-sectcreate,__PRELINK_DATA,__data,/dev/null \ 1011*f6217f89SApple OSS Distributions -Wl,-sectcreate,"__PLK_DATA_CONST",__data,/dev/null \ 1012*f6217f89SApple OSS Distributions -Wl,-sectcreate,"__PLK_LLVM_COV",__llvm_covmap,/dev/null \ 1013*f6217f89SApple OSS Distributions -Wl,-sectcreate,"__PLK_LINKEDIT",__data,/dev/null 1014*f6217f89SApple OSS Distributions 1015*f6217f89SApple OSS Distributions# To support code coverage for kexts, the coverage mapping sections __llvm_covmap 1016*f6217f89SApple OSS Distributions# and __llvm_covfun are put into the __PLK_LLVM_COV segment rather than the 1017*f6217f89SApple OSS Distributions# standard __LLVM_COV segment. For later processing of the coverage data using 1018*f6217f89SApple OSS Distributions# llvm-cov, we move the coverage mapping for the kernel itself into the same 1019*f6217f89SApple OSS Distributions# segment (see also rdar://104951137) 1020*f6217f89SApple OSS Distributionsifeq ($(BUILD_CODE_COVERAGE),1) 1021*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_GENARM64 += \ 1022*f6217f89SApple OSS Distributions -Wl,-rename_section,__LLVM_COV,__llvm_covmap,__PLK_LLVM_COV,__llvm_covmap \ 1023*f6217f89SApple OSS Distributions -Wl,-rename_section,__LLVM_COV,__llvm_covfun,__PLK_LLVM_COV,__llvm_covfun 1024*f6217f89SApple OSS Distributionsendif 1025*f6217f89SApple OSS Distributions 1026*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_SEGARM64_SEG_ORDER = \ 1027*f6217f89SApple OSS Distributions __TEXT:__DATA_CONST:__DATA_SPTM:__LINKEDIT:__TEXT_EXEC:__TEXT_BOOT_EXEC:__KLD:__PPLTEXT:__PPLTRAMP:__PPLDATA_CONST:__LASTDATA_CONST:__LAST:__PPLDATA:__KLDDATA:__DATA:__HIBDATA:__BOOTDATA 1028*f6217f89SApple OSS Distributions 1029*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_SEGARM64 = \ 1030*f6217f89SApple OSS Distributions -Wl,-rename_section,__PPLDATA,__const,__PPLDATA_CONST,__const \ 1031*f6217f89SApple OSS Distributions -Wl,-segment_order,$(LDFLAGS_KERNEL_SEGARM64_SEG_ORDER) \ 1032*f6217f89SApple OSS Distributions -Wl,-segprot,__TEXT,r--,r-- \ 1033*f6217f89SApple OSS Distributions -Wl,-segprot,__TEXT_EXEC,r-x,r-x \ 1034*f6217f89SApple OSS Distributions -Wl,-segprot,__TEXT_BOOT_EXEC,r-x,r-x \ 1035*f6217f89SApple OSS Distributions -Wl,-segprot,__PPLTEXT,r-x,r-x \ 1036*f6217f89SApple OSS Distributions -Wl,-segprot,__PPLTRAMP,r-x,r-x \ 1037*f6217f89SApple OSS Distributions -Wl,-segprot,__PPLDATA_CONST,r--,r-- \ 1038*f6217f89SApple OSS Distributions -Wl,-segprot,__LASTDATA_CONST,r--,r-- \ 1039*f6217f89SApple OSS Distributions -Wl,-segprot,__LAST,r-x,r-x \ 1040*f6217f89SApple OSS Distributions 1041*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_RELEASEARM64 = \ 1042*f6217f89SApple OSS Distributions $(LDFLAGS_KERNEL_GENARM64) \ 1043*f6217f89SApple OSS Distributions $(LDFLAGS_KERNEL_SEGARM64) \ 1044*f6217f89SApple OSS Distributions $(LDFLAGS_KERNEL_STRIP_LTO) 1045*f6217f89SApple OSS Distributions 1046*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_CONFIG_RELEASEARM64 = \ 1047*f6217f89SApple OSS Distributions -Wl,-exported_symbols_list,$(TARGET)/all-kpi.exp 1048*f6217f89SApple OSS Distributions 1049*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEVELOPMENTARM64 = \ 1050*f6217f89SApple OSS Distributions $(LDFLAGS_KERNEL_GENARM64) \ 1051*f6217f89SApple OSS Distributions $(LDFLAGS_KERNEL_SEGARM64) \ 1052*f6217f89SApple OSS Distributions $(LDFLAGS_NOSTRIP_FLAG) 1053*f6217f89SApple OSS Distributions 1054*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_CONFIG_DEVELOPMENTARM64 = 1055*f6217f89SApple OSS Distributions 1056*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_KASANARM64 = $(LDFLAGS_KERNEL_DEVELOPMENTARM64) 1057*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_DEBUGARM64 = $(LDFLAGS_KERNEL_DEVELOPMENTARM64) 1058*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_SPTMARM64 = $(LDFLAGS_KERNEL_DEVELOPMENTARM64) 1059*f6217f89SApple OSS Distributions 1060*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_CONFIG_KASANARM64 = $(LDFLAGS_KERNEL_ONLY_CONFIG_DEVELOPMENTARM64) 1061*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_CONFIG_DEBUGARM64 = $(LDFLAGS_KERNEL_ONLY_CONFIG_DEVELOPMENTARM64) 1062*f6217f89SApple OSS Distributions 1063*f6217f89SApple OSS Distributions# 1064*f6217f89SApple OSS Distributions# arm64e specific linker flags that should be used only when linking the kernel 1065*f6217f89SApple OSS Distributions# (and not the static kernel cache / kcgen) 1066*f6217f89SApple OSS Distributions# 1067*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_SUBARCH_arm64e = \ 1068*f6217f89SApple OSS Distributions -Wl,-add_split_seg_info \ 1069*f6217f89SApple OSS Distributions -Wl,-kernel 1070*f6217f89SApple OSS Distributions 1071*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_SUBARCH_x86_64 = \ 1072*f6217f89SApple OSS Distributions -Wl,-add_split_seg_info \ 1073*f6217f89SApple OSS Distributions -Wl,-kernel 1074*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY_SUBARCH_x86_64h = $(LDFLAGS_KERNEL_ONLY_SUBARCH_x86_64) 1075*f6217f89SApple OSS Distributions 1076*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \ 1077*f6217f89SApple OSS Distributions $(LDFLAGS_KERNEL_SDK) \ 1078*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \ 1079*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG),LDFLAGS_KERNEL_)) \ 1080*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_)) \ 1081*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_))) \ 1082*f6217f89SApple OSS Distributions $(DEPLOYMENT_TARGET_FLAGS) 1083*f6217f89SApple OSS Distributions 1084*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_ONLY += \ 1085*f6217f89SApple OSS Distributions $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_ONLY_CONFIG_))) \ 1086*f6217f89SApple OSS Distributions $($(addsuffix $(ARCH_STRING_FOR_CURRENT_MACHINE_CONFIG),LDFLAGS_KERNEL_ONLY_SUBARCH_)) \ 1087*f6217f89SApple OSS Distributions -Wl,-alias_list,$(TARGET)/all-alias.exp \ 1088*f6217f89SApple OSS Distributions -Wl,-sectcreate,__LINKINFO,__symbolsets,$(TARGET)/symbolsets.plist -Wl,-segprot,__LINKINFO,r--,r-- 1089*f6217f89SApple OSS Distributions 1090*f6217f89SApple OSS DistributionsLDFILES_KERNEL_ONLY = $(TARGET)/all-kpi.exp $(TARGET)/all-alias.exp $(TARGET)/symbolsets.plist 1091*f6217f89SApple OSS Distributions 1092*f6217f89SApple OSS Distributions# 1093*f6217f89SApple OSS Distributions# Default runtime libraries to be linked with the kernel 1094*f6217f89SApple OSS Distributions# 1095*f6217f89SApple OSS DistributionsLD_KERNEL_LIBS = -lcc_kext 1096*f6217f89SApple OSS DistributionsLD_KERNEL_ARCHIVES = $(LDFLAGS_KERNEL_SDK) -lfirehose_kernel 1097*f6217f89SApple OSS Distributions 1098*f6217f89SApple OSS Distributions# 1099*f6217f89SApple OSS Distributions# Derive SPTM/TXM and Exclaves enablement from the EDM properties. 1100*f6217f89SApple OSS Distributions# 1101*f6217f89SApple OSS Distributionsifneq ($(EMBEDDED_DEVICE_MAP),) 1102*f6217f89SApple OSS DistributionsPLATFORM_NORMALIZED := $(shell echo $(PLATFORM) | tr '[:upper:]' '[:lower:]') 1103*f6217f89SApple OSS Distributions 1104*f6217f89SApple OSS DistributionsSPTM_ENABLED := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -query SELECT DISTINCT EnableSPTMTXM FROM Targets WHERE KernelPlatform IS \"$(CURRENT_MACHINE_CONFIG_LC)\" AND SDKPlatform IS \"$(PLATFORM_NORMALIZED)\" AND EnableSPTMTXM == 1) 1105*f6217f89SApple OSS Distributions 1106*f6217f89SApple OSS Distributions 1107*f6217f89SApple OSS DistributionsEXCLAVES_ENABLED := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -query SELECT DISTINCT HascL4 FROM Targets WHERE KernelPlatform IS \"$(CURRENT_MACHINE_CONFIG_LC)\" AND SDKPlatform IS \"$(PLATFORM_NORMALIZED)\" AND HascL4 == 1) 1108*f6217f89SApple OSS Distributionsendif # !EMBEDDED_DEVICE_MAP 1109*f6217f89SApple OSS Distributions 1110*f6217f89SApple OSS Distributionsifeq ($(CURRENT_KERNEL_CONFIG),SPTM) 1111*f6217f89SApple OSS Distributions SPTM_ENABLED = 1 1112*f6217f89SApple OSS Distributionsendif # SPTM 1113*f6217f89SApple OSS Distributions 1114*f6217f89SApple OSS Distributions 1115*f6217f89SApple OSS Distributionsifneq ($(filter $(CURRENT_MACHINE_CONFIG_LC),$(SPTM_ENABLED_SOCS_$(PLATFORM))),) 1116*f6217f89SApple OSS Distributions SPTM_ENABLED = 1 1117*f6217f89SApple OSS Distributionsendif 1118*f6217f89SApple OSS Distributions 1119*f6217f89SApple OSS Distributionsifeq ($(SPTM_ENABLED),1) 1120*f6217f89SApple OSS Distributions LD_KERNEL_ARCHIVES += -lTrustedExecutionMonitor_Kernel 1121*f6217f89SApple OSS Distributions LD_KERNEL_ARCHIVES += -lsptm_xnu 1122*f6217f89SApple OSS Distributions DOCONF_SPTM := -sptm 1123*f6217f89SApple OSS Distributionsendif # !SPTM_ENABLED 1124*f6217f89SApple OSS Distributions 1125*f6217f89SApple OSS Distributionsifeq ($(EXCLAVES_ENABLED),1) 1126*f6217f89SApple OSS Distributions DOCONF_EXCLAVES := -exclaves 1127*f6217f89SApple OSS Distributionsendif # !EXCLAVES_ENABLED 1128*f6217f89SApple OSS Distributions 1129*f6217f89SApple OSS Distributionsifeq ($(CURRENT_ARCH_CONFIG),ARM64) 1130*f6217f89SApple OSS DistributionsTIGHTBEAM_EXPORTS := $(SRCROOT)/config/libTightbeam.exports 1131*f6217f89SApple OSS Distributionsendif 1132*f6217f89SApple OSS Distributions 1133*f6217f89SApple OSS Distributions# 1134*f6217f89SApple OSS Distributions# DTrace support 1135*f6217f89SApple OSS Distributions# 1136*f6217f89SApple OSS Distributionsifndef DO_CTFMERGE 1137*f6217f89SApple OSS DistributionsDO_CTFMERGE := 1 1138*f6217f89SApple OSS Distributionsifeq ($(CURRENT_KERNEL_CONFIG),RELEASE) 1139*f6217f89SApple OSS Distributionsifneq ($(PLATFORM),MacOSX) 1140*f6217f89SApple OSS DistributionsDO_CTFMERGE := 0 1141*f6217f89SApple OSS Distributionsendif 1142*f6217f89SApple OSS Distributionsendif 1143*f6217f89SApple OSS Distributionsendif # DO_CTFMERGE 1144*f6217f89SApple OSS Distributions 1145*f6217f89SApple OSS Distributions 1146*f6217f89SApple OSS Distributions# 1147*f6217f89SApple OSS Distributions# Default INCFLAGS 1148*f6217f89SApple OSS Distributions# 1149*f6217f89SApple OSS DistributionsINCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST)) 1150*f6217f89SApple OSS DistributionsINCFLAGS_EXTERN = -I$(SRCROOT)/EXTERNAL_HEADERS 1151*f6217f89SApple OSS DistributionsINCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT) 1152*f6217f89SApple OSS DistributionsINCFLAGS_LOCAL = -I. 1153*f6217f89SApple OSS DistributionsINCFLAGS_KERNEL = -I$(SDKROOT)/usr/local/include/kernel 1154*f6217f89SApple OSS DistributionsINCFLAGS_SDK = -I$(SDKROOT)/usr/local/include/ -I$(SDKROOT)/$(KPINCDIR)/AppleFeatures 1155*f6217f89SApple OSS DistributionsINCFLAGS_PLATFORM = -I$(SDKROOT)/$(KPINCDIR)/platform 1156*f6217f89SApple OSS Distributionsifneq ($(KDKROOT),) 1157*f6217f89SApple OSS DistributionsINCFLAGS_SDK += -I$(KDKROOT)/$(KPINCDIR) 1158*f6217f89SApple OSS DistributionsINCFLAGS_PLATFORM += -I$(KDKROOT)/$(KINCDIR)/platform -I$(KDKROOT)/$(KPINCDIR)/platform 1159*f6217f89SApple OSS Distributionsendif 1160*f6217f89SApple OSS Distributions 1161*f6217f89SApple OSS DistributionsINCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) $(INCFLAGS_KERNEL) $(INCFLAGS_SDK) $(INCFLAGS_PLATFORM) 1162*f6217f89SApple OSS Distributions 1163*f6217f89SApple OSS Distributions# 1164*f6217f89SApple OSS Distributions# Default MIGFLAGS 1165*f6217f89SApple OSS Distributions# 1166*f6217f89SApple OSS DistributionsMIGFLAGS = $(DEFINES) $(INCFLAGS) -novouchers $($(addsuffix $(CURRENT_ARCH_CONFIG),CFLAGS_)) $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \ 1167*f6217f89SApple OSS Distributions $(DEPLOYMENT_TARGET_FLAGS) 1168*f6217f89SApple OSS Distributions 1169*f6217f89SApple OSS Distributions# 1170*f6217f89SApple OSS Distributions# Default MIG Kernel Server flags 1171*f6217f89SApple OSS Distributions# 1172*f6217f89SApple OSS DistributionsMIGKSFLAGS = \ 1173*f6217f89SApple OSS Distributions -DMACH_KERNEL_PRIVATE \ 1174*f6217f89SApple OSS Distributions -DKERNEL_SERVER=1 \ 1175*f6217f89SApple OSS Distributions -mach_msg2 1176*f6217f89SApple OSS Distributions 1177*f6217f89SApple OSS Distributions# 1178*f6217f89SApple OSS Distributions# Default MIG KernelUser flags 1179*f6217f89SApple OSS Distributions# 1180*f6217f89SApple OSS DistributionsMIGKUFLAGS = \ 1181*f6217f89SApple OSS Distributions -DMACH_KERNEL_PRIVATE \ 1182*f6217f89SApple OSS Distributions -DKERNEL_USER=1 \ 1183*f6217f89SApple OSS Distributions -maxonstack 1024 1184*f6217f89SApple OSS Distributions 1185*f6217f89SApple OSS Distributions# Support for LLVM Profile Guided Optimization (PGO) 1186*f6217f89SApple OSS Distributions 1187*f6217f89SApple OSS Distributionsifeq ($(BUILD_PROFILE),1) 1188*f6217f89SApple OSS DistributionsCFLAGS_GEN += -fprofile-instr-generate -DPROFILE 1189*f6217f89SApple OSS DistributionsCXXFLAGS_GEN += -fprofile-instr-generate -DPROFILE 1190*f6217f89SApple OSS Distributionsendif 1191*f6217f89SApple OSS Distributions 1192*f6217f89SApple OSS Distributionsifdef USE_PROFILE 1193*f6217f89SApple OSS DistributionsCFLAGS_GEN += -fprofile-instr-use=$(USE_PROFILE) 1194*f6217f89SApple OSS DistributionsCXXFLAGS_GEN += -fprofile-instr-use=$(USE_PROFILE) 1195*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_GEN += -fprofile-instr-use=$(USE_PROFILE) 1196*f6217f89SApple OSS Distributions 1197*f6217f89SApple OSS DistributionsCFLAGS_GEN += -Wno-error=profile-instr-out-of-date 1198*f6217f89SApple OSS Distributionsendif 1199*f6217f89SApple OSS Distributions 1200*f6217f89SApple OSS Distributions# Support for LLVM Source-based Code coverage. Since enabling code coverage 1201*f6217f89SApple OSS Distributions# increases the size of __LINKEDIT, it might be necessary to set the keepsyms=1 1202*f6217f89SApple OSS Distributions# boot-arg when building the kernel with code coverage enabled. 1203*f6217f89SApple OSS Distributionsifeq ($(BUILD_CODE_COVERAGE),1) 1204*f6217f89SApple OSS DistributionsCFLAGS_GEN += -fprofile-instr-generate -fcoverage-mapping 1205*f6217f89SApple OSS DistributionsCXXFLAGS_GEN += -fprofile-instr-generate -fcoverage-mapping 1206*f6217f89SApple OSS Distributionsendif 1207*f6217f89SApple OSS Distributions 1208*f6217f89SApple OSS Distributions# 1209*f6217f89SApple OSS Distributions# Support for LLVM Link Time Optimization (LTO) 1210*f6217f89SApple OSS Distributions# 1211*f6217f89SApple OSS Distributions# LTO can be explicitly enabled or disabled with BUILD_LTO=1|0 1212*f6217f89SApple OSS Distributions# and defaults to enabled except for DEBUG kernels 1213*f6217f89SApple OSS Distributions# 1214*f6217f89SApple OSS Distributions# CFLAGS_NOLTO_FLAG is needed on a per-file basis (for files 1215*f6217f89SApple OSS Distributions# that deal poorly with LTO, or files that must be machine 1216*f6217f89SApple OSS Distributions# code *.o files for xnu to build (i.e, setsegname runs on 1217*f6217f89SApple OSS Distributions# them). 1218*f6217f89SApple OSS Distributions# 1219*f6217f89SApple OSS Distributions# LDFLAGS_NOSTRIP_FLAG is used to support configurations that 1220*f6217f89SApple OSS Distributions# do not utilize an export list. For these configs to build, 1221*f6217f89SApple OSS Distributions# we need to prevent the LTO logic from dead stripping them. 1222*f6217f89SApple OSS Distributions 1223*f6217f89SApple OSS DistributionsLTO_ENABLED_RELEASE = 1 1224*f6217f89SApple OSS DistributionsLTO_ENABLED_DEVELOPMENT = 1 1225*f6217f89SApple OSS DistributionsLTO_ENABLED_DEBUG = 0 1226*f6217f89SApple OSS DistributionsLTO_ENABLED_KASAN = 0 1227*f6217f89SApple OSS DistributionsLTO_ENABLED_SPTM = $(LTO_ENABLED_DEVELOPMENT) 1228*f6217f89SApple OSS Distributions 1229*f6217f89SApple OSS Distributionsifneq ($(BUILD_LTO),) 1230*f6217f89SApple OSS DistributionsUSE_LTO = $(BUILD_LTO) 1231*f6217f89SApple OSS Distributionselse 1232*f6217f89SApple OSS DistributionsUSE_LTO = $(LTO_ENABLED_$(CURRENT_KERNEL_CONFIG)) 1233*f6217f89SApple OSS Distributionsendif 1234*f6217f89SApple OSS Distributions 1235*f6217f89SApple OSS Distributionsifeq ($(USE_LTO),1) 1236*f6217f89SApple OSS DistributionsCFLAGS_GEN += -flto -DBUILT_LTO=1 1237*f6217f89SApple OSS DistributionsCXXFLAGS_GEN += -flto -DBUILT_LTO=1 1238*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_LTO = -Wl,-mllvm,-inline-threshold=100 1239*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_GEN += $(LDFLAGS_KERNEL_LTO) -Wl,-object_path_lto,$(TARGET)/lto.o 1240*f6217f89SApple OSS DistributionsLDFLAGS_NOSTRIP_FLAG = -rdynamic 1241*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_STRIP_LTO = -Wl,-dead_strip,-no_dead_strip_inits_and_terms 1242*f6217f89SApple OSS Distributions 1243*f6217f89SApple OSS DistributionsCFLAGS_NOLTO_FLAG = -fno-lto 1244*f6217f89SApple OSS Distributionselse 1245*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_LTO = 1246*f6217f89SApple OSS DistributionsLDFLAGS_NOSTRIP_FLAG = 1247*f6217f89SApple OSS DistributionsLDFLAGS_KERNEL_STRIP_LTO = 1248*f6217f89SApple OSS DistributionsCFLAGS_NOLTO_FLAG = 1249*f6217f89SApple OSS Distributionsendif 1250*f6217f89SApple OSS Distributions 1251*f6217f89SApple OSS Distributions# 1252*f6217f89SApple OSS Distributions# Default VPATH 1253*f6217f89SApple OSS Distributions# 1254*f6217f89SApple OSS Distributionsexport VPATH = .:$(SOURCE) 1255*f6217f89SApple OSS Distributions 1256*f6217f89SApple OSS Distributions 1257*f6217f89SApple OSS Distributions 1258*f6217f89SApple OSS Distributions# 1259*f6217f89SApple OSS Distributions# Macros that control installation of kernel and its header files 1260*f6217f89SApple OSS Distributions# 1261*f6217f89SApple OSS Distributions# install flags for header files 1262*f6217f89SApple OSS Distributions# 1263*f6217f89SApple OSS DistributionsINSTALL_FLAGS = -c -S -m 0444 1264*f6217f89SApple OSS DistributionsDATA_INSTALL_FLAGS = -c -S -m 0644 1265*f6217f89SApple OSS DistributionsDATA_INSTALL_FLAGS_RO = -c -S -m 0444 1266*f6217f89SApple OSS DistributionsEXEC_INSTALL_FLAGS = -c -S -m 0755 1267*f6217f89SApple OSS Distributions 1268*f6217f89SApple OSS Distributions# 1269*f6217f89SApple OSS Distributions# Header file destinations 1270*f6217f89SApple OSS Distributions# 1271*f6217f89SApple OSS Distributions 1272*f6217f89SApple OSS Distributionsifeq ($(DRIVERKIT),1) 1273*f6217f89SApple OSS Distributions SDKHEADERSROOT=$(DRIVERKITRUNTIMEROOT) 1274*f6217f89SApple OSS Distributions # only whitelisted headers install outside of the DriverKit Runtime hierarchy 1275*f6217f89SApple OSS Distributions DRIVERKITSDKHEADERSROOT=$(DRIVERKITROOT) 1276*f6217f89SApple OSS Distributions DRIVERKITFRAMEDIR = $(DRIVERKITROOT)/System/Library/Frameworks 1277*f6217f89SApple OSS Distributionsendif 1278*f6217f89SApple OSS Distributions 1279*f6217f89SApple OSS Distributionsifeq ($(EXCLAVEKIT),1) 1280*f6217f89SApple OSS Distributions EXCLAVEKITSDKHEADERSROOT=$(EXCLAVEKITROOT) 1281*f6217f89SApple OSS Distributions EXCLAVEKITFRAMEDIR = $(EXCLAVEKITROOT)/System/Library/Frameworks 1282*f6217f89SApple OSS Distributionsendif 1283*f6217f89SApple OSS Distributions 1284*f6217f89SApple OSS Distributionsifeq ($(EXCLAVECORE),1) 1285*f6217f89SApple OSS Distributions EXCLAVECORESDKHEADERSROOT=$(EXCLAVECOREROOT) 1286*f6217f89SApple OSS Distributions EXCLAVECOREFRAMEDIR = $(EXCLAVECOREROOT)/System/Library/Frameworks 1287*f6217f89SApple OSS Distributionsendif 1288*f6217f89SApple OSS Distributions 1289*f6217f89SApple OSS DistributionsFRAMEDIR = $(SDKHEADERSROOT)/System/Library/Frameworks 1290*f6217f89SApple OSS Distributions 1291*f6217f89SApple OSS DistributionsIINCVERS = A 1292*f6217f89SApple OSS DistributionsIINCFRAME = $(FRAMEDIR)/IOKit.framework 1293*f6217f89SApple OSS DistributionsIINCDIR = $(IINCFRAME)/Versions/$(IINCVERS)/Headers 1294*f6217f89SApple OSS DistributionsIPINCDIR = $(IINCFRAME)/Versions/$(IINCVERS)/PrivateHeaders 1295*f6217f89SApple OSS DistributionsIRESDIR = $(IINCFRAME)/Versions/$(IINCVERS)/Resources 1296*f6217f89SApple OSS Distributions 1297*f6217f89SApple OSS DistributionsSINCVERS = B 1298*f6217f89SApple OSS DistributionsSINCFRAME = $(FRAMEDIR)/System.framework 1299*f6217f89SApple OSS DistributionsSINCDIR = $(SINCFRAME)/Versions/$(SINCVERS)/Headers 1300*f6217f89SApple OSS DistributionsSPINCDIR = $(SINCFRAME)/Versions/$(SINCVERS)/PrivateHeaders 1301*f6217f89SApple OSS DistributionsSRESDIR = $(SINCFRAME)/Versions/$(SINCVERS)/Resources 1302*f6217f89SApple OSS Distributions 1303*f6217f89SApple OSS Distributionsifndef INCDIR 1304*f6217f89SApple OSS Distributions INCDIR = $(SDKHEADERSROOT)/usr/include 1305*f6217f89SApple OSS Distributionsendif 1306*f6217f89SApple OSS Distributionsifndef DRIVERKITINCDIR 1307*f6217f89SApple OSS Distributions DRIVERKITINCDIR = $(DRIVERKITSDKHEADERSROOT)/usr/include 1308*f6217f89SApple OSS Distributionsendif 1309*f6217f89SApple OSS Distributionsifndef EXCLAVEKITINCDIR 1310*f6217f89SApple OSS Distributions EXCLAVEKITINCDIR = $(EXCLAVEKITSDKHEADERSROOT)/usr/include 1311*f6217f89SApple OSS Distributionsendif 1312*f6217f89SApple OSS Distributionsifndef EXCLAVECOREINCDIR 1313*f6217f89SApple OSS Distributions EXCLAVECOREINCDIR = $(EXCLAVECORESDKHEADERSROOT)/usr/include 1314*f6217f89SApple OSS Distributionsendif 1315*f6217f89SApple OSS Distributionsifndef LCLDIR 1316*f6217f89SApple OSS Distributions LCLDIR = $(SDKHEADERSROOT)/usr/local/include 1317*f6217f89SApple OSS Distributionsendif 1318*f6217f89SApple OSS Distributionsifndef DRIVERKITLCLDIR 1319*f6217f89SApple OSS Distributions DRIVERKITLCLDIR = $(DRIVERKITSDKHEADERSROOT)/usr/local/include 1320*f6217f89SApple OSS Distributionsendif 1321*f6217f89SApple OSS Distributions 1322*f6217f89SApple OSS DistributionsKINCVERS = A 1323*f6217f89SApple OSS DistributionsKINCFRAME = $(FRAMEDIR)/Kernel.framework 1324*f6217f89SApple OSS DistributionsKINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers 1325*f6217f89SApple OSS DistributionsKPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders 1326*f6217f89SApple OSS DistributionsKRESDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Resources 1327*f6217f89SApple OSS Distributions 1328*f6217f89SApple OSS DistributionsKLIBCXXDIR = $(KPINCDIR)/kernel_sdkroot 1329*f6217f89SApple OSS DistributionsKLIBCXXINCDIR = $(KLIBCXXDIR)/usr/include 1330*f6217f89SApple OSS Distributions 1331*f6217f89SApple OSS DistributionsDKIT_INCFRAME = DriverKit.framework 1332*f6217f89SApple OSS Distributions 1333*f6217f89SApple OSS Distributionsifeq ($(PLATFORM),MacOSX) 1334*f6217f89SApple OSS DistributionsDKIT_INCVERS = A 1335*f6217f89SApple OSS DistributionsDKIT_INCDIR = $(DKIT_INCFRAME)/Versions/$(DKIT_INCVERS)/Headers 1336*f6217f89SApple OSS DistributionsDKIT_PINCDIR = $(DKIT_INCFRAME)/Versions/$(DKIT_INCVERS)/PrivateHeaders 1337*f6217f89SApple OSS Distributionselse 1338*f6217f89SApple OSS Distributions# non-macOS SDK frameworks use shallow bundle structure 1339*f6217f89SApple OSS DistributionsDKIT_INCDIR = $(DKIT_INCFRAME)/Headers 1340*f6217f89SApple OSS DistributionsDKIT_PINCDIR = $(DKIT_INCFRAME)/PrivateHeaders 1341*f6217f89SApple OSS Distributionsendif 1342*f6217f89SApple OSS Distributions 1343*f6217f89SApple OSS Distributions# DriverKit SDK frameworks use shallow bundle structure 1344*f6217f89SApple OSS DistributionsDRIVERKIT_DKIT_INCDIR = $(DKIT_INCFRAME)/Headers 1345*f6217f89SApple OSS DistributionsDRIVERKIT_DKIT_PINCDIR = $(DKIT_INCFRAME)/PrivateHeaders 1346*f6217f89SApple OSS Distributions 1347*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF ?= 1348*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -UMACH_KERNEL_PRIVATE 1349*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -UBSD_KERNEL_PRIVATE 1350*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -UIOKIT_KERNEL_PRIVATE 1351*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -ULIBKERN_KERNEL_PRIVATE 1352*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -ULIBSA_KERNEL_PRIVATE 1353*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -UPEXPERT_KERNEL_PRIVATE 1354*f6217f89SApple OSS DistributionsXNU_PRIVATE_UNIFDEF += -UXNU_KERNEL_PRIVATE 1355*f6217f89SApple OSS Distributions 1356*f6217f89SApple OSS Distributions 1357*f6217f89SApple OSS DistributionsPLATFORM_UNIFDEF = $(foreach x,$(SUPPORTED_PLATFORMS),$(if $(filter $(PLATFORM),$(x)),-DXNU_PLATFORM_$(x) $(foreach token,$(PLATFORM_UNIFDEF_BLACKLIST_TOKENS_$(x)),-U$(token)),-UXNU_PLATFORM_$(x))) 1358*f6217f89SApple OSS Distributions 1359*f6217f89SApple OSS Distributions 1360*f6217f89SApple OSS Distributions# Some header guards need to be present and checked in kernel headers but removed from userspace headers 1361*f6217f89SApple OSS DistributionsKERNEL_ONLY_GUARDS_UNIFDEF = 1362*f6217f89SApple OSS Distributions 1363*f6217f89SApple OSS Distributions# Test-only guards should be stripped from all exported headers 1364*f6217f89SApple OSS DistributionsTEST_ONLY_GUARDS_UNIFDEF = -USCHED_TEST_HARNESS 1365*f6217f89SApple OSS Distributions 1366*f6217f89SApple OSS DistributionsSPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -UDRIVERKIT -UEXCLAVEKIT -UEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1367*f6217f89SApple OSS DistributionsSINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -UDRIVERKIT -UEXCLAVEKIT -UEXCLAVECORE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1368*f6217f89SApple OSS DistributionsSFPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -UDRIVERKIT -UEXCLAVEKIT -UEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1369*f6217f89SApple OSS DistributionsDKPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -DDRIVERKIT -UEXCLAVEKIT -UEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1370*f6217f89SApple OSS DistributionsDKINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -DDRIVERKIT -UEXCLAVEKIT -UEXCLAVECORE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1371*f6217f89SApple OSS DistributionsEKPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -UDRIVERKIT -DEXCLAVEKIT -UEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1372*f6217f89SApple OSS DistributionsEKINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -UDRIVERKIT -DEXCLAVEKIT -UEXCLAVECORE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1373*f6217f89SApple OSS DistributionsECPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -UDRIVERKIT -UEXCLAVEKIT -DEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1374*f6217f89SApple OSS DistributionsECINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -UDRIVERKIT -UEXCLAVEKIT -DEXCLAVECORE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__ $(KERNEL_ONLY_GUARDS_UNIFDEF) $(TEST_ONLY_GUARDS_UNIFDEF) 1375*f6217f89SApple OSS DistributionsKPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UMODULES_SUPPORTED -DKERNEL_PRIVATE -DKERNEL -DPRIVATE -UDRIVERKIT -UXNU_LIBCXX_SDKROOT -UEXCLAVEKIT -UEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(TEST_ONLY_GUARDS_UNIFDEF) 1376*f6217f89SApple OSS DistributionsLIBCXXINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UMODULES_SUPPORTED -DKERNEL_PRIVATE -DKERNEL -DPRIVATE -UDRIVERKIT -DXNU_LIBCXX_SDKROOT -UEXCLAVEKIT -UEXCLAVECORE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(TEST_ONLY_GUARDS_UNIFDEF) 1377*f6217f89SApple OSS DistributionsKINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UMODULES_SUPPORTED -UKERNEL_PRIVATE -DKERNEL -UPRIVATE -UDRIVERKIT -UEXCLAVEKIT -UEXCLAVECORE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__ $(TEST_ONLY_GUARDS_UNIFDEF) 1378*f6217f89SApple OSS DistributionsPDATA_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -DPRIVATE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__ $(TEST_ONLY_GUARDS_UNIFDEF) 1379*f6217f89SApple OSS DistributionsDATA_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DMODULES_SUPPORTED -UPRIVATE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__ $(TEST_ONLY_GUARDS_UNIFDEF) 1380*f6217f89SApple OSS Distributions 1381*f6217f89SApple OSS Distributions# 1382*f6217f89SApple OSS Distributions# Compononent Header file destinations 1383*f6217f89SApple OSS Distributions# 1384*f6217f89SApple OSS DistributionsEXPDIR = EXPORT_HDRS/$(COMPONENT) 1385*f6217f89SApple OSS Distributions 1386*f6217f89SApple OSS Distributions# 1387*f6217f89SApple OSS Distributions# Strip Flags 1388*f6217f89SApple OSS Distributions# 1389*f6217f89SApple OSS DistributionsSTRIP_FLAGS_RELEASE = -S -x 1390*f6217f89SApple OSS DistributionsSTRIP_FLAGS_DEVELOPMENT = -S 1391*f6217f89SApple OSS DistributionsSTRIP_FLAGS_KASAN = $(STRIP_FLAGS_DEVELOPMENT) 1392*f6217f89SApple OSS DistributionsSTRIP_FLAGS_DEBUG = -S 1393*f6217f89SApple OSS DistributionsSTRIP_FLAGS_SPTM = $(STRIP_FLAGS_DEVELOPMENT) 1394*f6217f89SApple OSS DistributionsSTRIP_FLAGS_PROFILE = -S -x 1395*f6217f89SApple OSS Distributions 1396*f6217f89SApple OSS DistributionsSTRIP_FLAGS = $($(addsuffix $(CURRENT_KERNEL_CONFIG),STRIP_FLAGS_)) 1397*f6217f89SApple OSS Distributions 1398*f6217f89SApple OSS Distributions# 1399*f6217f89SApple OSS Distributions# dsymutil flags 1400*f6217f89SApple OSS Distributions# 1401*f6217f89SApple OSS DistributionsDSYMUTIL_FLAGS_X86_64 = --arch=x86_64 1402*f6217f89SApple OSS DistributionsDSYMUTIL_FLAGS_X86_64H = --arch=x86_64h 1403*f6217f89SApple OSS DistributionsDSYMUTIL_FLAGS_ARM64 = 1404*f6217f89SApple OSS Distributions 1405*f6217f89SApple OSS DistributionsDSYMUTIL_FLAGS = $($(addsuffix $(CURRENT_ARCH_CONFIG),DSYMUTIL_FLAGS_)) 1406*f6217f89SApple OSS Distributions 1407*f6217f89SApple OSS Distributions 1408*f6217f89SApple OSS Distributions 1409*f6217f89SApple OSS Distributions 1410*f6217f89SApple OSS Distributions# 1411*f6217f89SApple OSS Distributions# Man Page destination 1412*f6217f89SApple OSS Distributions# 1413*f6217f89SApple OSS DistributionsMANDIR = /usr/share/man 1414*f6217f89SApple OSS Distributions 1415*f6217f89SApple OSS Distributions# 1416*f6217f89SApple OSS Distributions# DEBUG alias location 1417*f6217f89SApple OSS Distributions# 1418*f6217f89SApple OSS DistributionsDEVELOPER_EXTRAS_DIR = /AppleInternal/CoreOS/xnu_$(CURRENT_KERNEL_CONFIG_LC) 1419*f6217f89SApple OSS Distributions 1420*f6217f89SApple OSS Distributions# 1421*f6217f89SApple OSS Distributions# mach_kernel install location 1422*f6217f89SApple OSS Distributions# 1423*f6217f89SApple OSS DistributionsINSTALL_KERNEL_DIR = / 1424*f6217f89SApple OSS Distributions 1425*f6217f89SApple OSS Distributions# 1426*f6217f89SApple OSS Distributions# new OS X install location 1427*f6217f89SApple OSS Distributions# 1428*f6217f89SApple OSS DistributionsSYSTEM_LIBRARY_KERNELS_DIR = /System/Library/Kernels 1429*f6217f89SApple OSS Distributions 1430*f6217f89SApple OSS Distributions# 1431*f6217f89SApple OSS Distributions# File names in DSTROOT 1432*f6217f89SApple OSS Distributions# 1433*f6217f89SApple OSS Distributions 1434*f6217f89SApple OSS Distributionsifeq ($(PLATFORM),MacOSX) 1435*f6217f89SApple OSS DistributionsKERNEL_FILE_NAME_PREFIX = kernel 1436*f6217f89SApple OSS Distributionselse 1437*f6217f89SApple OSS DistributionsKERNEL_FILE_NAME_PREFIX = mach 1438*f6217f89SApple OSS Distributionsendif 1439*f6217f89SApple OSS Distributions 1440*f6217f89SApple OSS Distributionsifeq ($(CURRENT_MACHINE_CONFIG),NONE) 1441*f6217f89SApple OSS Distributionsifeq ($(CURRENT_KERNEL_CONFIG),RELEASE) 1442*f6217f89SApple OSS DistributionsKERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX) 1443*f6217f89SApple OSS DistributionsKERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX).py 1444*f6217f89SApple OSS Distributionselse 1445*f6217f89SApple OSS DistributionsKERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC) 1446*f6217f89SApple OSS DistributionsKERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX).py 1447*f6217f89SApple OSS Distributionsendif 1448*f6217f89SApple OSS Distributionselse 1449*f6217f89SApple OSS DistributionsKERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC).$(CURRENT_MACHINE_CONFIG_LC) 1450*f6217f89SApple OSS DistributionsKERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX)_$(CURRENT_KERNEL_CONFIG_LC).py 1451*f6217f89SApple OSS Distributionsendif 1452*f6217f89SApple OSS Distributions 1453*f6217f89SApple OSS DistributionsCURRENT_ALIAS_MACHINE_CONFIG = $(word 4,$(subst ^, ,$(CURRENT_BUILD_CONFIG))) 1454*f6217f89SApple OSS DistributionsCURRENT_ALIAS_MACHINE_CONFIG_LC = $(shell printf "%s" "$(CURRENT_ALIAS_MACHINE_CONFIG)" | $(TR) A-Z a-z) 1455*f6217f89SApple OSS Distributionsifneq ($(CURRENT_ALIAS_MACHINE_CONFIG),) 1456*f6217f89SApple OSS DistributionsALIAS_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC).$(CURRENT_ALIAS_MACHINE_CONFIG_LC) 1457*f6217f89SApple OSS Distributionsendif 1458*f6217f89SApple OSS Distributions 1459*f6217f89SApple OSS Distributions# 1460*f6217f89SApple OSS Distributions# System.kext pseudo-kext install location 1461*f6217f89SApple OSS Distributions# 1462*f6217f89SApple OSS DistributionsINSTALL_EXTENSIONS_DIR = /System/Library/Extensions 1463*f6217f89SApple OSS DistributionsSYSTEM_KEXT_INFO_PLIST = $(addprefix $(INSTALL_EXTENSIONS_DIR),/System.kext/Info.plist) 1464*f6217f89SApple OSS Distributions 1465*f6217f89SApple OSS Distributions# 1466*f6217f89SApple OSS Distributions# System.kext PlugIns install location 1467*f6217f89SApple OSS Distributions# 1468*f6217f89SApple OSS DistributionsDSTROOT_SYSTEM_KEXT_PATH = $(addprefix $(DSTROOT)$(INSTALL_EXTENSIONS_DIR),/System.kext/PlugIns) 1469*f6217f89SApple OSS DistributionsSYMROOT_SYSTEM_KEXT_PATH = $(addprefix $(SYMROOT),/System.kext/PlugIns) 1470*f6217f89SApple OSS Distributions 1471*f6217f89SApple OSS Distributions# 1472*f6217f89SApple OSS Distributions# KDK location 1473*f6217f89SApple OSS Distributions# 1474*f6217f89SApple OSS DistributionsINSTALL_KERNEL_SYM_DIR = /System/Library/Extensions/KDK 1475*f6217f89SApple OSS Distributions 1476*f6217f89SApple OSS Distributions# 1477*f6217f89SApple OSS Distributions# Misc. Etc. 1478*f6217f89SApple OSS Distributions# 1479*f6217f89SApple OSS DistributionsINSTALL_SHARE_MISC_DIR = /usr/share/misc 1480*f6217f89SApple OSS DistributionsINSTALL_DTRACE_SCRIPTS_DIR = /usr/lib/dtrace 1481*f6217f89SApple OSS DistributionsINSTALL_DTRACE_LIBEXEC_DIR = /usr/libexec/dtrace 1482*f6217f89SApple OSS DistributionsINSTALL_ARIADNE_PLISTS_DIR = /AppleInternal/Library/Ariadne/Plists 1483*f6217f89SApple OSS Distributions# 1484*f6217f89SApple OSS Distributions# Generated xnu version file 1485*f6217f89SApple OSS Distributions# 1486*f6217f89SApple OSS DistributionsXNU_VERSION = $(OBJROOT)/xnuVersion 1487*f6217f89SApple OSS Distributions 1488*f6217f89SApple OSS Distributions# 1489*f6217f89SApple OSS Distributions# Overrides for XBS build aliases 1490*f6217f89SApple OSS Distributions# 1491*f6217f89SApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_headers_driverkit),) 1492*f6217f89SApple OSS DistributionsUSE_BINARY_PLIST = 1 1493*f6217f89SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_debug),) 1494*f6217f89SApple OSS DistributionsINSTALL_KERNEL_DIR := $(DEVELOPER_EXTRAS_DIR) 1495*f6217f89SApple OSS DistributionsINSTALL_KERNEL_SYM_DIR := $(DEVELOPER_EXTRAS_DIR) 1496*f6217f89SApple OSS DistributionsINSTALL_KERNEL_SYM_TO_KDK = 1 1497*f6217f89SApple OSS DistributionsINSTALL_XNU_DEBUG_FILES = 1 1498*f6217f89SApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),) 1499*f6217f89SApple OSS DistributionsINSTALL_KERNEL_SYM_TO_KDK = 1 1500*f6217f89SApple OSS DistributionsUSE_BINARY_PLIST = 1 1501*f6217f89SApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),) 1502*f6217f89SApple OSS DistributionsUSE_BINARY_PLIST = 1 1503*f6217f89SApple OSS Distributionselse ifeq ($(PLATFORM),MacOSX) 1504*f6217f89SApple OSS DistributionsINSTALL_KERNEL_DIR := $(SYSTEM_LIBRARY_KERNELS_DIR) 1505*f6217f89SApple OSS DistributionsINSTALL_KERNEL_SYM_DIR := $(SYSTEM_LIBRARY_KERNELS_DIR) 1506*f6217f89SApple OSS DistributionsINSTALL_KERNEL_SYM_TO_KDK = $(if $(filter YES,$(DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT)),1,0) 1507*f6217f89SApple OSS Distributionsendif 1508*f6217f89SApple OSS Distributions 1509*f6217f89SApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_kasan),) 1510*f6217f89SApple OSS DistributionsINSTALL_KASAN_ONLY = 1 1511*f6217f89SApple OSS Distributionsendif 1512*f6217f89SApple OSS Distributions 1513*f6217f89SApple OSS Distributions# vim: set ft=make: 1514