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

Commit a61f0042 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Enable integer_overflow flag for static targets."

parents c22e207c 702e8bda
Loading
Loading
Loading
Loading
+29 −14
Original line number Diff line number Diff line
@@ -34,6 +34,16 @@ ifneq ($(filter integer_overflow, $(my_global_sanitize)),)
  endif
endif

# Global integer sanitization doesn't support static modules.
ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
  my_global_sanitize := $(filter-out integer_overflow,$(my_global_sanitize))
  my_global_sanitize_diag := $(filter-out integer_overflow,$(my_global_sanitize_diag))
endif
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
  my_global_sanitize := $(filter-out integer_overflow,$(my_global_sanitize))
  my_global_sanitize_diag := $(filter-out integer_overflow,$(my_global_sanitize_diag))
endif

# Disable global CFI in excluded paths
ifneq ($(filter cfi, $(my_global_sanitize)),)
  combined_exclude_paths := $(CFI_EXCLUDE_PATHS) \
@@ -132,10 +142,12 @@ ifneq ($(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
  my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
endif

# Disable CFI for host targets
# Disable sanitizers which need the UBSan runtime for host targets.
ifdef LOCAL_IS_HOST_MODULE
  my_sanitize := $(filter-out cfi,$(my_sanitize))
  my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
  my_sanitize := $(filter-out signed-integer-overflow unsigned-integer-overflow integer_overflow,$(my_sanitize))
  my_sanitize_diag := $(filter-out signed-integer-overflow unsigned-integer-overflow integer_overflow,$(my_sanitize_diag))
endif

# Support for local sanitize blacklist paths.
@@ -212,9 +224,6 @@ ifneq ($(filter coverage,$(my_sanitize)),)
endif

ifneq ($(filter integer_overflow,$(my_sanitize)),)
  ifneq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
    ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)

  # Respect LOCAL_NOSANITIZE for integer-overflow flags.
  ifeq ($(filter signed-integer-overflow, $(strip $(LOCAL_NOSANITIZE))),)
    my_sanitize += signed-integer-overflow
@@ -224,11 +233,17 @@ ifneq ($(filter integer_overflow,$(my_sanitize)),)
  endif
  my_cflags += $(INTEGER_OVERFLOW_EXTRA_CFLAGS)

      # Check for diagnostics mode (on by default).
  # Check for diagnostics mode.
  ifneq ($(filter integer_overflow,$(my_sanitize_diag)),)
    ifneq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
      ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
        my_sanitize_diag += signed-integer-overflow
        my_sanitize_diag += unsigned-integer-overflow
      else
        $(call pretty-error,Make cannot apply integer overflow diagnostics to static binary.)
      endif
    else
      $(call pretty-error,Make cannot apply integer overflow diagnostics to static library.)
    endif
  endif
  my_sanitize := $(filter-out integer_overflow,$(my_sanitize))