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