| ▲ | lrvick 2 hours ago |
| The linux distribution I co-maintain uses mold as our bootstrap linker to bootstrap rust itself, and it saved us -hours- on long version-by-version build chains. Mold being in c meant we could build it very early and use it as the default linker distro wide and enjoy build speedups everywhere. Now sadly we will have to fork and maintain the c version as mold2 forever. Rust is not actually the right tool for all problems. |
|
| ▲ | karavelov 2 hours ago | parent | next [-] |
| Why not use LLD for linking Rust? You already must have the LLVM for Rust to be buildable, so that do not add any dependency. |
| |
| ▲ | n8henrie an hour ago | parent | next [-] | | Agreed -- not my wheelhouse, but couldn't you just build rust earlier in your process using LLD, then build mold, then build everything else? Would that meant that building rust is slower, but everything else is the same, and you don't have to maintain a fork of another complex project? | |
| ▲ | as-182 2 hours ago | parent | prev [-] | | Because mold is faster. Linking is a significant bottleneck when building large projects. | | |
|
|
| ▲ | MayeulC an hour ago | parent | prev | next [-] |
| I have been thinking about Rust bootstrapping recently. Couldn't a Rust compiler without borrow checker be put together relatively easily? Assuming the source code contains no issues (which can be checked later once the Rust compiler is built), one could leave that piece behind, and take the shortest path from .rs to executed code (C transpilation, or even an interpreter). |
| |
|
| ▲ | Orphis an hour ago | parent | prev | next [-] |
| It seems like you would benefit from having reproducible and hermetic builds with a good caching layer so you don't do the same work again and again. Then you can just use the latest built version to build mold and the next version of rust. |
|
| ▲ | KolmogorovComp 10 minutes ago | parent | prev | next [-] |
| how's bootstrapping rust story nowadays? |
|
| ▲ | nicce 2 hours ago | parent | prev | next [-] |
| If the need is well justified, maybe there is great chance to ask adding #[no_mangle] and extern C support? Since release is very fresh. If that is causing the problem. Or is some dependency the issue? |
| |
| ▲ | afdbcreid 33 minutes ago | parent [-] | | The need here is bootstrapping. If mold is written in Rust you cannot even compile it. | | |
| ▲ | nicce 22 minutes ago | parent [-] | | Even Rust is written with Rust. But yeah, if you want to bootstrap absolutely from the beginning, I see the issue. |
|
|
|
| ▲ | mohamedkoubaa 30 minutes ago | parent | prev | next [-] |
| Have you considered using Eurydice? |
|
| ▲ | duped 31 minutes ago | parent | prev | next [-] |
| Why do you need to bootstrap a toolchain to bootstrap a distro? I know this is common but it seems like either an aesthetic decision, or glibc cruft. |
| |
| ▲ | imoverclocked 12 minutes ago | parent [-] | | There are classes of virus that are hard to detect. One is a compiler virus that passes itself from compiler to compiler. You only get rid of the vector by bootstrapping from 0. |
|
|
| ▲ | ChickeNES 19 minutes ago | parent | prev | next [-] |
| Luckily Mr Clanker can do most of the work for you at least (I myself have already had Claude/Codex rewrite a couple of Rust projects in C, worked great) |
|
| ▲ | someonebaggy 2 hours ago | parent | prev | next [-] |
| This comment was automatically deleted due to reaching 10 downvotes. |
| |
| ▲ | Imustaskforhelp 2 hours ago | parent [-] | | I do understand what you are trying to say, but I think that this fails to be kind to Irvick and the other maintainers of the stage0 project who are actually being quite underfunded (someone like OAI should fund them in the name of security!) So asking them to pay money is well.. not quite the solution. What can happen as it often happens, is this, Mold creator created the project, Stage0 found it useful, Mold ports itself to rust, Stage0 now founds it not useful, Stage0 can comment on the new update and be slightly disappointed and comment how they would've preferred to not rust in this particular case for them. Yes this doesn't prevent mold from changing to rust or anything as it was shown but I guess we can allow the ability for Irvick to drop a comment I guess without saying that's your responsibility while they are just being maintainers of the open source and an underfunded/mostly volunteer one of work at that. Also, @Irvick, stage0 is extremely cool, I hope that a lot more companies sponsor the work that stage0 contributors are doing. I think that it can help the supply-chain issues that the industry is facing at, and is honestly just a really cool idea and I love reading your comments and thank you! |
|
|
| ▲ | DetroitThrow 2 hours ago | parent | prev | next [-] |
| I'm a bit confused why a decision to decrease the maintenance burden of Mold by switching languages makes Rust the wrong tool here? Fearless concurrency sounds like a huge benefit for what they're doing, given the resources they have. |
| |
| ▲ | compiler-guy 2 hours ago | parent | next [-] | | It's simply an ordering problem. When building the entire world from scratch, usually the C and C++ toolchains are built near the very first, and Rust toolchains built somewhat later. Anything written in Rust must come after the Rust toolchain is built. You need a linker as part of your C++ toolchain, so it must be written in a language ready to go at that point. If it is written in C, you are done. If it is written in Rust you have to wait. So a Rust-based linker can no longer be used from that very, very early C bootstrap. It's not a big deal for normal users, where you have Rust ready to go. Kind of a bummer in this case, but this is a specialized one. | | |
| ▲ | someonebaggy 38 minutes ago | parent | next [-] | | Maybe that's about to flip. Maybe Rust will be built first, followed by C. | | | |
| ▲ | veber-alex an hour ago | parent | prev [-] | | Can't you just use a statically linked mold binary for the initial bootstrap, just like you use some kind of pre-existing, basic C compiler? | | |
| ▲ | compiler-guy an hour ago | parent [-] | | You could. But now you are trusting an entirely new toolchain that can build the Rust-based linker, even if it is statically linked. This toolchain is much larger than a comparatively small and much more easily understood C bootstrap toolchain. This effectively triples or quadruples (maybe even more) the amount of code you need to trust for the cold bootstrap. | | |
| ▲ | SleepyMyroslav 35 minutes ago | parent [-] | | Why do you keep saying C? Mold was C++ with some dependencies like TBB or zstd. | | |
| ▲ | compiler-guy 10 minutes ago | parent | next [-] | | Too many years at Google where the two terms are most often used interchangeably; which is imprecise, but most of the time it doesn't matter. Forgive me for being imprecise here. | |
| ▲ | 14 minutes ago | parent | prev [-] | | [deleted] |
|
|
|
| |
| ▲ | tadfisher 24 minutes ago | parent | prev [-] | | One of the explicit goals for Mold 3.0 is to promote its use as the default linker in Linux distributions, and bootstrapping complexity is certainly worthy of consideration in that realm. > We will then conduct extensive compatibility testing and work closely with Linux distribution developers to make it practical for them to adopt mold as /usr/bin/ld. Making this happen is one of our highest priorities for mold 3.x. |
|
|
| ▲ | well_ackshually an hour ago | parent | prev [-] |
| >Rust is not actually the right tool for all problems. "my problems (that are not mold's) are not solved by mold. How dare mold make those decisions?" Maybe you should rewrite more of your linux distribution in rust so it's available earlier in the build process and get back to it being the default linker. |
| |
| ▲ | jacquesm an hour ago | parent [-] | | They were solved by mold. And then mold decided to un-solve them. | | |
| ▲ | well_ackshually an hour ago | parent [-] | | No, they were never one of mold's goals. You don't get to assign solutions to people _and then blame them_. Hyrum's Law being a load bearing part of your infrastructure isn't Mold's problem. | | |
| ▲ | jacquesm an hour ago | parent [-] | | I can't really agree with that. If you ship your linker with a disclaimer saying 'don't use this for early stage stuff, one day we might decide to rewrite the whole codebase in a language that won't be available early enough' then you'd have a point. But if you didn't that is precisely the kind of use case where mold shines, and so inevitably it will be adopted. Your downstream should be precious. At a minimum you should communicate such intentions, do so timely and hear what others have to say, even if afterwards you decide to push on. | | |
| ▲ | ndiddy 35 minutes ago | parent | next [-] | | Pretty much every piece of open source software ships with a legal document saying that the software is provided as-is without any warranty or guarantee of functionality (i.e. https://github.com/rui314/mold/blob/main/LICENSE ). Unless I had a support agreement with the maintainers that superseded that document, I would not expect any special treatment from upstream. Personally, whenever I add a new dependency, I do it with the knowledge that I may have to either replace it or take on maintenance myself in the future. | |
| ▲ | someonebaggy 39 minutes ago | parent | prev | next [-] | | I actually made a Linux distribution that relies on this being your latest comment, since you didn't say this wouldn't always be your latest comment. If you post any newer ones, it will break. | |
| ▲ | embedding-shape 28 minutes ago | parent | prev | next [-] | | > Your downstream should be precious. Yeah, for stuff we wanna rely on, this should ideally be the default. I'd go one step further and say no breaking changes past 1.0.0 at all. Instead people should favor creating entirely new projects (forks or not) and jump over to those, leaving the old one behind, if they want to do massive changes to something. Of course, no one would be forced to do this, but it feels like if more did this, long-term supporting stuff that depends on those things would be a lot easier, if things could just be instead of changing under our feet all the time. Thank god for Nix and NixOS, even with their warts. | |
| ▲ | jstarks an hour ago | parent | prev | next [-] | | What? Why would mold be particularly valuable for early stage compilation, to the point that you’d explicitly cater to that user base? | |
| ▲ | well_ackshually 31 minutes ago | parent | prev [-] | | >Your downstream should be precious Is my downstream paying me for the maintenance ? If not, downstream may maintain mold2 themselves forever because their _extremely specific_ use case is neither a promise nor a valuable thing for mold to maintain. Debian understood this a while ago and isn't whining when they have to maintain their own fork. Maintainers maintain. If enough downstreamers are unhappy about choices, they are also welcome to fork, until the base project is abandoned. Or they realize their usecases are extremely narrow. (In addition, it's an extremely hypocritical and purist demand, because I am pretty certain that their distribution has, at some point, an arbitrary executable to make a compiler from. So they're probably okay with blobs, just not that one in particular.) |
|
|
|
|