Debian Codegraph @

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

raw
1 From 41f159de9ca697880f9dc84b7f4e1bc87043a774 Mon Sep 17 00:00:00 2001
2 Message-ID: <41f159de9ca697880f9dc84b7f4e1bc87043a774.1757532466.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 (cherry picked from commit 121c5d08d53cb1f95d9881838523b0305c3f3bef)
22 Signed-off-by: Omar Sandoval <[email protected]>
23 ---
24 Makefile | 6 +++++-
25 1 file changed, 5 insertions(+), 1 deletion(-)
26
27 diff --git a/Makefile b/Makefile
28 index 8df76f9b0712..06ae74da97fc 100644
29 --- a/Makefile
30 +++ b/Makefile
31 @@ -748,5 +748,9 @@ endif
32 endif
33
34 -KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
35 +# Workaround for GCC versions < 5.0
36 +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
37 +ifdef CONFIG_CC_IS_GCC
38 +KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
39 +endif
40
41 ifdef CONFIG_DEBUG_INFO
42 --
43 2.51.0
44