-
Notifications
You must be signed in to change notification settings - Fork 96
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
Is it normal for GCC 9.1 to be build with stripped flags? #297
Comments
Yup, it is normal. It's |
GCC doesn't need the override. The trick is to use an env file, here's my gcc.conf. The EXTRA_ECONF configures gcc to build with lto, and BOOT_CFLAGS which isn't stripped by the gentoo ebuild tells it to bootstrap with those flags (the definitions of OPT etc are in my make.conf but you get the idea). Put this file in /etc/portage/env, and add a file in /etc/portage/package.env with "sys-devel/gcc gcc.conf" to use it. |
@nivedita76 you don't have to mention it in packag.env, just put them in /etc/portage/env/sys-devel/gcc and emerge will pick it up |
My real config has it only applied for >gcc-8 (so I have a "stable" compiler version to fall back on just in case). Would it pick it up if I did env/sys-devel/gcc-9, or does it have to be the full version number then? |
@nivedita76 Thank you! I just tested it and it seems to be working! I'll look into adding a |
PR created upstream: gentoo/gentoo#11943 |
Thanks! They are used to build the compiler itself but not the startup libraries (libgcc etc) I think. |
@nivedita76 thank you for the helpful tip. Do you happen to have any resources on the differences between BOOT_CFLAGS and CFLAGS? |
BOOT_CFLAGS are what are used for building stage2/stage3 compilers, i.e. what eventually gets installed. I'm actually not 100% sure whether CFLAGS gets included in that by default or it only uses it for stage1 or something. There's some info in the Building section here but it doesn't mention what happens to regular CFLAGS. It does suggest a way of passing custom CFLAGS to the libgcc etc as well (CFLAGS_FOR_TARGET) |
@nivedita76 correct me if I'm wrong but isn't using EXTRA_ECONF='--with-build-config=bootstrap-lto' preventing PGO build? which uses profiledbootstrap? |
Nope. The make target is profiledbootstrap which is what makes it use pgo. |
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=config/bootstrap-lto.mk;hb=HEAD The configure argument basically adds these into the Makefile. Looking at the snippet I'm actually surprised that lto build works without using this as well.. the -frandom-seed argument says: I would have thought not having that would mess up the build's test -- it checks that it can compile itself reproducibly to make sure you don't end up with a horribly broken compiler. |
Hm I think it doesn't do the comparisons if it's doing a pgo build rather than a regular one. |
@nivedita76 Thanks! I stand corrected |
Upstream bug is here: https://bugs.gentoo.org/685634 Quote:
From: https://www.mail-archive.com/[email protected]/msg210066.html It appears that this is the intended way to build GCC with LTO and PGO. You use the build config option at configure time and then |
Patch was accepted upstream! |
Reference #297 Signed-off-by: Shane Peelar <[email protected]>
Now that we can use both LTO and PGO in conjunction, I'd like to also support users injecting their |
@InBetweenNames If you use pgo no comparison is done. |
I added this to package.cflags/gcc |
Are you sure no comparison is done? I checked the https://github.com/gcc-mirror/gcc/blob/master/config/bootstrap-lto.mk
It seems it compares two stages at least. Does PGO skip over |
Yes it will compare if you do only lto, but pgo bootstrap has no compare targets. It already builds 4 stages I guess they felt building a 5th for the comparison was just too much. |
I patched it to add one and with my options it does checkout fwiw. |
Excellent! Do you think we should integrate your patch here? It might ease some users minds about applying LTO + PGO + |
Attaching the current state. This will actually do a 6-stage bootstrap. It uses the profile from the stage built using profile-use (normally the last stage) to do another build, idea was to collect better profiling information about the passes that only get enabled with profile-use. It then does a compare of that final product, so 6 stages total. I've tested with bootstrap-lto though not with the -lean variant. |
@nivedita76 one more question -- I notice you use |
@InBetweenNames I have that in my make.conf. The bashrc-mv overlay appends those to CFLAGS. So what I did was have CFLAGS be safe defaults and set all the extra flags in OPTCFLAGS. This is what the flags section of my make.conf looks like. (note some of the stuff is unused)
|
I was able to edit the GCC ebuild and push in my own flags, which BOOT_CFLAGS inherited (if only I knew). The difference though is that my compile time was cut in half (?!). I'm willing to bet you can add
The -flto patch now automatically detects the number of CPUs I have so I no longer need to define a number. This was backported from GCC 10 and is right here. All that needs fixing is the Changelog. The ebuild to use custom flags:
emerge --info gcc
I generally use |
|
About |
|
Note: The only benefit that the GCC 10 |
Something I've noticed with compiling 9.1.0 vs <= 8.3.0 is that it is compiled with these flags:
This is in the initial log when emerging:
And these are my USE flags:
This is not true for other packages, and was not fixed with a recompile and exporting defined flags from make.conf. Is this expected behavior?
The text was updated successfully, but these errors were encountered: