Debian Codegraph @

vmtest/patches/kbuild-Only-add-fno-var-tracking-assignments-for-old.patch

raw
1 From 121c5d08d53cb1f95d9881838523b0305c3f3bef Mon Sep 17 00:00:00 2001
2 Message-ID: <121c5d08d53cb1f95d9881838523b0305c3f3bef.1757526866.git.osandov@osandov.com>
3 From: Mark Wielaard <[email protected]>
4 Date: Sat, 17 Oct 2020 14:01:35 +0200
5 Subject: [PATCH] kbuild: Only add -fno-var-tracking-assignments for old GCC
6 versions
7
8 Some old GCC versions between 4.5.0 and 4.9.1 might miscompile code
9 with -fvar-tracking-assingments (which is enabled by default with -g -O2).
10 Commit 2062afb4f804 ("Fix gcc-4.9.0 miscompilation of load_balance()
11 in scheduler") added -fno-var-tracking-assignments unconditionally to
12 work around this. But newer versions of GCC no longer have this bug, so
13 only add it for versions of GCC before 5.0. This allows various tools
14 such as a perf probe or gdb debuggers or systemtap to resolve variable
15 locations using dwarf locations in more code.
16
17 Signed-off-by: Mark Wielaard <[email protected]>
18 Acked-by: Ian Rogers <[email protected]>
19 Reviewed-by: Andi Kleen <[email protected]>
20 Signed-off-by: Masahiro Yamada <[email protected]>
21 ---
22 Makefile | 6 +++++-
23 1 file changed, 5 insertions(+), 1 deletion(-)
24
25 diff --git a/Makefile b/Makefile
26 index b76c4122c967..17a62e365a38 100644
27 --- a/Makefile
28 +++ b/Makefile
29 @@ -815,5 +815,9 @@ KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-f
30 endif
31
32 -DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments)
33 +# Workaround for GCC versions < 5.0
34 +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
35 +ifdef CONFIG_CC_IS_GCC
36 +DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
37 +endif
38
39 ifdef CONFIG_DEBUG_INFO
40 --
41 2.51.0
42