Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 843341 - sys-devel/gcc[jit]: build twice to avoid slowdown (with & without --enable-host-shared)
Summary: sys-devel/gcc[jit]: build twice to avoid slowdown (with & without --enable-ho...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-05-08 20:18 UTC by Jasmin Buchert
Modified: 2022-09-27 15:56 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jasmin Buchert 2022-05-08 20:18:21 UTC
Since building sys-devel/gcc with USE=jit will slow down the compiler by a few percent, it's recommended to build GCC twice as described at the following URL:

https://gcc.gnu.org/onlinedocs/gcc-11.2.0/jit/internals/index.html#packaging-notes

This could be made optional with an USE flag as it will double the build time.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-08 20:22:07 UTC
It's been on my mind but I needed a push to do it. Thanks. It should be doable with multibuild.

We can try strip down the PGO build.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-09 00:57:36 UTC
(In reply to Sam James from comment #1)
> We can try strip down the PGO build.

JIT, I meant, obviously.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-27 04:10:56 UTC
I've started hacking something up for this.
Comment 4 Larry the Git Cow gentoo-dev 2022-05-28 23:35:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3910f2d8719d8cb8fbb19572cb524b0472429c81

commit 3910f2d8719d8cb8fbb19572cb524b0472429c81
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-05-27 04:31:52 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-05-28 23:32:15 +0000

    toolchain.eclass: build JIT variant separately to avoid slowdown
    
    It's what GCC upstream recommend to avoid slowing down the main GCC
    binaries which need to be built w/ -fPIC for JIT.
    
    We build twice but do an extremely minimal build for the JIT part
    which is rather quick. Install the JIT version first, then the main GCC
    variant, so the overlapping binaries come from the main build => more featureful,
    correct build options/needed ones for a full GCC build, etc.
    
    Closes: https://bugs.gentoo.org/843341
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/toolchain.eclass | 79 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 65 insertions(+), 14 deletions(-)
Comment 5 Larry the Git Cow gentoo-dev 2022-05-29 00:11:17 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5bed0c77a1c54ac9297db4bb54af2e45c0558ec7

commit 5bed0c77a1c54ac9297db4bb54af2e45c0558ec7
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-05-27 04:31:52 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-05-29 00:11:07 +0000

    toolchain.eclass: build JIT variant separately to avoid slowdown
    
    It's what GCC upstream recommend to avoid slowing down the main GCC
    binaries which need to be built w/ -fPIC for JIT.
    
    We build twice but do an extremely minimal build for the JIT part
    which is rather quick. Install the JIT version first, then the main GCC
    variant, so the overlapping binaries come from the main build => more featureful,
    correct build options/needed ones for a full GCC build, etc.
    
    Closes: https://bugs.gentoo.org/843341
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/toolchain.eclass | 81 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 65 insertions(+), 16 deletions(-)
Comment 6 Larry the Git Cow gentoo-dev 2022-09-27 15:56:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=058b3ccb597a5b9a087cf3262f0a86155b52443e

commit 058b3ccb597a5b9a087cf3262f0a86155b52443e
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-27 15:53:52 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-27 15:53:52 +0000

    sys-devel/gcc: fix obsolete USE=jit warning
    
    There's no slowdown anymore as we built libgccjit separately in toolchain.eclass.
    
    Bug: https://bugs.gentoo.org/843341
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/metadata.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)