Skip to content

Commit 25a3754

Browse files
RomainNaourlauromoura
authored andcommitted
package/gcc/9.3.0: fix host-gcc-final when ccache is used
As reported by several Buildroot users [1][2][3], the gcc build may fail while running selftests makefile target. The problem only occurs when ccache is used with gcc 9 and 10, probably due to a race condition. While debuging with "make -p" we can notice that s-selftest-c target contain only "cc1" as dependency instead of cc1 and SELFTEST_DEPS [4]. s-selftest-c: cc1 While the build is failing, the s-selftest-c dependencies recipe is still running and reported as a bug by make. "Dependencies recipe running (THIS IS A BUG)." A change [5] in gcc 9 seems to introduce the problem since we can't reproduce this problem with gcc 8. As suggested by Yann E. MORIN [6], move SELFTEST_DEPS before including language makefile fragments. With the fix applied, the s-seltest-c dependency contains SELFTEST_DEPS value. s-selftest-c: cc1 xgcc specs stmp-int-hdrs ../../gcc/testsuite/selftests [1] http://lists.busybox.net/pipermail/buildroot/2020-May/282171.html [2] http://lists.busybox.net/pipermail/buildroot/2020-May/282766.html [3] cirosantilli/linux-kernel-module-cheat#108 [4] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/Make-lang.in;h=bfae6fd2549c4f728816cd355fa9739dcc08fcde;hb=033eb5671769a4c681a44aad08a454e667e08502#l120 [5] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=033eb5671769a4c681a44aad08a454e667e08502 [6] http://lists.busybox.net/pipermail/buildroot/2020-May/283213.html Signed-off-by: Romain Naour <[email protected]> Cc: Ben Dakin-Norris <[email protected]> Cc: Maxim Kochetkov <[email protected]> Cc: Thomas Petazzoni <[email protected]> Cc: Yann E. MORIN <[email protected]> Signed-off-by: Yann E. MORIN <[email protected]> (cherry picked from commit 58ecbbc) Signed-off-by: Peter Korsgaard <[email protected]>
1 parent 0853f2c commit 25a3754

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From 811c8d628045c3d248144fc560a4bf80209ca16e Mon Sep 17 00:00:00 2001
2+
From: Romain Naour <[email protected]>
3+
Date: Thu, 21 May 2020 15:58:02 +0200
4+
Subject: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language
5+
makefile fragments
6+
7+
As reported by several Buildroot users [1][2][3], the gcc build
8+
may fail while running selftests makefile target.
9+
10+
The problem only occurs when ccache is used with gcc 9 and 10,
11+
probably due to a race condition.
12+
13+
While debuging with "make -p" we can notice that s-selftest-c target
14+
contain only "cc1" as dependency instead of cc1 and SELFTEST_DEPS [4].
15+
16+
s-selftest-c: cc1
17+
18+
While the build is failing, the s-selftest-c dependencies recipe is
19+
still running and reported as a bug by make.
20+
21+
"Dependencies recipe running (THIS IS A BUG)."
22+
23+
A change [5] in gcc 9 seems to introduce the problem since we can't
24+
reproduce this problem with gcc 8.
25+
26+
As suggested by Yann E. MORIN [6], move SELFTEST_DEPS before
27+
including language makefile fragments.
28+
29+
With the fix applied, the s-seltest-c dependency contains
30+
SELFTEST_DEPS value.
31+
32+
s-selftest-c: cc1 xgcc specs stmp-int-hdrs ../../gcc/testsuite/selftests
33+
34+
[1] http://lists.busybox.net/pipermail/buildroot/2020-May/282171.html
35+
[2] http://lists.busybox.net/pipermail/buildroot/2020-May/282766.html
36+
[3] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/108
37+
[4] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/Make-lang.in;h=bfae6fd2549c4f728816cd355fa9739dcc08fcde;hb=033eb5671769a4c681a44aad08a454e667e08502#l120
38+
[5] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=033eb5671769a4c681a44aad08a454e667e08502
39+
[6] http://lists.busybox.net/pipermail/buildroot/2020-May/283213.html
40+
41+
Upstream status: https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546248.html
42+
43+
Signed-off-by: Romain Naour <[email protected]>
44+
Cc: Ben Dakin-Norris <[email protected]>
45+
Cc: Maxim Kochetkov <[email protected]>
46+
Cc: Thomas Petazzoni <[email protected]>
47+
Cc: Yann E. MORIN <[email protected]>
48+
Cc: Cc: David Malcolm <[email protected]>
49+
---
50+
This patch should be backported to gcc 10 and gcc 9.
51+
---
52+
gcc/Makefile.in | 6 ++++--
53+
1 file changed, 4 insertions(+), 2 deletions(-)
54+
55+
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
56+
index abae872cd63..e2ef3c46afc 100644
57+
--- a/gcc/Makefile.in
58+
+++ b/gcc/Makefile.in
59+
@@ -1686,6 +1686,10 @@ $(FULL_DRIVER_NAME): ./xgcc
60+
rm -f $@
61+
$(LN_S) $< $@
62+
63+
+# SELFTEST_DEPS need to be set before including language makefile fragments.
64+
+# Otherwise $(SELFTEST_DEPS) is empty when used from various <LANG>/Make-lang.in.
65+
+SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
66+
+
67+
#
68+
# Language makefile fragments.
69+
70+
@@ -1950,8 +1954,6 @@ DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null)
71+
SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \
72+
-fself-test=$(srcdir)/testsuite/selftests
73+
74+
-SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
75+
-
76+
# Run the selftests during the build once we have a driver and the frontend,
77+
# so that self-test failures are caught as early as possible.
78+
# Use "s-selftest-FE" to ensure that we only run the selftests if the
79+
--
80+
2.25.4
81+

0 commit comments

Comments
 (0)