News for hackers. Stuff that matters.
Re:Firefox nightly is now built with clang LTO on all platforms by tmalsburg2 on Wednesday September 12, 2018 @03:22PM (#17972192)
Some might wonder what LTO and PGO mean (I did). LTO: Link time optimization, PGO: Profile-guided optimization.
Re:Firefox nightly is now built with clang LTO on all platforms by ajross on Wednesday September 12, 2018 @01:46PM (#17971166)
> You might wonder if we tried LTO with GCC, or tried upgrading to GCC 8.x. As a matter of fact, I did. Enabling LTO turned up linker errors

So... they just gave up on gcc, and then per the remainder of the blog post spent "3 months" fighting linker behavior to get LTO working on clang? That seems like a surprising asymmetry, and makes me wonder if the reported performance gains weren't the real reason for the switch.

Re:Firefox nightly is now built with clang LTO on all platforms by cptskippy on Wednesday September 12, 2018 @02:03PM (#17971356)
> Considering the expected future advantages from using clang (cross-language inlining with Rust, consistency between platforms), it seemed a better deal to switch to clang than to try to address those issues.

No, they anticipated switching over to clang in the future so rather than spend "3 months" fighting GCC's linker then do it all over again switching to clang, they just switched.

Re:Firefox nightly is now built with clang LTO on all platforms by topspin on Wednesday September 12, 2018 @03:03PM (#17971982)
> So... they just gave up on gcc, and then per the remainder of the blog post spent "3 months" fighting linker behavior to get LTO working on clang?

Given that they're trying to align their C++ and Rust build tools -- the latter being based on LLVM -- the lack of interest in solving issues experienced with GCC is understandable. Also, given the complexity of the application and the platform diversity involved spending only "3 months" on such troubles is heroic performance.

Re:Firefox nightly is now built with clang LTO on all platforms by sciurus on Wednesday September 12, 2018 @01:55PM (#17971267)
The primary change wasn't away from GCC, it was away from MSVC.

https://groups.google.com/forum/m/#!topic/mozilla.dev.platfo...

Re:Firefox nightly is now built with clang LTO on all platforms by mgbmtl on Wednesday September 12, 2018 @02:00PM (#17971330)
The blog post does also say: "Considering the expected future advantages from using clang (cross-language inlining with Rust, consistency between platforms), it seemed a better deal to switch to clang than to try to address those issues."
Re:Firefox nightly is now built with clang LTO on all platforms by dralley on Wednesday September 12, 2018 @02:00PM (#17971320)
Clang LTO works between Rust and C++ - GCC can't do that.
Re:Firefox nightly is now built with clang LTO on all platforms by steveklabnik on Wednesday September 12, 2018 @04:15PM (#17972760)
will work; it’s in-progress, but not ready for the big times yet, as far as I know https://github.com/rust-lang/rust/issues/49879
Re:Firefox nightly is now built with clang LTO on all platforms by dblohm7 on Wednesday September 12, 2018 @09:55AM (#17968782)
Here is the source blog post (and a better link imho):

https://glandium.org/blog/?p=3888

Re:Firefox nightly is now built with clang LTO on all platforms by sctb on Wednesday September 12, 2018 @12:46PM (#17970614)
Re:Firefox nightly is now built with clang LTO on all platforms by another-cuppa on Wednesday September 12, 2018 @05:30PM (#17973575)
I wonder how this compares to a native GCC build. I always build Firefox myself (as I do with everything) and is always been noticeably faster than the binary. I hope this doesn't mean there will be problems doing GCC builds in the future.
Re:Firefox nightly is now built with clang LTO on all platforms by rebelwebmaster on Wednesday September 12, 2018 @06:17PM (#17973973)
The article mentions that GCC is still remaining a supported compiler and that there are automated builds in their CI to ensure that it stays working.
Re:Firefox nightly is now built with clang LTO on all platforms by 15DCFA8F on Wednesday September 12, 2018 @05:45PM (#17973734)
Just of curiosity, what OS do you run? Why do you build everything from source?
Re:Firefox nightly is now built with clang LTO on all platforms by sekh60 on Wednesday September 12, 2018 @08:22PM (#17974820)
Not OP, but I compile everything other than my Steam games from source - I run Gentoo.
Re:Firefox nightly is now built with clang LTO on all platforms by another-cuppa on Thursday September 13, 2018 @01:33AM (#17976298)
I use Gentoo.
Re:Firefox nightly is now built with clang LTO on all platforms by majewsky on Wednesday September 12, 2018 @06:23PM (#17974018)
Do you do -march=native?
Re:Firefox nightly is now built with clang LTO on all platforms by another-cuppa on Thursday September 13, 2018 @01:35AM (#17976303)
Yep.
Re:Firefox nightly is now built with clang LTO on all platforms by ainar-g on Wednesday September 12, 2018 @01:05PM (#17970834)
When did they switch to Clang? The about:buildconfig of my Developer Edition (Ubuntu) shows GCC 6.4.0, without -flto obviously.

On a related note, I wish they would add the information about the Rust compiler used to compile the components written in Rust.

Re:Firefox nightly is now built with clang LTO on all platforms by spystath on Wednesday September 12, 2018 @01:26PM (#17971012)
Probably this refers only to the pre-compiled builds offered by Mozilla? The distribution packagers build Firefox from source before pushing them to the repository so it would make sense to use the default compiler for the distribution.

On a relevant note, is there any linux distribution that defaults to clang instead of GCC? Up until a couple of years ago the kernel would not even build with clang.

Re:Firefox nightly is now built with clang LTO on all platforms by archi42 on Wednesday September 12, 2018 @04:14PM (#17972749)
IIRC some article claimed OpenSUSE would now use clang with lto. That must have been about a month or two ago.
Re:Firefox nightly is now built with clang LTO on all platforms by swsieber on Wednesday September 12, 2018 @01:46PM (#17971167)
Do you mean which version they use (e.g. 1.28, stable, beta, nightly, etc.)? They have a dedicated page for required versions: https://wiki.mozilla.org/Rust_Update_Policy_for_Firefox

The tables are confusing, but it seems like they require the most recent stable as of 2 weeks before the firefox release.

Re:Firefox nightly is now built with clang LTO on all platforms by abrowne on Wednesday September 12, 2018 @01:48PM (#17971184)
This is for Mozilla's own builds. If you add a .desktop file¹, they work great, and they include a built-in updater (like the updater on Mac or Win).

1: https://blog.nightly.mozilla.org/2018/01/22/335/

Re:Firefox nightly is now built with clang LTO on all platforms by ris on Wednesday September 12, 2018 @03:14PM (#17972094)
> and they include a built-in updater (like the updater on Mac or Win)

Oh joy! Sign me up!

Re:Firefox nightly is now built with clang LTO on all platforms by majewsky on Wednesday September 12, 2018 @06:25PM (#17974040)
I guess having the app update itself may have some appeal for LTS and enterprise distros, where you cannot get the latest-greatest release from the distro vendor. On something like Arch Linux, it's pretty pointless and actually counter-productive: By the time, the package lands in the stable channel of the distro, you know that it works well with all your system libraries because someone tested it.
Re:Firefox nightly is now built with clang LTO on all platforms by cptskippy on Wednesday September 12, 2018 @02:00PM (#17971329)
It's all in the first 3 sentences of the article.

> You might have read that Mozilla recently switched Windows builds to clang-cl... As of next nightly (as of writing, obviously), all tier-1 platforms are now built with clang with LTO enabled.

Re:Firefox nightly is now built with clang LTO on all platforms by ainar-g on Wednesday September 12, 2018 @02:59PM (#17971931)
What I meant is, when did they start the switch, and which versions have already switched.
Re:Firefox nightly is now built with clang LTO on all platforms by dblohm7 on Wednesday September 12, 2018 @03:10PM (#17972053)
Nightly is based off of mozilla-central, our trunk.

When Nightly switches, that means that the version currently being developed (64), is the first version that has been switched.

Re:Firefox nightly is now built with clang LTO on all platforms by rebelwebmaster on Wednesday September 12, 2018 @06:13PM (#17973938)
Fx63 (on Beta and Developer Edition) is on track to ship with clang-cl as the Windows compiler too.
Re:Firefox nightly is now built with clang LTO on all platforms by cptskippy on Wednesday September 12, 2018 @07:30PM (#17974499)
Windows builds were switched to clang back in July before Linux. MacOS was already using it.
Re:Firefox nightly is now built with clang LTO on all platforms by rebelwebmaster on Wednesday September 12, 2018 @06:18PM (#17973982)
Developer Edition builds are based on their current Beta version (Fx63 at this point) and this change just landed on Nightly, which is tracking Fx64.
Re:Firefox nightly is now built with clang LTO on all platforms by anfilt on Wednesday September 12, 2018 @10:12PM (#17975398)
Wait they just gave on GCC's because they could not get linker optimizations working... However, they are surprised Clang with linker optimizations was faster than GCC without...
Re:Firefox nightly is now built with clang LTO on all platforms by glandium on Thursday September 13, 2018 @02:14AM (#17976428)
I failed to mention it originally, but updated the post with this: it's worth noting that comparing GCC+PGO vs. clang+LTO or GCC+PGO vs. clang+PGO was a win for clang overall in both cases, although GCC was winning on a few benchmarks. If I remember correctly, clang without PGO/LTO was also winning against GCC without PGO.
Re:Firefox nightly is now built with clang LTO on all platforms by kasabali on Thursday September 13, 2018 @03:58AM (#17976845)
But that's still with an ancient GCC version compared to a newer Clang, right?
Re:Firefox nightly is now built with clang LTO on all platforms by anfilt on Thursday September 13, 2018 @04:38AM (#17977008)
I would not say ancient, but yea GCC 6 is getting old. I know GCC has had additional optimizations added since then. Although, I am curious how GCC 7+ was breaking binary compatibility? Calling convention, name mangling what?
Re:Firefox nightly is now built with clang LTO on all platforms by glandium on Thursday September 13, 2018 @05:28AM (#17977206)
Using symbols from newer libgcc and libstdc++.
Re:Firefox nightly is now built with clang LTO on all platforms by leeter on Wednesday September 12, 2018 @02:09PM (#17971408)
edit: Removed
Re:Firefox nightly is now built with clang LTO on all platforms by orf on Wednesday September 12, 2018 @02:15PM (#17971477)
Right at the very top of the article:

> This doesn’t mean GCC is being unsupported. As a matter of fact, we still have automated jobs using GCC for some static analysis, and we also have jobs ensuring everything still builds with a baseline of GCC 6.x.

Did you even read it? Also ~10% improvement in speeds is worth switching, IMO.