mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
Enable Clang's -ftrivial-auto-var-init=zero on supported kernels
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
256df737a3
commit
e2c499dd24
@ -0,0 +1,22 @@
|
|||||||
|
From 919a61dedb0458ebd52291cb6d4948446fad4b44 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Micay <danielmicay@gmail.com>
|
||||||
|
Date: Wed, 8 Apr 2020 11:10:43 -0400
|
||||||
|
Subject: [PATCH] enable -ftrivial-auto-var-init=zero
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 79e2a78a7e92..abc66c11c84a 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -770,6 +770,8 @@ KBUILD_CFLAGS += -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
+KBUILD_CFLAGS += -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||||
|
+
|
||||||
|
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
|
||||||
|
|
||||||
|
ifdef CONFIG_DEBUG_INFO
|
@ -536,6 +536,41 @@ hardenBootArgs() {
|
|||||||
}
|
}
|
||||||
export -f hardenBootArgs;
|
export -f hardenBootArgs;
|
||||||
|
|
||||||
|
enableAutoVarInit() {
|
||||||
|
cd "$DOS_BUILD_BASE";
|
||||||
|
for kernel in "${DOS_AUTOVARINIT_KERNELS[@]}"
|
||||||
|
do
|
||||||
|
if [ -d "$DOS_BUILD_BASE/kernel/$kernel" ]; then
|
||||||
|
cd "$DOS_BUILD_BASE/kernel/$kernel";
|
||||||
|
if git apply --check "$DOS_PATCHES_COMMON/android_kernel_common/0001-auto_var_init.patch" &> /dev/null; then
|
||||||
|
if git apply "$DOS_PATCHES_COMMON/android_kernel_common/0001-auto_var_init.patch" &> /dev/null; then #(GrapheneOS)
|
||||||
|
echo "auto-var-init: Enabled for $kernel";
|
||||||
|
else
|
||||||
|
echo "auto-var-init: Failed to enable for $kernel";
|
||||||
|
fi;
|
||||||
|
elif git apply --check --reverse "$DOS_PATCHES_COMMON/android_kernel_common/0001-auto_var_init.patch" &> /dev/null; then
|
||||||
|
echo "auto-var-init: Already enabled for $kernel";
|
||||||
|
elif grep -q "trivial-auto-var-init=pattern" Makefile; then
|
||||||
|
sed -i 's/ftrivial-auto-var-init=pattern/ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang/' Makefile; #(GrapheneOS)
|
||||||
|
grep -q "trivial-auto-var-init=pattern" Makefile;
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "auto-var-init: Failed to switch from pattern to zero on $kernel";
|
||||||
|
else
|
||||||
|
echo "auto-var-init: Switched from pattern to zero on $kernel";
|
||||||
|
fi;
|
||||||
|
elif grep -q "trivial-auto-var-init=zero" Makefile; then
|
||||||
|
echo "auto-var-init: Already enabled for $kernel";
|
||||||
|
else
|
||||||
|
echo "auto-var-init: Could not enable for $kernel";
|
||||||
|
fi;
|
||||||
|
# else
|
||||||
|
# echo "auto-var-init: $kernel not in tree";
|
||||||
|
fi;
|
||||||
|
done;
|
||||||
|
cd "$DOS_BUILD_BASE";
|
||||||
|
}
|
||||||
|
export -f enableAutoVarInit;
|
||||||
|
|
||||||
disableEnforceRRO() {
|
disableEnforceRRO() {
|
||||||
cd "$DOS_BUILD_BASE$1";
|
cd "$DOS_BUILD_BASE$1";
|
||||||
awk -i inplace '!/PRODUCT_ENFORCE_RRO_TARGETS .= framework-res/' *.mk &>/dev/null || true;
|
awk -i inplace '!/PRODUCT_ENFORCE_RRO_TARGETS .= framework-res/' *.mk &>/dev/null || true;
|
||||||
|
@ -482,6 +482,7 @@ if [ "$DOS_GRAPHENE_EXEC" = true ]; then find "device" -maxdepth 2 -mindepth 2 -
|
|||||||
cd "$DOS_BUILD_BASE";
|
cd "$DOS_BUILD_BASE";
|
||||||
deblobAudio;
|
deblobAudio;
|
||||||
removeBuildFingerprints;
|
removeBuildFingerprints;
|
||||||
|
enableAutoVarInit;
|
||||||
|
|
||||||
#Tweaks for <2GB RAM devices
|
#Tweaks for <2GB RAM devices
|
||||||
#enableLowRam "device/motorola/harpia";
|
#enableLowRam "device/motorola/harpia";
|
||||||
|
@ -576,6 +576,7 @@ if [ "$DOS_GRAPHENE_EXEC" = true ]; then find "device" -maxdepth 2 -mindepth 2 -
|
|||||||
cd "$DOS_BUILD_BASE";
|
cd "$DOS_BUILD_BASE";
|
||||||
deblobAudio;
|
deblobAudio;
|
||||||
removeBuildFingerprints;
|
removeBuildFingerprints;
|
||||||
|
enableAutoVarInit;
|
||||||
|
|
||||||
#Tweaks for <2GB RAM devices
|
#Tweaks for <2GB RAM devices
|
||||||
#enableLowRam "device/samsung/serrano3gxx";
|
#enableLowRam "device/samsung/serrano3gxx";
|
||||||
|
@ -78,6 +78,7 @@ export DOS_SENSORS_PERM_NEW=true;
|
|||||||
export DOS_STRONG_ENCRYPTION_ENABLED=false; #Set true to enable AES 256-bit FDE encryption on 14.1+15.1 XXX: THIS WILL **DESTROY** EXISTING INSTALLS!
|
export DOS_STRONG_ENCRYPTION_ENABLED=false; #Set true to enable AES 256-bit FDE encryption on 14.1+15.1 XXX: THIS WILL **DESTROY** EXISTING INSTALLS!
|
||||||
export DOS_WEBVIEW_LFS=true; #Whether to `git lfs pull` in the WebView repository
|
export DOS_WEBVIEW_LFS=true; #Whether to `git lfs pull` in the WebView repository
|
||||||
#alias DOS_WEBVIEW_CHERRYPICK='git pull "https://github.com/LineageOS/android_external_chromium-webview" refs/changes/00/316600/2';
|
#alias DOS_WEBVIEW_CHERRYPICK='git pull "https://github.com/LineageOS/android_external_chromium-webview" refs/changes/00/316600/2';
|
||||||
|
export DOS_AUTOVARINIT_KERNELS=('essential/msm8998' 'fxtec/msm8998' 'google/coral' 'google/msm-4.9' 'google/redbull' 'google/sunfish' 'google/wahoo' 'oneplus/msm8996' 'oneplus/msm8998' 'oneplus/sdm845' 'oneplus/sm7250' 'oneplus/sm8150' 'razer/msm8998' 'razer/sdm845' 'sony/sdm660' 'sony/sdm845' 'xiaomi/sdm660' 'xiaomi/sdm845' 'xiaomi/sm6150' 'xiaomi/sm8150' 'xiaomi/sm8250' 'zuk/msm8996');
|
||||||
|
|
||||||
#Servers
|
#Servers
|
||||||
export DOS_DEFAULT_DNS_PRESET="Quad9"; #Sets default DNS. Options: See changeDefaultDNS() in Scripts/Common/Functions.sh
|
export DOS_DEFAULT_DNS_PRESET="Quad9"; #Sets default DNS. Options: See changeDefaultDNS() in Scripts/Common/Functions.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user