Add Scudo support for Make
Scudo is a hardened usermode allocator that is part of LLVM's compiler-rt project (home of the Sanitizers). clang allows for -fsanitize=scudo as a possible command line option to link the shared Scudo library to a binary. This patch add Scudo as a potential sanitize option. Scudo is not compatible with ASan and TSan and will be disabled if either is enabled. Test: aosp compiled with m -j Test: local experiment with LOCAL_SANITIZE := scudo to ensure that a test target (mediaserver) could be linked with scudo. Change-Id: I462843b9d5512fba2c4a3ac1a0c356ca90bce4e5
This commit is contained in:
@@ -190,6 +190,15 @@ ifneq ($(filter safe-stack,$(my_sanitize)),)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Disable Scudo if ASan or TSan is enabled.
|
||||||
|
ifneq ($(filter address thread,$(my_sanitize)),)
|
||||||
|
my_sanitize := $(filter-out scudo,$(my_sanitize))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(filter scudo,$(my_sanitize)),)
|
||||||
|
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)SCUDO_RUNTIME_LIBRARY)
|
||||||
|
endif
|
||||||
|
|
||||||
# Undefined symbols can occur if a non-sanitized library links
|
# Undefined symbols can occur if a non-sanitized library links
|
||||||
# sanitized static libraries. That's OK, because the executable
|
# sanitized static libraries. That's OK, because the executable
|
||||||
# always depends on the ASan runtime library, which defines these
|
# always depends on the ASan runtime library, which defines these
|
||||||
@@ -374,7 +383,7 @@ ifneq ($(my_sanitize_diag),)
|
|||||||
notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
|
notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
|
||||||
my_cflags += -fno-sanitize-trap=$(notrap_arg)
|
my_cflags += -fno-sanitize-trap=$(notrap_arg)
|
||||||
# Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
|
# Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
|
||||||
ifeq ($(filter address thread,$(my_sanitize)),)
|
ifeq ($(filter address thread scudo,$(my_sanitize)),)
|
||||||
# Does not have to be the first DT_NEEDED unlike ASan.
|
# Does not have to be the first DT_NEEDED unlike ASan.
|
||||||
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
|
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
|
||||||
endif
|
endif
|
||||||
|
Reference in New Issue
Block a user