Re: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language makefile fragments
Le 03/06/2020 à 22:24, Jeff Law a écrit : > On Wed, 2020-06-03 at 21:56 +0200, Romain Naour wrote: >> Hi Jeff, >> >> Le 03/06/2020 à 20:33, Jeff Law a écrit : >>> On Thu, 2020-05-21 at 17:35 +0200, Romain Naour via Gcc-patches wrote: >>>> 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] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/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 >>>> Cc: Ben Dakin-Norris >>>> Cc: Maxim Kochetkov >>>> Cc: Thomas Petazzoni >>>> Cc: Yann E. MORIN >>>> Cc: Cc: David Malcolm >>>> --- >>>> This patch should be backported to gcc 10 and gcc 9. >>>> --- >>>> gcc/ChangeLog | 5 + >>>> gcc/Makefile.in | 6 -- >>>> 2 files changed, 9 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/gcc/ChangeLog b/gcc/ChangeLog >>>> index 977e7664b62..c3bb18f2afd 100644 >>>> --- a/gcc/ChangeLog >>>> +++ b/gcc/ChangeLog >>>> @@ -1,3 +1,8 @@ >>>> +2020-05-21 Romain Naour >>>> + >>>> + * Makefile.in: move SELFTEST_DEPS before including language >>>> + makefile fragments. >>> THanks. I've installed this on the trunk. >> >> Many thanks for merging the patch! >> >> But I don't see the commit log I've written to explain the issue. >> Was there a reason to drop it? > As a project we're still trying to sort out the right level of verbosity of > the > commit log. I tend to use short ones. This patch should be backported to gcc 10 and 9. Best regards, Romain > > jeff >> >
[PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language makefile fragments
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] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/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 Cc: Ben Dakin-Norris Cc: Maxim Kochetkov Cc: Thomas Petazzoni Cc: Yann E. MORIN Cc: Cc: David Malcolm --- This patch should be backported to gcc 10 and gcc 9. --- gcc/ChangeLog | 5 + gcc/Makefile.in | 6 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 977e7664b62..c3bb18f2afd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-05-21 Romain Naour + + * Makefile.in: move SELFTEST_DEPS before including language + makefile fragments. + 2020-05-21 H.J. Lu PR target/95260 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 0fe2ba241e3..867a0fa8202 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1730,6 +1730,10 @@ $(FULL_DRIVER_NAME): ./xgcc rm -f $@ $(LN_S) $< $@ +# SELFTEST_DEPS need to be set before including language makefile fragments. +# Otherwise $(SELFTEST_DEPS) is empty when used from various /Make-lang.in. +SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests + # # Language makefile fragments. @@ -2006,8 +2010,6 @@ DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null) SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \ -fself-test=$(srcdir)/testsuite/selftests -SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests - # Run the selftests during the build once we have a driver and the frontend, # so that self-test failures are caught as early as possible. # Use "s-selftest-FE" to ensure that we only run the selftests if the -- 2.25.4
Re: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language makefile fragments
Hi All, Le 22/05/2020 à 00:13, David Malcolm a écrit : > On Thu, 2020-05-21 at 17:35 +0200, Romain Naour wrote: >> 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. > > Sorry about introducing the breakage. The patch looks sane to me, > though I don't know if I can formally approve it (and I'm now doubting > my "make" skills...) No problem, the issue is not obvious at all. My intention is to help people to backport the patch to previous gcc version. Best regards, Romain > > Dave >
Re: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language makefile fragments
Hi Jeff, Le 21/05/2020 à 19:41, Jeff Law a écrit : > On Thu, 2020-05-21 at 19:31 +0200, Richard Biener via Gcc-patches wrote: >> On May 21, 2020 5:35:19 PM GMT+02:00, Romain Naour via Gcc-patches < >> gcc-patches@gcc.gnu.org> wrote: >>> 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. >> >> Just as a note since a while I am regularly running into (the same?) issue >> when >> bootstrapping that xgcc is not yet built when self tests want to run and I >> stumbled across the very same dependency line. > My tester trips it once in a while too, so a big thanks to Romain for digging > into it. It's definitely in my queue of things to review. You're welcome :) Did you have time to review the patch ? I can provide a way to reproduce easily the issue by using Buildroot. Do you need something else ? Best regards, Romain > > jeff >> >
Re: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language makefile fragments
Hi Jeff, Le 03/06/2020 à 20:33, Jeff Law a écrit : > On Thu, 2020-05-21 at 17:35 +0200, Romain Naour via Gcc-patches wrote: >> 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] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/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 >> Cc: Ben Dakin-Norris >> Cc: Maxim Kochetkov >> Cc: Thomas Petazzoni >> Cc: Yann E. MORIN >> Cc: Cc: David Malcolm >> --- >> This patch should be backported to gcc 10 and gcc 9. >> --- >> gcc/ChangeLog | 5 + >> gcc/Makefile.in | 6 -- >> 2 files changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/gcc/ChangeLog b/gcc/ChangeLog >> index 977e7664b62..c3bb18f2afd 100644 >> --- a/gcc/ChangeLog >> +++ b/gcc/ChangeLog >> @@ -1,3 +1,8 @@ >> +2020-05-21 Romain Naour >> + >> +* Makefile.in: move SELFTEST_DEPS before including language >> +makefile fragments. > THanks. I've installed this on the trunk. Many thanks for merging the patch! But I don't see the commit log I've written to explain the issue. Was there a reason to drop it? Best regards, Romain > > jeff >> >
[PATCH] RISC-V: fix build issue with gcc 4.9.x
GCC should still build with GCC 4.8.3 or newer [1] using C++03 by default. But a recent change in RISC-V port introduced a C++11 feature "std::log2" [2]. Use log2 from the C header, without the namespace [3]. [1] https://gcc.gnu.org/install/prerequisites.html [2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc [3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std Fixes: https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589 gcc/ChangeLog: * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header, without the namespace. Signed-off-by: Romain Naour --- gcc/config/riscv/genrvv-type-indexer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc index e677b55290c..eebe382d1c3 100644 --- a/gcc/config/riscv/genrvv-type-indexer.cc +++ b/gcc/config/riscv/genrvv-type-indexer.cc @@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, unsigned eew, bool unsigned_p, if (sew == eew) elmul_log2 = lmul_log2; else if (sew > eew) -elmul_log2 = lmul_log2 - std::log2 (sew / eew); +elmul_log2 = lmul_log2 - log2 (sew / eew); else /* sew < eew */ -elmul_log2 = lmul_log2 + std::log2 (eew / sew); +elmul_log2 = lmul_log2 + log2 (eew / sew); if (float_p) return floattype (eew, elmul_log2); -- 2.34.3
Re: [PATCH] RISC-V: fix build issue with gcc 4.9.x
Hi Kito, Le 02/05/2023 à 17:51, Kito Cheng a écrit : >>> Pushed to trunk, thanks for catching that, that's definitely should >>> use log2 no matter C++03 or C++11, >>> but I think GCC allows the usage of C++11 according to >>> https://gcc.gnu.org/install/prerequisites.html :P >> Yes, we should be able to use C++11. I'd like to get that to C++17 at >> some point, but I think the biggest problem is the desire to support >> bootstrapping on something like centos7/rhel7. > > At least we have auto and range based for loop, I am satisfied with > that enough. Indeed, gcc 4.9 already support C++11 but for some reason std::log2 fail with it. Probably because gcc 4.9 is the last gcc release with C++03 used by default. I wasn't able to reproduce the build issue (without my patch) with gcc 10 or 11. I'm fine with new prerequisites for the next gcc release, I checked the release note about that. I noticed that all toolchains I've built with gcc 13.1 for other cpu target where successful with the same setup (docker image). Thanks! Best regards, Romain > > >> >> jeff