Skip to content

Instantly share code, notes, and snippets.

View nathanchance's full-sized avatar
🛠️
Trying not to drown in bugs

Nathan Chancellor nathanchance

🛠️
Trying not to drown in bugs
View GitHub Profile

Introduction

Google has traditionally been against upgrading the compiler as it comes with new warnings and potentially changes behavior. However, these are actually good reasons to upgrade, they help shake out undefined behavior.

Process

In order to compile with a newer version of GCC, you'll need to do a few modifications to your kernel in addition to a new toolchain. I recommend using the ones available from Bootlin.

  1. Remove gcc-wrapper and any instances of -Werror: gcc-wrapper is CAF's shitty way of enabling -Werror, which is unnecessary since regular -Werror will suffice. We need to remove it for the time being because there will be new warnings to fix. Pick Google's revert of it (3.18, 4.4) then remove any other instances of -Werror (such as in prima, qcacld-2.0, and qc
#!/usr/bin/env bash
function die() {
echo
echo -e "\033[01;31m${1}\033[0m"
echo
exit 1
}
REPOS=( "fw-api" "qcacld-3.0" "qca-wifi-host-cmn" )
build/powerpc/bad/arch/powerpc/kvm/book3s_hv_nested.o: file format elf64-powerpc
Disassembly of section .text:
0000000000000000 <.kvmhv_save_hv_regs>:
0: 7c 08 02 a6 mflr r0
4: fb e1 ff f8 std r31,-8(r1)
8: f8 01 00 10 std r0,16(r1)
@nathanchance
nathanchance / gitfu
Last active September 18, 2020 23:45
Reset all files that conflict but keep the non-conflicted ones:
for i in $(git status | grep "both modified" | awk '{print $3}'); do git reset HEAD $i && git checkout -- $i; done
Delete all branches but one
for i in $(git ls-remote -q | grep "refs/head" | cut -d '/' -f 3 | awk '!(/^<BRANCH_NAME_TO_KEEP>$/)'); do git push origin :$i; done
1 arch/x86/kernel/kprobes/core.c:959:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 arch/x86/kernel/uprobes.c:1015:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 arch/x86/kvm/cpuid.c:335:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 arch/x86/kvm/vmx/vmx.c:6005:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 block/compat_ioctl.c:282:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 block/ioprio.c:76:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 drivers/accessibility/braille/braille_console.c:249:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 drivers/acpi/sbshc.c:234:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1 drivers/ata/libata-eh.c:2814:4: warning:
wget https://www.samba.org/ftp/ccache/ccache-3.3.4.tar.gz && tar -xvf ccache-3.3.4.tar.gz && cd ccache-3.3.4 && ./configure && sudo make -j$( grep "^processor" /proc/cpuinfo | wc -l ) install && cd .. && rm -rf ccache-3.3.4*
git clone https://github.com/ninja-build/ninja && cd ninja && ./configure.py --bootstrap && sudo cp -v ninja /usr/local/bin && cd .. && rm -rf ninja
which ninja && which ccache
ccache -V && ninja --version
Intel Core i7-7700:
arm:multi_v7_defconfig | Success in 9 minutes and 20 seconds
arm:allyesconfig | Success in 43 minutes and 4 seconds
arm64:defconfig | Success in 12 minutes and 38 seconds
arm64:allyesconfig | Success in 48 minutes and 19 seconds
From 93926cb441d2c82c31be82ab4078c6750b88cffb Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Sun, 30 Sep 2018 18:35:46 -0700
Subject: [PATCH 1/6] DO-NOT-UPSTREAM: Disable GCOV_KERNEL for Clang
Patches currently in testing, just don't want to add them to my stack.
Link: https://github.com/ClangBuiltLinux/linux/issues/17
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
From 8c16eb5d852c426449c35f5c638fa0241de59900 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 10 Dec 2018 17:59:43 -0700
Subject: [PATCH 1/4] DO-NOT-UPSTREAM: arm: Don't select HAVE_FUNCTION_TRACER
with Clang
Link: https://github.com/ClangBuiltLinux/linux/issues/35
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/Kconfig | 2 +-