Enable Clang's -ftrivial-auto-var-init=zero on 17.1

Just like Android 11+

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2022-03-31 22:04:50 -04:00
parent e26908b9e0
commit 8dbdc0f31e
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,21 @@
From af24d46eff1f846432eb5e9ff8365edde901addd Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 8 Apr 2020 10:42:11 -0400
Subject: [PATCH] enable -ftrivial-auto-var-init=zero
---
cc/config/global.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/cc/config/global.go b/cc/config/global.go
index 7c7b47a51..26806ce18 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -58,6 +58,7 @@ var (
"-fno-short-enums",
"-funwind-tables",
"-fstack-protector-strong",
+ "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang",
"-Wa,--noexecstack",
"-D_FORTIFY_SOURCE=2",

View File

@ -101,6 +101,7 @@ fi;
if enterAndClear "build/soong"; then
applyPatch "$DOS_PATCHES/android_build_soong/0001-Enable_fwrapv.patch"; #Use -fwrapv at a minimum (GrapheneOS)
applyPatch "$DOS_PATCHES/android_build_soong/0002-auto_var_init.patch"; #Enable -ftrivial-auto-var-init=zero (GrapheneOS)
fi;
if enterAndClear "device/qcom/sepolicy-legacy"; then