Created attachment 220350 [details] patch Upstream PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98181 This will be ported to older GCC versions if necessary.
PORTREVISION should be bumped after committing this patch, due to changed CPU tuning.
Piotr, thanks for submitting this upstream, too! I'm ust afraid you missed Andreas T. both there and here, so let me include him on this PR. Andreas is FreeBSD src committer and upstream maintainer for FreeBSD in GCC, so can approve most of your changes. The sequence of events how it usually should go: 1. Upstream HEAD (that will become GCC 11) 2. lang/gcc11-devel picks that up within days 3. Backport to upstream GCC 10 branch 4. lang/gcc10-devel picks that up within days 5. Backport to lang/gcc10 6. Obsolete local patches as the next GCC 10 release comes out (Steps 2 and 3 can take place in parallel.) Let's try not to skip too many of the steps 2-4 (or 1-4). ;-) It really is the safer, future proof, and in the end easier way.
OK then, I will like it will take a long time (we still have to upstream the binutils patch) :/
If Andreas has the time (and there is no utter disagreement on the general technical approach), we could get this done before Christmas! One question: Do I understand correctly that the change of default processor (PROCESSOR_DEFAULT) is orthogonal, and we could (and from a commit perspective likely should) make that independently?
(In reply to Gerald Pfeifer from comment #4) Yes, the PROCESSOR_DEFAULT change is completely irrelevant to powerpc64le support. This is simply something I noticed when adding powerpc64le support and IMO this change should be backported to older branches even when you don't add powerpc64le support for performance reasons.
(In reply to Gerald Pfeifer from comment #4) Am I supposed to send the patch myself to gcc-patches? I'm afraid I might do something wrong, I haven't upstreamed any patches to GCC yet.
I will somehow find time to start with PROCESSOR_DEFAULT change myself, which I should be able to get in without problems. Is the libcpp change essentially independent? If so, let's use that as a first step? https://gcc.gnu.org/contribute.html#patches has details, and if you'd like to share a draft submission with my first, I'll be happy to provide feedback and make recommendations (on who to copy, etc). Of course if Andreas is able to help, that'd be even better!
libcpp change is a backport of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=d00b1b023ecfc3ddc3fe952c0063dab7529d5f7a which is a patch for my bug report. It fixes compilation when optimizing for POWER8 or newer. So this patch fixes build on powerpc64 with e.g. CPUTYPE?=power9 set. This also fixes build with powerpc64le, which uses POWER8 as a baseline.
(In reply to Piotr Kubaj from comment #8) > libcpp change is a backport of ... Ah, lovely. This would have been useful to mention earlier. ;-) I checked out the GCC 10 branch and noticed this is already there, so lang/gcc10-devel has it already and the next minor release of GCC 10 will bring this to lang/gcc10. Do you want to go ahead and commit the libcpp patch to lang/gcc10, mentioning the above? Approved by: gerald (maintainer)
A commit references this bug: Author: pkubaj Date: Sat Dec 12 16:11:28 UTC 2020 New revision: 557833 URL: https://svnweb.freebsd.org/changeset/ports/557833 Log: lang/gcc10: fix build on powerpc64 with CPUTYPE=power8 or power9, also a partial fix for powerpc64le Backport of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=d00b1b023ecfc3ddc3fe952c0063dab7529d5f7a PR: 251670 Approved by: gerald (maintainer) Changes: head/lang/gcc10/files/patch-libcpp_lex.c
I just submitted the processor default patch upstream (and can/will commit there once approved). Us having stripped off and taken care of those two separate issues, can you submit the remainder upstream? (You can follow the pattern of my submission just now.)
Okay, looks like we got everything into upstream (head), Piotr? For lang/gcc11-devel, is there anything to be done except for adding powerpc64le to ONLY_FOR_ARCHS with the next snapshot? (See, I told you we can do get this before Christmas. ;-)
(In reply to Gerald Pfeifer from comment #12) Well, there is still namespace collision regarding vec_step (same as on powerpc64). It was already reported to upstream about a year ago, but they still didn't patch it.
Update: We cannot use yesterday's snapshot for lang/gcc11-devel since it's broken on FreeBSD in at least two different ways. I submitted a patch for the first and reported the second. With a bit of luck things will be resolved next Sunday. Independently. we can request backport to the GCC 10 branch in the coming days, which will cover lang/gcc10-devel. Once it landed there, I pre-approve you back porting to lang/gcc10 itself - just go for it, I'd only appreciate if you can put everything into one patch file, files/patch-powerpcle or the like.
If the default GCC is not changed to 10 by then, can I also backport this patch to 9, or do I need to make upstream backport to 9 branch as well?
A commit references this bug: Author: gerald Date: Mon Dec 28 10:18:04 UTC 2020 New revision: 559455 URL: https://svnweb.freebsd.org/changeset/ports/559455 Log: Update to the 20201226 snapshot of GCC 10.2.1. This brings a backport for the RTL optimizers, two for the x86 back end, two for the C++ front end, and one for Fortran. It also changes the processor defaults for 32- und 64-bit powerpc to PPC7450 and POWER8, respectively, per a request by pkubaj@ that I pushed upstream. [1] PR: 251670 [1] Changes: head/lang/gcc10-devel/Makefile head/lang/gcc10-devel/distinfo
(In reply to commit-hook from comment #16) So, which does "processor defaults" control? . . . A) just the default -mtune= for the likes of -cpu=powerpc64 or -mcpu=powerpc ? (just scheduling, not which instructions/registers are allowed?) B) the architecture type and/or register usage presumed/mimimum --unless -mcpu= is used to pick something specific, such as -mcpu=G5 ? C) something other combination of things? I'm guessing (A).
(In reply to Mark Millard from comment #17) This only specifies default -mtune, not -mcpu. So it won't require you to use POWER8 by default. Linux does just the same (apart from defaulting to POWER7 on 32 bits) and it runs on G5 just fine.
A commit references this bug: Author: gerald Date: Tue Dec 29 11:10:38 UTC 2020 New revision: 559562 URL: https://svnweb.freebsd.org/changeset/ports/559562 Log: Update to the 20201227 snapshot of GCC 11.0.0. This changes the processor defaults for 32- und 64-bit powerpc to PPC7450 and POWER8, respectively, per a request by pkubaj@ that I pushed upstream. [1] Enable the new powerpcle architecture which this snapshot brings in via upstream, per a submission by pkubaj@. [1] The 20201227 snapshot was broken on FreeBSD (and presumably other non-mainstream platforms), so we had to skip it. PR: 251670 [1] Changes: head/lang/gcc11-devel/Makefile head/lang/gcc11-devel/distinfo
Next steps: 1. With the next snapshot of GCC 10 development and the lang/gcc10-devel update coming with it, I'll enable powerpc64le there. 2. You updating lang/gcc10 accordingly (ideally with just one patch file, files/patch-powerpcle or the like), is pre-approved. If you want to set DEFAULT_GCC=10 for powerpc64le in Mk/bsd.default-versions.mk that is pre-approved as well. 3. linimon@ has heroically helped readying the tree for updating GCC_DEFAULT to 10, which hopefully will land in the next week or two. Should this take longer than a few weeks, we can replay steps 1 and 2 for GCC 9, though at this point fully focusing our time and energy on GCC 10 is my strong preference and recommendation.
(In reply to Gerald Pfeifer from comment #20) Regarding gcc9: powerpc64le support has already been merged to 9 branch, so next gcc9-devel snapshot should enable powerpc64le as well.
A commit references this bug: Author: pkubaj Date: Wed Dec 30 03:11:15 UTC 2020 New revision: 559636 URL: https://svnweb.freebsd.org/changeset/ports/559636 Log: lang/gcc10: add support for powerpc64le PR: 251670 Approved by: gerald@ (maintainer) Changes: head/lang/gcc10/Makefile head/lang/gcc10/files/patch-powerpc64le
A commit references this bug: Author: pkubaj Date: Wed Dec 30 03:12:58 UTC 2020 New revision: 559637 URL: https://svnweb.freebsd.org/changeset/ports/559637 Log: Switch default GCC for powerpc64le to 10. 9 does not yet work and the switch to 10 is near. PR: 251670 Approved by: gerald@ (maintainer) Changes: head/Mk/bsd.default-versions.mk
Thanks, committed!
A commit references this bug: Author: gerald Date: Wed Jan 6 12:56:07 UTC 2021 New revision: 560506 URL: https://svnweb.freebsd.org/changeset/ports/560506 Log: Update to the 20210102 snapshot of GCC 10.2.1. This brings two backports for the aarch64 backend and one for x86, plus three for the Fortran front end. Enable the new powerpcle architecture which this snapshot brings in via upstream, per a submission by pkubaj@. [1] This also should fix the build on aarch64 when clang is the bootstrap compiler. [2] PR: 251670 [1], 250932 [2] Changes: head/lang/gcc10-devel/Makefile head/lang/gcc10-devel/distinfo