]> git.saurik.com Git - apple/xnu.git/blobdiff - san/Makefile
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / san / Makefile
index a2f25e8bce1905bb63bf9f4376c094ea133454b3..c22e3a9d1d8bd9b939822f51fd764a59fdcb60eb 100644 (file)
@@ -17,6 +17,7 @@ PRIVATE_KERNELFILES = \
 
 # Available only in xnu proper
 PRIVATE_XNUFILES = \
 
 # Available only in xnu proper
 PRIVATE_XNUFILES = \
+       ksancov.h \
        kasan.h
 
 INSTALL_MI_LIST = ${DATAFILES}
        kasan.h
 
 INSTALL_MI_LIST = ${DATAFILES}
@@ -30,12 +31,13 @@ INSTALL_MI_DIR = san
 EXPORT_MI_DIR = san
 COMP_SUBDIRS = conf
 
 EXPORT_MI_DIR = san
 COMP_SUBDIRS = conf
 
-$(OBJROOT)/san/kasan-blacklist-%: $(SOURCE)/kasan-blacklist $(SOURCE)/kasan-blacklist-%
-       @echo "$(ColorH)GENERATING$(Color0)    $(ColorLF)$(notdir $@)$(Color0)"
+.DELETE_ON_ERROR:
+$(OBJROOT)/san/kasan-blacklist-%: $(SOURCE)/kasan-blacklist $(SOURCE)/ubsan-blacklist $(SOURCE)/kasan-blacklist-%
+       @$(LOG_GENERATE) "$(notdir $@)"
        $(_v)sed -e 's,^src:\./,src:'"$(SRCROOT)/," $^ > $@
        $(_v)sed -e 's,^src:\./,src:'"$(SRCROOT)/," $^ > $@
+       $(_v)$(SOURCE)/tools/validate_blacklist.sh "$@"
 
 
-do_build_setup:: $(OBJROOT)/san/kasan-blacklist-x86_64
-
+do_build_setup:: $(OBJROOT)/san/kasan-blacklist-x86_64 $(OBJROOT)/san/kasan-blacklist-arm64
 
 #
 # Kasan System.kext plugin
 
 #
 # Kasan System.kext plugin
@@ -47,33 +49,42 @@ SYMROOT_KEXT_PATH = $(addprefix $(SYMROOT),/System.kext/PlugIns/Kasan.kext)
 ifneq ($(INSTALL_KASAN_ONLY),1)
 DSTROOT_KEXT = $(DSTROOT_KEXT_PATH)/Kasan
 SYMROOT_KEXT = $(SYMROOT_KEXT_PATH)/Kasan
 ifneq ($(INSTALL_KASAN_ONLY),1)
 DSTROOT_KEXT = $(DSTROOT_KEXT_PATH)/Kasan
 SYMROOT_KEXT = $(SYMROOT_KEXT_PATH)/Kasan
+SYMBOL_SET_BUILD = $(OBJPATH)/Kasan.symbolset
 endif
 
 ifeq ($(KASAN),1)
 DSTROOT_KEXT += $(DSTROOT_KEXT_PATH)/Kasan_kasan
 SYMROOT_KEXT += $(SYMROOT_KEXT_PATH)/Kasan_kasan
 endif
 
 ifeq ($(KASAN),1)
 DSTROOT_KEXT += $(DSTROOT_KEXT_PATH)/Kasan_kasan
 SYMROOT_KEXT += $(SYMROOT_KEXT_PATH)/Kasan_kasan
+SYMBOL_SET_BUILD += $(OBJPATH)/Kasan_kasan.symbolset
 endif
 
 # Our external dependency on allsymbols is fine because this runs in a later phase (config_install vs. config_all)
 $(OBJPATH)/%.symbolset: $(SOURCE)/%.exports
 endif
 
 # Our external dependency on allsymbols is fine because this runs in a later phase (config_install vs. config_all)
 $(OBJPATH)/%.symbolset: $(SOURCE)/%.exports
-       @echo "$(ColorH)SYMBOLSET$(Color0)  $(ColorF)$*$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
+       @$(LOG_SYMBOLSET) "$*$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
        $(_v)$(KEXT_CREATE_SYMBOL_SET)                  \
                $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG))    \
                -import $(OBJPATH)/allsymbols           \
                -export $<                              \
                -output $@ $(_vstdout)
 
        $(_v)$(KEXT_CREATE_SYMBOL_SET)                  \
                $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG))    \
                -import $(OBJPATH)/allsymbols           \
                -export $<                              \
                -output $@ $(_vstdout)
 
-$(DSTROOT_KEXT): $(DSTROOT_KEXT_PATH)/% : $(OBJPATH)/%.symbolset
+$(DSTROOT_KEXT): $(DSTROOT_KEXT_PATH)/% : $(SYMROOT_KEXT_PATH)/% ALWAYS
        $(_v)$(MKDIR) $(dir $@)
        $(_v)$(MKDIR) $(dir $@)
-       @echo "$(ColorF)INSTALL$(Color0)    $(ColorF)$(notdir $@)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
+       @$(LOG_INSTALL) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
        $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
 
        $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
 
-$(SYMROOT_KEXT): $(SYMROOT_KEXT_PATH)/% : $(DSTROOT_KEXT_PATH)/%
+$(SYMROOT_KEXT): $(SYMBOL_SET_BUILD) ALWAYS
        $(_v)$(MKDIR) $(dir $@)
        $(_v)$(MKDIR) $(dir $@)
-       @echo "$(ColorF)INSTALL$(Color0)    $(ColorF)$(notdir $@)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
-       $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
+       @$(LOG_INSTALL) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
+       $(_v)if [ $(OBJROOT)/.symbolset.timestamp -nt $@ ]; then                                \
+               $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@;                 \
+               cmdstatus=$$?;                                                                  \
+       else                                                                                    \
+               $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true;   \
+               cmdstatus=$$?;                                                                  \
+       fi;                                                                                     \
+       exit $$cmdstatus
 
 
-do_config_install:: $(DSTROOT_KEXT) $(SYMROOT_KEXT)
+do_config_install:: $(SYMROOT_KEXT) $(DSTROOT_KEXT)
 
 
 # Install helper scripts
 
 
 # Install helper scripts
@@ -84,7 +95,7 @@ endif
 
 $(KASAN_HELPER_SCRIPTS): $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/% : $(SOURCE)/tools/%
        $(_v)$(MKDIR) $(dir $@)
 
 $(KASAN_HELPER_SCRIPTS): $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/% : $(SOURCE)/tools/%
        $(_v)$(MKDIR) $(dir $@)
-       @echo "$(ColorH)INSTALL$(Color0)    $(ColorF)$(@F)$(Color0)"
+       @$(LOG_INSTALL) "$(@F)"
        $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
 
 do_config_install:: $(KASAN_HELPER_SCRIPTS)
        $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
 
 do_config_install:: $(KASAN_HELPER_SCRIPTS)