Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toolchain.eclass: rework bootstrapping logic #33114

Closed
wants to merge 3 commits into from

Conversation

thesamesam
Copy link
Member

@thesamesam thesamesam commented Sep 28, 2023

toolchain.eclass: rework bootstrapping logic

  • Build stage1 compiler with user's CFLAGS. This consistently ends up
    saving at least 15 minutes for me on a fast amd64 machine and should save
    more on slower machines and architectures.

    There's only any risk here if the host compiler is ancient/very buggy and
    even then, you get a failed bootstrap later on. The GCC developers, per the
    linked bug, end up using STAGE1_CFLAGS="-O2" anyway to speed up the process
    so it's not like this is untested at all.

    mattst88 actually brought this up.. 10 years ago (bug #477548). Let's try
    make that right now.

  • Respect LDFLAGS for target libraries for native builds. Not touching this
    for cross builds, at least for now, as it's a bit more delicate.

    (Unfortunately, we have to put a hack in here for now until we can fix
    multilib.eclass - see bug #914881).

Bug: https://gcc.gnu.org/PR111619
Bug: https://bugs.gentoo.org/914881
Closes: https://bugs.gentoo.org/477548
Closes: https://bugs.gentoo.org/831423
Closes: https://bugs.gentoo.org/840392
Apologies-to: Matt Turner mattst88@gentoo.org
Signed-off-by: Sam James sam@gentoo.org

@gentoo-bot
Copy link

Pull Request assignment

Submitter: @thesamesam
Areas affected: eclasses
Packages affected: (none)

@gentoo/github

Linked bugs

Bugs linked: 840392, 914881, 477548, 831423

New packages

This Pull Request appears to be introducing new packages only. Due to limited manpower, adding new packages is considered low priority. This does not mean that your Pull Request will not receive any attention, however, it might take quite some time for it to be reviewed. In the meantime, your new ebuild might find a home in the GURU project repository: the ebuild repository maintained collaboratively by Gentoo users. GURU offers your ebuild a place to be reviewed and improved by other Gentoo users, while making it easy for Gentoo users to install it and enjoy the software it adds.


In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

Docs: Code of ConductCopyright policy (expl.) ● DevmanualGitHub PRsProxy-maint guide

@gentoo-bot gentoo-bot added need assignment It was impossible to assign the PR correctly. Please assign it manually. bug linked Bug/Closes found in footer, and cross-linked with the PR. labels Sep 28, 2023
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-09-28 23:55 UTC
Newest commit scanned: 67d0793
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/39ac83b329/output.html

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-09-29 00:10 UTC
Newest commit scanned: d33fc32
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/7858f31d7f/output.html

* Build stage1 compiler with user's CFLAGS. This consistently ends up
  saving at least 15 minutes for me on a fast amd64 machine and should save
  more on slower machines and architectures.

  There's only any risk here if the host compiler is ancient/very buggy and
  even then, you get a failed bootstrap later on. The GCC developers, per the
  linked bug, end up using STAGE1_CFLAGS="-O2" anyway to speed up the process
  so it's not like this is untested at all.

  mattst88 actually brought this up.. 10 years ago (bug #477548). Let's try
  make that right now.

* Respect LDFLAGS for target libraries for native builds. Not touching this
  for cross builds, at least for now, as it's a bit more delicate.

  (Unfortunately, we have to put a hack in here for now until we can fix
  multilib.eclass - see bug #914881).

Bug: https://gcc.gnu.org/PR111619
Bug: https://bugs.gentoo.org/914881
Closes: https://bugs.gentoo.org/477548
Closes: https://bugs.gentoo.org/831423
Closes: https://bugs.gentoo.org/840392
Apologies-to: Matt Turner <mattst88@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
Upstream are fine with bootstrapping with -O3, so don't strip it out if the user
set it, even with USE=-custom-cflags.

Signed-off-by: Sam James <sam@gentoo.org>
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-09-29 00:55 UTC
Newest commit scanned: 5ef0fe6
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/3ff135cd7b/output.html

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-09-29 01:10 UTC
Newest commit scanned: 1ce9d74
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/c6dd565d23/output.html

* Pass --disable-fixincludes for newer GCCs for USE=jit (still need to try
disable it in general when we can, but we had to turn it on for a bit because
of newer glibc) as it's pointless there.

* Disable a bunch of other options for the JIT build, imported from my local
  script for bisecting GCC.

* While at it, use an array for the configure args for the JIT build and just
use emake -C.

Signed-off-by: Sam James <sam@gentoo.org>
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-09-29 01:50 UTC
Newest commit scanned: 4b5a1ba
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/f6844d6b73/output.html

@thesamesam thesamesam marked this pull request as ready for review September 30, 2023 09:01
Copy link
Member

@ArsenArsen ArsenArsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems sane

eclass/toolchain.eclass Show resolved Hide resolved
@thesamesam
Copy link
Member Author

Merged

@thesamesam thesamesam closed this Sep 30, 2023
@thesamesam thesamesam deleted the toolchain-eclass branch September 30, 2023 09:39
@andreili
Copy link

andreili commented Oct 8, 2023

@thesamesam
Hi.
With this PR I can't compile GCC with 'COMMON_FLAGS="-O3 -pipe -march=native"' - fails on bootstrap stage, stages 2 and 3 misscompared... With "-O2" optimization flag - all ok.
"emerge --info" output: https://pastebin.com/Pfm1eMj6

@thesamesam
Copy link
Member Author

@thesamesam Hi. With this PR I can't compile GCC with 'COMMON_FLAGS="-O3 -pipe -march=native"' - fails on bootstrap stage, stages 2 and 3 misscompared... With "-O2" optimization flag - all ok. "emerge --info" output: https://pastebin.com/Pfm1eMj6

Could you file a Gentoo bug please with emerge --info and the gcc build log tarball the ebuuld creates? Thanks.

@andreili
Copy link

andreili commented Oct 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug linked Bug/Closes found in footer, and cross-linked with the PR. need assignment It was impossible to assign the PR correctly. Please assign it manually.
Projects
None yet
5 participants