forked from openkylin/platform_build
Merge "Enable LOCAL_SANITIZE:=cfi and add LOCAL_SANITIZE_DIAG." am: 2358c55d70
am: 04b11c5acd
am: 9eddd0620c
am: c14977f30b
Change-Id: I437e67c919454dda90bfdfcb69a51c949e35d8d8
This commit is contained in:
commit
73c7a886e4
|
@ -199,6 +199,7 @@ LOCAL_DPI_VARIANTS:=
|
|||
LOCAL_DPI_FILE_STEM:=
|
||||
LOCAL_SANITIZE:=
|
||||
LOCAL_SANITIZE_RECOVER:=
|
||||
LOCAL_SANITIZE_DIAG:=
|
||||
LOCAL_NOSANITIZE:=
|
||||
LOCAL_DATA_BINDING:=
|
||||
LOCAL_DBUS_PROXY_PREFIX:=
|
||||
|
|
|
@ -133,6 +133,11 @@ ifneq ($(my_sanitize),)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter cfi,$(my_sanitize)),)
|
||||
my_cflags += -flto -fsanitize-cfi-cross-dso -fvisibility=default
|
||||
my_ldflags += -flto -fsanitize-cfi-cross-dso -fsanitize=cfi -Wl,-plugin-opt,O1 -Wl,-export-dynamic-symbol=__cfi_check
|
||||
endif
|
||||
|
||||
# If local or global modules need ASAN, add linker flags.
|
||||
ifneq ($(filter address,$(my_global_sanitize) $(my_sanitize)),)
|
||||
my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
|
||||
|
@ -187,3 +192,13 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
|
|||
recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_RECOVER)),
|
||||
my_cflags += -fsanitize-recover=$(recover_arg)
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(LOCAL_SANITIZE_DIAG)),)
|
||||
notrap_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_DIAG)),
|
||||
my_cflags += -fno-sanitize-trap=$(notrap_arg)
|
||||
# Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
|
||||
ifeq ($(filter address thread,$(my_sanitize)),)
|
||||
# Does not have to be the first DT_NEEDED unlike ASan.
|
||||
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
|
||||
endif
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue