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

Firefox ESR78 subtly breaks with -O3 #650

Closed
mid-kid opened this issue Nov 17, 2020 · 9 comments
Closed

Firefox ESR78 subtly breaks with -O3 #650

mid-kid opened this issue Nov 17, 2020 · 9 comments

Comments

@mid-kid
Copy link

mid-kid commented Nov 17, 2020

I've had to add this:

www-client/firefox /-O3/-O2

To my package.cflags, or else violentmonkey wouldn't work.
It broke with something about being unable to open the addon's local storage due to internal errors. You can see errors pop up in about:debugging after installing violentmonkey.

EDIT: This is with GCC 10, I haven't attempted -O3 builds with Clang. Don't really want to, either.

@gottaeat
Copy link

gottaeat commented Dec 3, 2020

i'm not on gentoo but i have this exact same problem. when i build firefox using gcc 10.2.0 and -O3 or -O2 + -flto, violentmonkey userscripts simply disappear after a reboot of the browser.

same problem does not exist on a completely standalone nognu llvm 11.0.0, building with crosslto (thinlto) + O3 and polly does not break anything.

@mid-kid
Copy link
Author

mid-kid commented Dec 3, 2020

Apparently, if firefox is USE=pgo/MOZ_PGO=1, it will force adding -O3 to the CXXFLAGS. This breaks the browser in much the same way.
To fix this, I had to create /etc/portage/bashrc.d/49-firefox-pgo-fix.sh:

FirefoxPgoFix() {
	if [ "$CATEGORY/$PN" = 'www-client/firefox' ]; then
		cd "$S"
		sed -i -e '/MOZ_PGO_OPTIMIZE_FLAGS=/d' \
			old-configure old-configure.in \
			js/src/old-configure js/src/old-configure.in
	fi
}

BashrcdPhase configure FirefoxPgoFix

(This will cause python/mozbuild/mozbuild/frontend/context.py to pick up MOZ_OPTIMIZE_FLAGS correctly, instead of the pgo one)

Update: Even with -O2 with this doesn't work anymore...

@mid-kid
Copy link
Author

mid-kid commented Dec 3, 2020

@mssx86 Are you sure this issue doesn't happen without -flto? Last I tried I think it still did, but I'd like to save myself a couple of hours in rebuilding the browser again...

@gottaeat
Copy link

gottaeat commented Dec 3, 2020

@mssx86 Are you sure this issue doesn't happen without -flto? Last I tried I think it still did, but I'd like to save myself a couple of hours in rebuilding the browser again...

yes, userscripts break with just -O3 when built with gcc, just like how it does with -O2 -flto.

@mid-kid
Copy link
Author

mid-kid commented Dec 3, 2020

Gotcha, I guess I've hit this bug now, too. I'll report it to Gentoo upstream since USE=lto is upstream, maybe they know where to forward it to. I believe this can be fixed by Firefox upstream.

@mid-kid
Copy link
Author

mid-kid commented Dec 4, 2020

Created Gentoo bug: https://bugs.gentoo.org/758446

Posting error message image here for reference, this is the error that a bunch of addons are getting:

Also want to add, that playing .mp3 files in the browser, or using google's audio captcha results in choppy audio. I'm using USE=pulseaudio, -lto and -pgo with '-O2' in CFLAGS, and I'm not sure if the issue is firefox itself or a different package, or if these issues are even related. Will investigate this as well when I have time...

Update: Rebuilding with USE=clang, otherwise keeping the same settings fixes the audio issue as well, so I'm sure it's related...

@gottaeat
Copy link

your bug report caused the mozilla team at gentoo to set all firefox ebuild's to be built with clang only. let's hope something comes out of it.

@mid-kid
Copy link
Author

mid-kid commented Dec 15, 2020

That's mildly annoying (especially for the many people still using GCC 9 that are unaffected by this) but having it be confirmed on the latest release is reassuring it'll get a fix.
And hey, it's been reported to upstream now: https://bugzilla.mozilla.org/show_bug.cgi?id=1682191

@mid-kid
Copy link
Author

mid-kid commented Dec 22, 2020

This bug has been worked around in gentoo by disabling -ftree-loop-vectorize: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09886ee677ea97b80f1469dc7534ff6aea6247cb

You can re-emerge firefox to have this fixed, now. Figuring out the specifics of this bug to provide a proper resolution is out of the scope of this issue, and there's upstream bug reports for that, so I'm closing it.

@mid-kid mid-kid closed this as completed Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants