Loading...
--- libmalloc/libmalloc-792.1.1/tests/Makefile
+++ libmalloc/libmalloc-646.40.3/tests/Makefile
@@ -32,12 +32,9 @@
 OTHER_CFLAGS += \
 	-DDARWINTEST \
 	-DOS_ATOMIC_CONFIG_MEMORY_ORDER_DEPENDENCY=1 \
-	-DT_META_TAG_XZONE_AND_PGM=T_META_TAG\(\"xzone_and_pgm\"\) \
-	-DT_META_TAG_NO_ALLOCATOR_OVERRIDE=T_META_TAG\(\"no_allocator_override\"\) \
 	-DT_META_TAG_XZONE=T_META_TAG\(\"xzone\"\) \
 	-DT_META_TAG_XZONE_ONLY=T_META_TAG\(\"xzone_only\"\) \
 	-DT_META_TAG_NANO_ON_XZONE=T_META_TAG\(\"nano_on_xzone\"\) \
-	-DT_META_TAG_DISABLE_SANITIZERS_TRACES=T_META_TAG\(\"disable_sanitizers_traces\"\) \
 	-I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders \
 	-I$(SRCROOT)/../private \
 	-I$(SRCROOT)/../include \
@@ -52,16 +49,9 @@
 OTHER_CFLAGS += -DL4_CONFIG_PLAT_EVP
 OTHER_CFLAGS += -isystem $(SDKROOT)/System/ExclaveKit/usr/local/standalone/cL4-future/include
 OTHER_LDFLAGS += -L $(SDKROOT)/System/ExclaveKit/usr/local/lib
-OTHER_LDFLAGS += -lc++ -lobjc
-
-# FIXME: This should be inherited from SDKSettings.json, but Xcode doesn't
-# invoke the darwintests target once for each variant in BUILD_VARIANTS
-_OTHER_CFLAGS_asan := $(shell plutil -extract DefaultProperties._OTHER_CFLAGS_asan raw -expect string $(SDKROOT)/SDKSettings.json)
-# rdar://128967612 (Don't link compiler-rt for exclavekit sanitizers)
-_OTHER_LDFLAGS_asan := \
-	-fno-sanitize-link-runtime
-
-CUSTOM_TARGETS += libmalloc-exclavekit-darwintests libmalloc-exclavekit-darwintests_asan
+OTHER_LDFLAGS += -lc++
+
+CUSTOM_TARGETS += libmalloc-exclavekit-darwintests
 CUSTOM_TARGETS += libmalloc_exclavekit.plist
 endif
 
@@ -83,15 +73,13 @@
 	-llibc \
 	-llibc_plat_cl4_standalone_malloc \
 	-lm \
-	-lmalloc
-
-# FIXME: This should be inherited from SDKSettings.json, but Xcode doesn't
-# invoke the darwintests target once for each variant in BUILD_VARIANTS
-_OTHER_CFLAGS_asan := $(shell plutil -extract DefaultProperties._OTHER_CFLAGS_asan raw -expect string $(SDKROOT)/SDKSettings.json)
-_OTHER_LDFLAGS_asan := \
-	-Wl,-image_suffix,_asan
-
-CUSTOM_TARGETS += libmalloc-exclavecore-darwintests libmalloc-exclavecore-darwintests_asan
+	-lmalloc \
+	-lpmm \
+	-lvas \
+	-lvas-core \
+	-lxrt
+
+CUSTOM_TARGETS += libmalloc-exclavecore-darwintests
 CUSTOM_TARGETS += libmalloc_exclavecore.plist
 endif
 
@@ -153,21 +141,16 @@
 	tsan.c \
 	memory_pressure.c \
 	malloc_msl.c \
-	madvise.c \
-	security_policy.c
+	madvise.c
 
 # Exclaves don't support dispatch_apply, which this perf test relies on
 EXCLUDED_SOURCES += basic_malloc_free_perf.c
 
-# Guarded range is not implemented for Exclaves
-EXCLUDED_SOURCES += guarded_range_tests.c
-
-# These tests both include C files to test submodules, which causes symbol
+# These two tests both include C files to test submodules, which causes symbol
 # conflicts in the statically linked exclavecore tests
 ifeq ($(MALLOC_EXCLAVECORE),YES)
 EXCLUDED_SOURCES += \
 	mfm_test.c \
-	xzone_segment_tests.c \
 	xzone_metapool_tests.c
 endif # MALLOC_EXCLAVECORE
 else
@@ -228,52 +211,19 @@
 malloc_claimed_address_tests: OTHER_CFLAGS += -I../src
 scribble_tests: OTHER_CFLAGS += -I../src
 malloc_size_test: OTHER_CFLAGS += -I../src
+
 xzone: OTHER_LDFLAGS += -ldarwintest_utils
-
-enablement_tests: OTHER_LDFLAGS += -lobjc -fobjc-arc -ldarwintest_utils
-
-EXCLUDED_SOURCES += entitlement_test_tool.c guarded_range_test_tool.c
-
-ifeq ($(MALLOC_EXCLAVES),NO)
-hardened_heap_test_tool: entitlement_test_tool.c
-	mkdir -p $(SYMROOT)/assets/
-	$(CC) -o $(SYMROOT)/assets/$@ $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $<
-	env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements hardened_heap_test_tool-entitlements.plist $(SYMROOT)/assets/hardened_heap_test_tool
-
-install-hardened_heap_test_tool: hardened_heap_test_tool
-	mkdir -p $(INSTALLDIR)/assets
-	@cp $(SYMROOT)/assets/hardened_heap_test_tool $(INSTALLDIR)/assets
-
-hardened_browser_test_tool: entitlement_test_tool.c
-	mkdir -p $(SYMROOT)/assets/
-	$(CC) -o $(SYMROOT)/assets/$@ $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $<
-	env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements hardened_browser_test_tool-entitlements.plist $(SYMROOT)/assets/hardened_browser_test_tool
-
-install-hardened_browser_test_tool: hardened_browser_test_tool
-	mkdir -p $(INSTALLDIR)/assets
-	@cp $(SYMROOT)/assets/hardened_browser_test_tool $(INSTALLDIR)/assets
-
-guarded_range_test_tool: guarded_range_test_tool.c
-	mkdir -p $(SYMROOT)/assets/
-	$(CC) -o $(SYMROOT)/assets/$@ $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $<
-	env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/assets/guarded_range_test_tool
-
-install-guarded_range_test_tool: guarded_range_test_tool
-	mkdir -p $(INSTALLDIR)/assets
-	@cp $(SYMROOT)/assets/guarded_range_test_tool $(INSTALLDIR)/assets
-
-CUSTOM_TARGETS += hardened_heap_test_tool hardened_browser_test_tool guarded_range_test_tool
-endif
-
-MALLOC_TYPE_SWIFT_OBJS := $(addsuffix .o,$(addprefix malloc_type_swift_,$(ARCH_CONFIGS)))
-MALLOC_TYPE_SYM_SWIFT_OBJS := $(addprefix $(SYMROOT)/,$(MALLOC_TYPE_SWIFT_OBJS))
-
-memory_pressure: OTHER_CFLAGS := $(filter-out -fno-builtin -fno-typed-memory-operations,$(OTHER_CFLAGS))
 
 # -fno-builtin also disables TMO
 #
 # Build this test with no explicit TMO options to validate that it gets TMO
 # automatically on platforms where that's expected
+
+printer_tests: OTHER_LDFLAGS += -lobjc -fobjc-arc -ldarwintest_utils
+
+MALLOC_TYPE_SWIFT_OBJS := $(addsuffix .o,$(addprefix malloc_type_swift_,$(ARCH_CONFIGS)))
+MALLOC_TYPE_SYM_SWIFT_OBJS := $(addprefix $(SYMROOT)/,$(MALLOC_TYPE_SWIFT_OBJS))
+
 malloc_type: OTHER_CFLAGS := $(filter-out -fno-builtin -fno-typed-memory-operations,$(OTHER_CFLAGS))
 malloc_type: OTHER_CFLAGS += $(SYMROOT)/malloc_type_cpp.o $(MALLOC_TYPE_SYM_SWIFT_OBJS) $(SYMROOT)/malloc_type_objc.o
 malloc_type: $(SYMROOT)/malloc_type_cpp.o $(MALLOC_TYPE_SYM_SWIFT_OBJS) $(SYMROOT)/malloc_type_objc.o
@@ -302,9 +252,6 @@
 malloc_type_callsite: $(SYMROOT)/malloc_type_callsite_cpp.o
 malloc_type_callsite: OTHER_CFLAGS += $(SYMROOT)/malloc_type_callsite_cpp.o
 malloc_type_callsite: OTHER_LDFLAGS += -lc++
-
-
-guarded_range_tests: OTHER_LDFLAGS := -ldarwintest_utils
 
 ifeq ($(MALLOC_EXCLAVES),NO)
 # BATS test plist handling
@@ -328,16 +275,8 @@
 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets
 
 ifeq ($(MALLOC_EXCLAVEKIT),YES)
-# Linker arguments for ASAN must be prepended to select correct libraries
-libmalloc-exclavekit-darwintests_asan: OTHER_CFLAGS += $(_OTHER_CFLAGS_asan)
-libmalloc-exclavekit-darwintests_asan: OTHER_LDFLAGS := $(_OTHER_LDFLAGS_asan) $(OTHER_LDFLAGS)
-libmalloc-exclavekit-darwintests_asan: $(SOURCES_c) $(SYMROOT)/malloc_type_cpp.o
-	$(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/$@
 libmalloc-exclavekit-darwintests: $(SOURCES_c) $(SYMROOT)/malloc_type_cpp.o
 	$(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/$@
-install-libmalloc-exclavekit-darwintests_asan: libmalloc-exclavekit-darwintests_asan
-	mkdir -p $(INSTALLDIR)
-	cp $(SYMROOT)/$(patsubst install-%,%,$@) $(INSTALLDIR)/
 install-libmalloc-exclavekit-darwintests: libmalloc-exclavekit-darwintests
 	mkdir -p $(INSTALLDIR)
 	cp $(SYMROOT)/$(patsubst install-%,%,$@) $(INSTALLDIR)/
@@ -349,17 +288,9 @@
 endif
 
 ifeq ($(MALLOC_EXCLAVECORE),YES)
-# Linker arguments for ASAN must be prepended to select correct libraries
-libmalloc-exclavecore-darwintests_asan: OTHER_CFLAGS += $(_OTHER_CFLAGS_asan)
-libmalloc-exclavecore-darwintests_asan: OTHER_LDFLAGS := $(_OTHER_LDFLAGS_asan) $(OTHER_LDFLAGS)
-libmalloc-exclavecore-darwintests_asan: $(SOURCES_c) exclavecore_support.c $(SYMROOT)/malloc_type_cpp.o
-	$(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/$@
 libmalloc-exclavecore-darwintests: $(SOURCES_c) exclavecore_support.c $(SYMROOT)/malloc_type_cpp.o
 	$(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/$@
-install-libmalloc-exclavecore-darwintests_asan: libmalloc-exclavecore-darwintests_asan
-	mkdir -p $(INSTALLDIR)
-	cp $(SYMROOT)/$(patsubst install-%,%,$@) $(INSTALLDIR)/
-install-libmalloc-exclavecore-darwintests: libmalloc-exclavecore-darwintests
+install-libmalloc-exclavecore-darwintests : libmalloc-exclavecore-darwintests
 	mkdir -p $(INSTALLDIR)
 	cp $(SYMROOT)/$(patsubst install-%,%,$@) $(INSTALLDIR)/
 libmalloc_exclavecore.plist: $(PROJECT_DIR)/tests/exclave/libmalloc_exclavecore.plist