Loading...
--- libmalloc/libmalloc-646.40.3/tests/Makefile
+++ libmalloc/libmalloc-715.120.13/tests/Makefile
@@ -32,9 +32,12 @@
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 \
@@ -49,9 +52,16 @@
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++
-
-CUSTOM_TARGETS += libmalloc-exclavekit-darwintests
+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
CUSTOM_TARGETS += libmalloc_exclavekit.plist
endif
@@ -73,13 +83,15 @@
-llibc \
-llibc_plat_cl4_standalone_malloc \
-lm \
- -lmalloc \
- -lpmm \
- -lvas \
- -lvas-core \
- -lxrt
-
-CUSTOM_TARGETS += libmalloc-exclavecore-darwintests
+ -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
CUSTOM_TARGETS += libmalloc_exclavecore.plist
endif
@@ -141,7 +153,8 @@
tsan.c \
memory_pressure.c \
malloc_msl.c \
- madvise.c
+ madvise.c \
+ security_policy.c
# Exclaves don't support dispatch_apply, which this perf test relies on
EXCLUDED_SOURCES += basic_malloc_free_perf.c
@@ -211,7 +224,6 @@
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
# -fno-builtin also disables TMO
@@ -219,10 +231,12 @@
# 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
+enablement_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))
+
+memory_pressure: OTHER_CFLAGS := $(filter-out -fno-builtin -fno-typed-memory-operations,$(OTHER_CFLAGS))
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
@@ -252,6 +266,7 @@
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++
+
ifeq ($(MALLOC_EXCLAVES),NO)
# BATS test plist handling
@@ -275,8 +290,16 @@
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)/
@@ -288,9 +311,17 @@
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 : libmalloc-exclavecore-darwintests
+install-libmalloc-exclavecore-darwintests_asan: libmalloc-exclavecore-darwintests_asan
+ mkdir -p $(INSTALLDIR)
+ cp $(SYMROOT)/$(patsubst install-%,%,$@) $(INSTALLDIR)/
+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