Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54e0b7de authored by Dan Albert's avatar Dan Albert Committed by Android Git Automerger
Browse files

am 6b966aff: Merge "Fix sanitizer choice for global vs module."

* commit '6b966aff':
  Fix sanitizer choice for global vs module.
parents 088849e2 6b966aff
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -4,33 +4,33 @@

my_sanitize := $(strip $(LOCAL_SANITIZE))

# Don't apply sanitizers to NDK code.
ifdef LOCAL_SDK_VERSION
  my_sanitize := never
endif

# Configure SANITIZE_HOST / SANITIZE_TARGET.
ifeq ($(my_sanitize),)
# SANITIZE_HOST is only in effect if the module is already using clang (host
# modules that haven't set `LOCAL_CLANG := false` and device modules that
# have set `LOCAL_CLANG := true`.
my_global_sanitize :=
ifeq ($(my_clang),true)
  ifdef LOCAL_IS_HOST_MODULE
    my_sanitize := $(strip $(SANITIZE_HOST))
    my_global_sanitize := $(strip $(SANITIZE_HOST))

    # SANITIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
    my_global_sanitize := $(subst true,address,$(my_global_sanitize))
  else
    my_sanitize := $(strip $(SANITIZE_TARGET))
    my_global_sanitize := $(strip $(SANITIZE_TARGET))
  endif
endif

  # SANITIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
  ifeq ($(my_sanitize),true)
    my_sanitize := address
# The sanitizer specified by the environment wins over the module.
ifneq ($(my_global_sanitize),)
  my_sanitize := $(my_global_sanitize)
endif

  # SANITIZE_HOST is only in effect if the module is already using clang (host
  # modules that haven't set `LOCAL_CLANG := false` and device modules that
  # have set `LOCAL_CLANG := true`.
  ifneq ($(my_clang),true)
# Don't apply sanitizers to NDK code.
ifdef LOCAL_SDK_VERSION
  my_sanitize :=
endif
endif

ifeq ($(my_sanitize),never)
# Never always wins.
ifeq ($(LOCAL_SANITIZE),never)
  my_sanitize :=
endif