Mold (linker) 1.0 released
mold 1.0 is the first stable and production-ready release of the high-speed linker. On Linux-based systems, it should "just work" as a faster drop-in replacement for the default GNU linker for most user-land programs. If you are building a large executable which takes a long time to link, mold is worth a try to see if it can shorten your build time.
Posted Dec 15, 2021 18:16 UTC (Wed)
by donbarry (guest, #10485)
[Link] (10 responses)
The Github LICENSE page explains why -- it's not out of a love for free software:
"I'm looking for a sponsor who wants to purchase the copyright of this work and relicense it under a more liberal license such as the MIT license. For now, mold is released under the GNU AGPL v3."
Posted Dec 15, 2021 18:40 UTC (Wed)
by yodermk (subscriber, #3803)
[Link] (7 responses)
Posted Dec 15, 2021 19:20 UTC (Wed)
by donbarry (guest, #10485)
[Link] (4 responses)
Not exactly in line with the whole ethic of the license itself.
Posted Dec 15, 2021 19:32 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
Posted Dec 15, 2021 20:58 UTC (Wed)
by atai (subscriber, #10977)
[Link]
Posted Dec 15, 2021 19:40 UTC (Wed)
by NYKevin (subscriber, #129325)
[Link]
* I am rather skeptical that this is how the FSF feels, however, because RMS endorsed the practice of selling exceptions to the GPL all the way back in 2010: https://www.fsf.org/blogs/rms/selling-exceptions. So it may simply be that they do not agree with you, and would see nothing wrong with this practice anyway.
Posted Dec 15, 2021 20:16 UTC (Wed)
by rvolgers (guest, #63218)
[Link]
If anything, this is more public-spirited than that approach.
People like the GPL because it enforces giving more rights to users. But that also means people and companies may not like the GPL because it leaves fewer exclusive rights for them to sell for money.
There is nothing wrong with recognizing there are potential downsides to the GPL and that companies are willing to pay to avoid them.
Posted Dec 15, 2021 21:03 UTC (Wed)
by atai (subscriber, #10977)
[Link]
Posted Dec 21, 2021 17:35 UTC (Tue)
by fw (subscriber, #26023)
[Link]
Posted Dec 16, 2021 22:44 UTC (Thu)
by jengelh (guest, #33263)
[Link] (1 responses)
Until someone turns the game around and buys the copyright (just) to keep it under AGPL.
Posted Dec 17, 2021 7:32 UTC (Fri)
by pabs (subscriber, #43278)
[Link]
Posted Dec 15, 2021 20:20 UTC (Wed)
by cyperpunks (subscriber, #39406)
[Link] (1 responses)
Posted Dec 15, 2021 20:34 UTC (Wed)
by jhoblitt (subscriber, #77733)
[Link]
I have never used mold and can't attest to its performance.
Posted Dec 15, 2021 21:10 UTC (Wed)
by syrjala (subscriber, #47399)
[Link] (3 responses)
Posted Dec 15, 2021 22:03 UTC (Wed)
by atai (subscriber, #10977)
[Link]
Posted Dec 16, 2021 6:57 UTC (Thu)
by LtWorf (subscriber, #124958)
[Link] (1 responses)
Posted Dec 21, 2021 0:21 UTC (Tue)
by flussence (guest, #85566)
[Link]
And above all, we're talking about it in past tense because it's another abandonware Google product. Not a good look for an essential toolchain component.
Posted Dec 15, 2021 21:11 UTC (Wed)
by ballombe (subscriber, #9523)
[Link] (6 responses)
Posted Dec 15, 2021 21:59 UTC (Wed)
by Vipketsh (guest, #134480)
[Link] (5 responses)
Posted Dec 16, 2021 14:08 UTC (Thu)
by ldearquer (guest, #137451)
[Link] (4 responses)
Posted Dec 16, 2021 14:23 UTC (Thu)
by Vipketsh (guest, #134480)
[Link] (3 responses)
In the BFD linker this magic occurs with a plugin to the linker to find the LTO data, call the compiler and assemble the results.
Posted Dec 16, 2021 19:44 UTC (Thu)
by JoeBuck (subscriber, #2330)
[Link]
Posted Dec 17, 2021 10:11 UTC (Fri)
by ldearquer (guest, #137451)
[Link] (1 responses)
Posted Dec 17, 2021 11:26 UTC (Fri)
by Vipketsh (guest, #134480)
[Link]
The gcc manual has a decent explanation to start from: https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Optimize-Op...
Posted Dec 15, 2021 21:18 UTC (Wed)
by Karellen (subscriber, #67644)
[Link] (3 responses)
From the README.md: For some reason, I thought that setting the "LD" environment variable would work for most GNU build tools. But checking the GNU make Implicit Variables documentation, although there exists CC & CCFLAGS, and CXX & CXXFLAGS, and similar (but not always exact) snowclones of tool & toolFLAGS variables for AR, AS, CPP, FC, CO, LEX, YACC, PC and LINT, and there is an LDFLAGS, there is no LD equivalent! What a bizarre inconsistency.
Posted Dec 15, 2021 21:31 UTC (Wed)
by Bigos (subscriber, #96807)
[Link] (1 responses)
And these frontends had to learn alternate linkers on their own using command line parameters. This is how -fuse-ld=$LINKER came to be. Unfortunately, for whatever reason (various linkers not being completely compatible?), the $LINKER parameter, at least for gcc, is restricted to a list of linkers, mold not being one of them. Also note that $LINKER is not the executable name, it is ld.$LINKER instead (like ld.gold).
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Link-Option...
Posted Dec 16, 2021 14:44 UTC (Thu)
by jrtc27 (subscriber, #107748)
[Link]
Posted Dec 15, 2021 22:12 UTC (Wed)
by madscientist (subscriber, #16861)
[Link]
The contents of the manual are the MINIMUM set of variables that are assigned. The docs make this pretty clear where it says: Here is a table of some of the more common variables. If you want to know the full set of default variables you can ask make to show them to you: As already mentioned, though, it's very rare that anyone actually uses ld directly. These days, unless you're trying to create a bare executable, you pretty much have to use the compiler's front end because it will add important linker options and internal (but critically important) libraries. Indeed, most of make's built-in rules don't use $(LD) they use $(CC) (or the equivalent for other languages).
Posted Dec 15, 2021 21:57 UTC (Wed)
by Vipketsh (guest, #134480)
[Link] (5 responses)
So, programs these days weigh in at multiple gigabytes. Anyone know what the breakdown of those gigabytes are ? Surely it is not all machine code...
Posted Dec 15, 2021 22:50 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
Posted Dec 17, 2021 22:15 UTC (Fri)
by bartoc (guest, #124262)
[Link]
Still, its easy (at least in c++) to write templates that spew out a ton of nearly identical code where a C programmer would have just used some form of virtual dispatch. You can get template spew without even changing the types on the template instantiation too, which is fun.
Posted Dec 16, 2021 0:27 UTC (Thu)
by rillian (subscriber, #11344)
[Link] (2 responses)
These are also huge programs. According to tokei on today's main branches:
firefox 37M lines of code (3M C, 6M C++, 4M headers, 8M Javascript, 3M Rust)
Browsers are effectively an entire userspace unto themselves, so it's not surprising builds are the same size as a minimal desktop image.
Otherwise, what mathstuf said. Link times on large C++ applications can be a real bottleneck, especially for incremental development. Linux has the advantage of being in C, and more modular.
Posted Dec 16, 2021 12:47 UTC (Thu)
by cesarb (subscriber, #6266)
[Link] (1 responses)
Linux also heavily uses partial linking (ld -r), which allows a large part of the linking step to run incrementally and/or in parallel. That does not seem to be usual for other large C or C++ projects I've seen.
Posted Dec 16, 2021 14:28 UTC (Thu)
by Vipketsh (guest, #134480)
[Link]
Even with 'ld -r' the symbol lookup does not get eliminated during the final link which is, according to the documentation here, one of the slowest part of linking, so I doubt that using 'ld -r' has a meaningful impact on linking speed.
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
It's not like anyone is interacting with a linker over a network.
Anyone using some sort of build daemon to build C/C++ software is doing that. But as usual with the AGPL, it's a very complicated question whether that triggers any of the additional requirements over the GPL.
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Now that would be something!
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Therefore if you don't pass the lto flag to the compiler stage, you don't get real LTO? Because it would write normal output object.
I need to go and read more about this, cause so far I always assumed that you just compile all .o files normally and then simply pass the -flto flag to the linker (GCC) :(
Mold (linker) 1.0 released
Mold (linker) 1.0 released
It is sometimes very hard to pass an appropriate command line option to cc to specify an alternative linker. [...]
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
$ make -pf/dev/null | grep ^LD
make: *** No targets. Stop.
LD = ld
Mold (linker) 1.0 released
Program (linker output size)
Chrome 96 (1.89 GiB)
Clang 13 (3.18 GiB)
Firefox 89 libxul (1.64 GiB)
Mold (linker) 1.0 released
Mold (linker) 1.0 released
Mold (linker) 1.0 released
chromium 36M lines (14M C++, 5M headers, 4M Javascript)
linux 32M lines (21M C, 7M headers)
Mold (linker) 1.0 released
Mold (linker) 1.0 released
