How do I learn about what’s being discussed here? Why do I need a linker?
John R. Levine’s book Linkers and Loaders remains the only comprehensive coverage on the topic. You can get the manuscript proofs for free on the author’s website: https://www.iecc.com/linker/ The Solaris Linkers and Libraries docs are very good and mostly relevant to Linux, with fewer distractions about Windows: https://docs.oracle.com/cd/E37838_01/html/E36783/index.html
Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
81–90 of 120 posts
Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#82Earlier quoted context omitted.
Huh? Isn't the output of the linker roughly the same size as the sum of the inputs?
> Huh? Isn't the output of the linker roughly the same size as the sum of the inputs? No. Linkers today even do link-time code generation. Debug info is gargantuan and can be kept as separate files too.
Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#83Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#84Earlier quoted context omitted.
I sort of wish Apple, Amazon, Google, Microsoft and Facebook all contribute $200K each and say hey can you now make Mold MIT or BSD.
$200K is nowadays an annual total compensation of a junior dev. I believe mold values much more than a one year outcome of a typical 5-person junior dev team.
Look at Sidekiq for inspiration on how to charge for open source.
Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#85The Apple linker also seems to have a habit of randomly changing it's mind about certain niggly details about MachO binaries which is extremely irritating as a compiler dev
What’s an example?
Similarly I had to replace how we implement C runtime destructors because Apple deprecated the way to write a destructor in a binary. This wasn't too hard to do, just call atexit from the itanium C++ ABI, but we had basically no warning as far as I'm aware.
Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#86Earlier quoted context omitted.
Note that recent lld is also multithreaded, and with tweaks, can be faster than mold at low core counts: https://bugzilla.mozilla.org/show_bug.cgi?id=1746462#c2
I wouldn't be surprised. In mold, if we have more than one choices to implement a feature, I always take the one that scales well for more cores even if it doesn't perform the best on low-core count machines. My assumption is that future machines will have more cores than we have today on average, so I'm optimizing mold for such computers.
From the manpage of mold-1.3.0, I get the impression mold is designed to scale up to 32 cores, but not more.
man mold | rg -C2 32
--threads
--no-threads
Use multiple threads. By default, mold uses as many threads as the number of cores or 32, whichever is the smallest. The reason why it is capped to 32 is because mold doesn't scale well beyond that point. To use only one thread, pass --no-threads or --thread-count=1.
Is this correct or does the manpage need to be updated?Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#87Apple and Microsoft should really throw some money at Rui; Mold is a massive improvement to developer experience, and the sooner it's ported to their platforms the better. I find myself defaulting to Linux for Rust development these days, mostly because Mold makes the inner loop of development so much faster.
Can you please share the link about how it helps in inner loop? Sorry, I never heard of these tools and google is not returning any useful results
Building the software is divided into two steps; compiling your source files into object files, then linking those object files together into an executable. As a project grows, the time taken by the compile step in this development loop stays roughly constant; if you only change a single source file, only that source file has to be recompiled. However, the link step has to link together all your object files, from scratch, every time, so the time taken by the link step grows roughly linearly as the project size grows.
Since mainstream linkers are fairly slows, an incremental build of huge projects is generally dominated by the link step. I've personally experienced the pain of making a small change to Chromium, waiting a second or so for the source file I changed to be recompiled, then waiting a minute or two for the linker to go through every single object file and produce the final executable. Mold would have reduced the build time in the development loop from minutes to seconds.
I hope that helped.
Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#88Earlier quoted context omitted.
> Huh? Isn't the output of the linker roughly the same size as the sum of the inputs? No. Linkers today even do link-time code generation. Debug info is gargantuan and can be kept as separate files too.
I don't know what code linkers are generating on their own but doesn't it sort of imply that the output is at least as large as the input?
Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#89Re: Mold/macOS is 11 times faster than the Apple's default linker to link Chrome
#90Earlier quoted context omitted.
$200K is nowadays an annual total compensation of a junior dev. I believe mold values much more than a one year outcome of a typical 5-person junior dev team.
> $200K is nowadays an annual total compensation of a junior dev *in the US. In my country, those salaries are completely unheard of.