DivestOS/Patches/LineageOS-18.1/android_build/0001-Enable_fwrapv.patch

24 lines
717 B
Diff
Raw Normal View History

2021-06-26 15:17:41 -04:00
From 291dbe72601348043d14d95e0ea0f09152b0b2cd Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 13 Sep 2016 22:05:56 -0400
Subject: [PATCH] use -fwrapv when signed overflow checking is off
---
core/config_sanitizers.mk | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index efb21e7c6a..41d7fe5dbf 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -447,3 +447,9 @@ ifneq ($(findstring fsanitize,$(my_cflags)),)
endif
endif
endif
+
+ifeq ($(filter signed-integer-overflow integer undefined,$(my_sanitize)),)
+ ifeq ($(filter -ftrapv,$(my_cflags)),)
+ my_cflags += -fwrapv
+ endif
+endif