14 comments

  • lrvick4 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.<p>Now sadly we will have to fork and maintain the c version as mold2 forever.<p>Rust is not actually the right tool for all problems.
    • jdc-pub29 minutes ago
      Like some other commenters, I do not understand why using a cached binary isn’t sufficient. Why not use the mold3 binary and build that first, and then cache it and never rebuild it again? I’m guessing it has to do with hermiticity and build provenance guarantees in your distro.<p>Do you have any reading material that you can share that might help me understand better? Docs for the distro, or an issue tracker I can search through?
      • lrvick0 minutes ago
        <a href="https:&#x2F;&#x2F;stagex.tools" rel="nofollow">https:&#x2F;&#x2F;stagex.tools</a><p>In short, the entire distro is always built in one-shot at any given commit, and we can only rely on cached binaries from a past release if they or nothing in their supply chains changed. Given rustc depends on almost everything, mold3 would be built far too late to be useful for the most expensive build in the whole tree, which is rust.<p>Recursive dependencies would break our threat model, so we cannot use any rust tools to bootstrap rust. We bootstrap rust from llvm which we bootstrap from gcc which we bootstrap from tinycc which we bootstrap from M2Planet and so on back to 186 bytes of machine code.<p>Anyone getting a rust package from stagex must be able to build the entire tree up until that package and get the same hash, with no binary dependencies, thus removing any trust in maintainers.
    • karavelov3 hours ago
      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.
      • lrvick1 hour ago
        We use the llvm linker, lld, to link mold at the earliest point we can, then use mold exclusively after that. We are an LLVM native distro so we build llvm right away as the system compiler used to build the whole tree instead of gcc.<p>LLD would work fine for the whole tree, and did previously, but is much much slower than mold which is why we switched to mold.<p>Having to build all dependencies of rust including python and openssl and everything else before being able to use mold erases most of the full-tree build speedups as the path to rust is already about 80% of the full tree build time.<p>We are a distro that mandates independently verified 100% deterministic builds from source for any given release commit of the tree, so we have to build the whole tree several times for every release.
        • aseipp41 minutes ago
          Can&#x27;t you just keep using Mold2 for the initial toolchain bootstrap and then build mold3 with Rust as part of the &quot;final&quot; set of toolchains that are to be used to compile everything beyond that? It isn&#x27;t perfect but it&#x27;s congruent with how many other components in most open reproducible bootstrapping flows work; ie using GCC 4.4 or whatever just to bootstrap GCC 10. It&#x27;s annoying but it only needs to be done once and then you just use it to bootstrap newer components forever. Doesn&#x27;t help with compile times, though.
      • n8henrie3 hours ago
        Agreed -- not my wheelhouse, but couldn&#x27;t you just build rust earlier in your process using LLD, then build mold, then build everything else?<p>Would that meant that building rust is slower, but everything else is the same, and you don&#x27;t have to maintain a fork of another complex project?
        • lrvick1 hour ago
          Rust requires python and perl and musl and openssl and 80% of the entire wall time of building the whole tree.<p>Rust is the single most expensive thing to bootstrap in any given linux distro.<p>It is the thing you need mold the most for to speed things up.
      • as-1823 hours ago
        Because mold is faster. Linking is a significant bottleneck when building large projects.
        • someonebaggy2 hours ago
          The complaint is about bootstrapping, where speed is of little relevance.
          • lrvick1 hour ago
            It is of extreme relevance for us as we have to re-bootstrap every time we change any dependency of rust, and rust depends on almost everything that is expensive to build in a toolchain tree.
        • mort963 hours ago
          But we&#x27;re just talking for bootstrapping Rust here.
    • MayeulC3 hours ago
      I have been thinking about Rust bootstrapping recently. Couldn&#x27;t a Rust compiler without borrow checker be put together relatively easily?<p>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).
      • afdbcreid2 hours ago
        This exists: <a href="https:&#x2F;&#x2F;github.com&#x2F;thepowersgang&#x2F;mrustc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;thepowersgang&#x2F;mrustc</a>.
    • Orphis3 hours ago
      It seems like you would benefit from having reproducible and hermetic builds with a good caching layer so you don&#x27;t do the same work again and again.<p>Then you can just use the latest built version to build mold and the next version of rust.
      • lrvick1 hour ago
        Our tree is entirely reproducible and hermetic. In fact we are the only distro that does this 100%.<p>The problem is changing any dependency of rust, even python or perl or musl or openssl or the llvm stack or any dependencies of the llvm stack have the potential of resulting in a different hash for rust.<p>Any time a dependency is changed all decedents must be rebuilt. Which we must do very frequently. That is where mold saved us a ton of time.
    • danudey1 hour ago
      Could you not either bootstrap rust with lld or bootstrap rust with mold2?
      • lrvick1 hour ago
        Bootstrapping rust with mold2 is going to be the likely play. My complaint is that now we must maintain mold2 forever now as mold3 rust edition is now incompatible with most of our tree which is made up of dependencies of rust.
        • biorach29 minutes ago
          How much work is involved with mantaining a linker in deep maintenance mode?
    • nicce4 hours ago
      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?
      • afdbcreid2 hours ago
        The need here is bootstrapping. If mold is written in Rust you cannot even compile it.
        • nicce2 hours ago
          Even Rust is written with Rust. But yeah, if you want to bootstrap absolutely from the beginning, I see the issue.
          • lrvick1 hour ago
            We regularly and redundantly full source bootstrap our entire tree from 186 bytes of machine code due to a supply chain security policy that forbids trusting any single human or computer.
    • KolmogorovComp2 hours ago
      how&#x27;s bootstrapping rust story nowadays?
      • VorpalWay1 hour ago
        You could use <a href="https:&#x2F;&#x2F;github.com&#x2F;thepowersgang&#x2F;mrustc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;thepowersgang&#x2F;mrustc</a> to get relatively modern Rust compiler (1.90 currently apparently, but every now and then that is updated). Then build newer rustc from there to reach the current 1.99.<p>But I don&#x27;t get why some people are obsessed with bootstrapping. Yes it is good to be able to do it, but it isn&#x27;t something you need to do regularly.<p>Especially since rust had a much better cross compilation story than C or C++ (not as good as go or zig though), so you don&#x27;t need to bootstrap on a new architecture, just cross compile to it. Furthermore, new architectures for hosting a compiler (as opposed to just a target, like microcontrollers) is a rare event. Just something that happens every few years.
        • lrvick1 hour ago
          &gt; But I don&#x27;t get why some people are obsessed with bootstrapping.<p>It only matters if you have supply chain attacks in your threat model. Given they are up 400x since 2019, they should probably be in almost every threat model. Most distros operate on the honor system and that is not going to survive the post AI world.
    • mohamedkoubaa2 hours ago
      Have you considered using Eurydice?
      • lrvick1 hour ago
        I am not finding any linkers by that name.
        • mohamedkoubaa44 minutes ago
          It&#x27;s a rust to C transpiler, I was thinking it could let you use a C version of the mold linker without maintaining one yourself.
    • DetroitThrow4 hours ago
      I&#x27;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&#x27;re doing, given the resources they have.
      • compiler-guy3 hours ago
        It&#x27;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.<p>It&#x27;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.
        • veber-alex3 hours ago
          Can&#x27;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-guy3 hours ago
            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.<p>This effectively triples or quadruples (maybe even more) the amount of code you need to trust for the cold bootstrap.
            • SleepyMyroslav2 hours ago
              Why do you keep saying C? Mold was C++ with some dependencies like TBB or zstd.
              • compiler-guy2 hours ago
                Too many years at Google where the two terms are most often used interchangeably; which is imprecise, but most of the time it doesn&#x27;t matter. Forgive me for being imprecise here.<p>The fact remains that rust adds yet another toolchain to the boot process that needs trust and verification.
        • someonebaggy2 hours ago
          Maybe that&#x27;s about to flip. Maybe Rust will be built first, followed by C.
          • lrvick1 hour ago
            Sorry to break it to everyone but Rust depends on python which depends on perl and openssl and the majority of any lean full source bootstrapped toolchain tree.<p>Unless the gcc rust engine is mature any time soon (lol), we have no path to use rust until very late game in a distro build.<p>The earliest we can bootstrap a go compiler is about 10 minutes. It builds directly from tinycc. Add 6 hours for our fastest compile of the shortest path to rust, with 192 cores.<p>I am a rust fan too, but it is the worst language to bootstrap, which is why for systems programming I still must often revert to C to have a small and reviewable and fast to build dependency surface.
          • afdbcreid2 hours ago
            Rust requires LLVM (or GCC) which requires C++, not just C.
            • VorpalWay1 hour ago
              LLVM is the default yes, there is also an experimental cranelift backend, which is all Rust. Not sure if it is good enough to build the compiler itself using it.<p>(There is also a GCC backend called codegen_gcc that is pretty far along. And a separate reimplementation of both the frontend and backend using gcc and C++, called gccrs, which is not nearly as far along.)
              • afdbcreid1 hour ago
                I&#x27;m pretty sure it does not support enough features to build the compiler (e.g. inline asm is not supported at all), and it will also be very, very slow to unusable.
            • someonebaggy2 hours ago
              Maybe it should be rewritten in Rust then
      • tadfisher2 hours ago
        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.<p>&gt; We will then conduct extensive compatibility testing and work closely with Linux distribution developers to make it practical for them to adopt mold as &#x2F;usr&#x2F;bin&#x2F;ld. Making this happen is one of our highest priorities for mold 3.x.
        • lrvick1 hour ago
          We are one of only two distros that uses mold as the default system linker. Unfortunately that will be stuck at mold2 until the full tree is built, but we can swap to mold3 for end user consumers of the tree. Sucks that we have to maintain and use both now.
    • ChickeNES2 hours ago
      Luckily Mr Clanker can do most of the work for you at least (I myself have already had Claude&#x2F;Codex rewrite a couple of Rust projects in C, worked great)
      • senderista1 hour ago
        And repeat that work every time you sync with upstream?
    • duped2 hours ago
      Why do you need to bootstrap a toolchain to bootstrap a distro?<p>I know this is common but it seems like either an aesthetic decision, or glibc cruft.
      • imoverclocked2 hours ago
        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.
        • Aissen2 hours ago
          No, you can do bootstrapping and save binaries for reuse with hash verification. Android did that for its Rust toolchain: <a href="https:&#x2F;&#x2F;cs.android.com&#x2F;android&#x2F;platform&#x2F;superproject&#x2F;main&#x2F;+&#x2F;main:prebuilts&#x2F;rust&#x2F;bootstrap&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;cs.android.com&#x2F;android&#x2F;platform&#x2F;superproject&#x2F;main&#x2F;+&#x2F;...</a><p>Bootstrapping at every build does not save you from the threat you think it does.
        • duped1 hour ago
          Sure but that&#x27;s a compiler bootstrapping problem. It doesn&#x27;t answer the question: why do you need to bootstrap the toolchain to build the distro? You can reuse a trusted toolchain that&#x27;s been safely bootstrapped .
          • lrvick1 hour ago
            Because no other trusted toolchains exist under a threat model that trusts no single person or computer. We -are- the trusted toolchain.
    • someonebaggy4 hours ago
      This comment was automatically deleted due to reaching 10 downvotes.
      • Imustaskforhelp3 hours ago
        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!)<p>So asking them to pay money is well.. not quite the solution.<p>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&#x27;ve preferred to not rust in this particular case for them.<p>Yes this doesn&#x27;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&#x27;s your responsibility while they are just being maintainers of the open source and an underfunded&#x2F;mostly volunteer one of work at that.<p>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!
        • lrvick58 minutes ago
          To be clear we maintain stagex, which is a distro built on stage0 as the foundation.<p>Otherwise thank you for for the kind words.
          • Imustaskforhelp52 minutes ago
            Yes pardon me for the slight confusion but I meant stagex (though to be honest I am impressed by stage0 and how minimalist it is as well) and how stagex compromises of all of these stages to finally build a whole distro<p>Also your welcome and have a nice day!
    • well_ackshually3 hours ago
      &gt;Rust is not actually the right tool for all problems.<p>&quot;my problems (that are not mold&#x27;s) are not solved by mold. How dare mold make those decisions?&quot;<p>Maybe you should rewrite more of your linux distribution in rust so it&#x27;s available earlier in the build process and get back to it being the default linker.
      • jacquesm3 hours ago
        They <i>were</i> solved by mold. And then mold decided to un-solve them.
        • kelnos17 minutes ago
          The mold developers are not responsible for what people want to do with their software.
        • well_ackshually3 hours ago
          No, they were never one of mold&#x27;s goals. You don&#x27;t get to assign solutions to people _and then blame them_. Hyrum&#x27;s Law being a load bearing part of your infrastructure isn&#x27;t Mold&#x27;s problem.
          • jacquesm3 hours ago
            I can&#x27;t really agree with that. If you ship your linker with a disclaimer saying &#x27;don&#x27;t use this for early stage stuff, one day we might decide to rewrite the whole codebase in a language that won&#x27;t be available early enough&#x27; then you&#x27;d have a point. But if you didn&#x27;t that is <i>precisely</i> 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.
            • ndiddy2 hours ago
              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. <a href="https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;blob&#x2F;main&#x2F;LICENSE" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;blob&#x2F;main&#x2F;LICENSE</a> ). 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.
            • kelnos11 minutes ago
              Are you seriously arguing that every open source project needs to anticipate every single way any of their users might use their software in the future, and also any future change they might want to make to the software, and write up a doc of disclaimers and caveats?<p>This is ridiculous. The amount of entitlement I&#x27;m reading here is gross. This is how you burn out maintainers and drive them away from open source.<p>&gt; <i>Your downstream should be precious.</i><p>No. Every open source maintainer is free to decide for themselves how much or how little they are willing to bend over backward for the sake of serving all possible user needs. If you don&#x27;t like that, then feel free to build whatever you need yourself, from scratch.
            • someonebaggy2 hours ago
              I actually made a Linux distribution that relies on this being your latest comment, since you didn&#x27;t say this wouldn&#x27;t always be your latest comment. If you post any newer ones, it will break.<p>Edit: darn, it broke
            • embedding-shape2 hours ago
              &gt; Your downstream should be precious.<p>Yeah, for stuff we wanna rely on, this should ideally be the default. I&#x27;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.<p>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 <i>be</i> instead of changing under our feet all the time. Thank god for Nix and NixOS, even with their warts.
              • eviks1 hour ago
                What&#x27;s that benefit of a new project and abandoning an old one when you can just as easily continue using the old version?
            • well_ackshually2 hours ago
              &gt;Your downstream should be precious<p>Is my downstream paying me for the maintenance ?<p>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&#x27;t whining when they have to maintain their own fork. Maintainers maintain.<p>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.<p>(In addition, it&#x27;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&#x27;re probably okay with blobs, just not that one in particular.)
            • jstarks2 hours ago
              What? Why would mold be particularly valuable for early stage compilation, to the point that you’d explicitly cater to that user base?
  • Aissen5 hours ago
    I expected this to be a multi-months rewrite, not 3 weeks. I almost forgot we live in the agents era now.<p>Edit: this seems to have been cooking for a while when the first commit dropped: <a href="https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;commit&#x2F;f41bfcd5c72ca30cce6498e912d7513481f55a1f" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;commit&#x2F;f41bfcd5c72ca30cce6498...</a>
    • chilipepperhott3 hours ago
      Was the conversion assisted? I get the sense that Mold&#x27;s author is an extremely competent guy and it would be quite feasible for someone like him to do it on his own.
      • dmit2 hours ago
        &gt; Was the conversion assisted?<p>Yes. Comment by mold&#x27;s author:<p><a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;1w45j6n&#x2F;comment&#x2F;p7ac568&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;1w45j6n&#x2F;comment&#x2F;p7ac5...</a>
      • SuperV12345 minutes ago
        He decided to use LLM assistance exactly because he&#x27;s an extremely competent guy.
      • afdbcreid2 hours ago
        Assisted, yes. Claude is a coauthor for some of the commits and I think he also said that explicitly. Vibe-coded, he claims not.
  • awoimbee4 hours ago
    So what differentiates mold from wild now ? Is wild using different data structures?<p>(Wild is another fast linker, that only supports Linux)
    • vlovich1234 hours ago
      Wild&#x27;s primary purpose is incremental linking - I guess now the primary difference is a race + subtle differences in performance between projects.
    • sillysaurusx2 hours ago
      Thanks for pointing out Wild.
  • sharktheone1 hour ago
    Oh what? That was not on my bingo card for 2026. Mold already was incredible when it still was in C++ and I assume it is even better now that it is in rust
  • dhruv_dube3 hours ago
    [flagged]
  • tankiya2 hours ago
    [flagged]
  • fr20293 hours ago
    [dead]
  • rvz5 hours ago
    [flagged]
  • asjq1784 hours ago
    [flagged]
    • iTokio3 hours ago
      This is NOT a slop linker, Mold is a reference in the world of linkers and this port is official.
      • dabinat1 hour ago
        LLMs are very good at taking your existing structure and converting it as-is to a new language. But rewriting by hand gives you the opportunity to rethink previous design decisions or optimize the code for the new language. So I was disappointed that this appears to just be a straight port and no additional performance improvements were gained.
      • as-1823 hours ago
        <a href="https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;releases&#x2F;tag&#x2F;v2.42.1" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;releases&#x2F;tag&#x2F;v2.42.1</a><p>&quot;Recent advances in AI-assisted coding have made large-scale rewrites considerably more practical, but they do not eliminate those risks, and we do not take them lightly.&quot;
      • menaerus3 hours ago
        Last time I checked it didn&#x27;t make any difference or whatsoever when compared to lld so I would not go that far by saying &quot;mold is a reference in the world of linkers&quot; - made a test just few days ago on 10M LoC C++. So, rewriting the codebase in another language just because doesn&#x27;t seem like an investment worth doing when there&#x27;s much bigger fish to fry.
      • adastra222 hours ago
        They just threw out the code base and replaced it with a vibe coded rust port.
    • IshKebab3 hours ago
      The days when AI <i>always</i> means slop are gone. It still often does, but the latest models can be used to get very high quality code in many situations. I haven&#x27;t checked the code here but I would be surprised if it&#x27;s bad.
  • acedTrex5 hours ago
    [flagged]
    • gbin5 hours ago
      What warrants an off the cuff comment like this? I can take <i>any</i> piece of software and just say a vague statement like that. All of software... What does it even bring to the conversation? Just vague &quot;they&quot;s again we keep on propping up? Who is unethical? The mold team? The AI? The rust foundation? The ASCII character set? The cloud system it has been compiled on? Oh no obviously the backdoors in there?! Oh let us guess!!
      • acedTrex5 hours ago
        I didn&#x27;t think it needed to be said... If you need it spelled out the LLM rust rewrite is very clearly what is being referred to.
        • gbin4 hours ago
          I think it needed to be said because I really don&#x27;t see why.<p>LLM are excellent translation tools. Nothing is learned or stolen from them out of this exercise if this is a copyright issue you are getting at.<p>Then Rust? Why picking on it, the language is morally corrupt? In what way? If it were a rewrite in Object Pascal it would be better?
          • DetroitThrow4 hours ago
            I personally think object pascal, or perhaps think c, would be a better choice here.<p>I will not explain why.
        • germoney5 hours ago
          Help me get the argument please I might be dense: is the rewrite unethical or the llm use or rust or any of the combinations?
          • hansvm4 hours ago
            The usual argument I see goes something like:<p>1. There are major obvious flaws<p>2. Most of those are obviously LLM-induced, unless there&#x27;s a new breed of human trained on just the failures of LLMs and not the successes or other relevant information<p>3. I therefore assume that the rest of the project is an unverified LLM psychosis without meaningful human review<p>That&#x27;s not the worst thing in the world for all software maybe. I recently found out my apartment complex in their latest AI rewrite generates SMS OTP based purely on the timestamp and ignores passwords, so I can log in as anyone else by knowing their email and having a valid email to grab the current OTP. That&#x27;s a major security failing, but how bad is it really? I can grab the last-4 of their credit card numbers, pay their rent, see how much other tenants are being screwed, and so on, and only if I know their email addresses (solvable with a tiny bit of social engineering, but let&#x27;s assume that&#x27;s also moderately hard). How bad is that really? On the one hand, it&#x27;s terrifying, since I presume they have the same level of attention to detail with respect to payment methods and PII despite my having opted out of having them stored, but (a) that&#x27;s all already been exposed via dozens of breaches and is being handled behind the scenes by my bank anyway, and (b) if we examine the immediate blast radius of the known bugs then there&#x27;s approximately fuck-all an attacker can do with that information.<p>For a multi-threaded linker? Come the fuck on. I don&#x27;t care if it&#x27;s written in Rust. If you ignore all of the memory ordering intrinsics and `unsafe` then maybe it&#x27;s more okay, but not having easily available UAF and other memory bugs is very different from actually implementing the correct behaviour, and for a linker where you&#x27;re explicitly joining together multiple independent binary blobs and choosing what and how to execute on a machine instruction level, Rust&#x27;s guarantees 100% don&#x27;t save you from broken, unvalidated &quot;business logic.&quot;
            • cleaning4 hours ago
              How do you feel about the bun rust rewrite having no major issues, with it being used to run claude code for months now?
              • acedTrex4 minutes ago
                The bun to rust rewrite broke tls authentication and failed open... that alone puts it in the &quot;massive failure&quot; category.<p>If a breaking bug of that magnitude does not register to you as &quot;huge failure&quot; then you and I have such different views on software quality that theres no possibility of a conversation.
              • hansvm3 hours ago
                (a) That&#x27;s mostly irrelevant to my point. This project has major issues with an LLM signature in a safety-critical context. If we assume that the bun rust rewrite went off without a hitch and that doing so is repeatable then it&#x27;s worth trying to understand what the difference was.<p>(b) I&#x27;m not sure those assumptions hold. Bug reports spiked 2-3x when the rust version was introduced. HMR broke. There were utf-16 parsing panics. The result was slower out of the box and needed a lot of hand-tuning. There were FFI regressions. The rust rewrite had its own concurrency bugs despite rust&#x27;s &quot;fearless concurrency.&quot; In a JS runtime where the rest of the ecosystem is already usually broken, especially since the bugs seemingly weren&#x27;t safety-related, maybe that&#x27;s fine, but it wasn&#x27;t exactly a &quot;no major issues&quot; rewrite.
        • boxed5 hours ago
          The fact that it&#x27;s less C++ and more rust makes it more trustable and more ethical, not less.
          • hansvm5 hours ago
            &#x2F;s?
            • someonebaggy4 hours ago
              No? Rust code has lower rates of exploitable vulnerabilities than C or C++ code.
    • 4783366329294 hours ago
      [flagged]
      • someonebaggy4 hours ago
        Numbered throwaway account means you know this is against the guidelines.
  • WhereIsTheTruth4 hours ago
    It was transpiled, not rewritten, rewrite implies by hand
    • tialaramex3 hours ago
      If it was <i>transpiled</i> there would be what GNU calls a &quot;preferred form&quot; of the linker source in which it wasn&#x27;t written in Rust.<p>This is true for - as an example - the WUFFS GIF decoder. You can get C which decodes GIFs and was transpiled from WUFFS, but that&#x27;s awful code and nobody wants to modify that code, whereas the WUFFS source code for the decoder is fine.<p>When we look at rui314&#x27;s changes to mold today after 3.0 release, they just modify the mold source code in Rust, as you&#x27;d expect if this was in fact now written in Rust.
    • dcre4 hours ago
      No it doesn&#x27;t.
  • mi_lk4 hours ago
    Damn. I thought Zig would be a perfect rewrite language for Mold since it&#x27;s a better C in many ways
    • vlovich1234 hours ago
      Zig makes you choose either safe or fast, not both. With Rust you can get both (generally).
      • senderista2 hours ago
        Part of the safety you get with Rust is runtime bounds checking, which is equivalent to Zig in &quot;safe&quot; mode.
        • vlovich1232 hours ago
          Bounds checking is like 1% of the safety that Rust guarantees you. That&#x27;s a false-equivalence. The bigger ones are around memory safety like use-after-free, double-free, and memory issues in the face of concurrency. Zig does not help you with that.
        • afdbcreid2 hours ago
          Bound checks, which are part of what you get with Rust, also exist in ReleaseSafe Zig, that is true. But if that is what you wanted to say, your statement is very confusing and also does not answer the GP. If you meant to say ReleaseSafe and Rust are equivalent, then this is just false. ReleaseSafe still has many UBs (most importantly use after free and double free), not to mention that Rust solves many problems at compile time and Zig only at runtime.
          • senderista1 hour ago
            Sorry, I agree I was unclear and your restatement accurately reflects my intent. My biggest concern with Zig safety is that ReleaseFast turns asserts into assumptions, which is equivalent to injecting UB at every failed assert site. I doubt many users are aware of that &quot;feature&quot;.
      • Zambyte3 hours ago
        Zig makes you choose that at build time. You can use safe builds for development to catch bugs, and fast builds for release. You can even use safe builds in of the release, and optimize hot paths with fast builds.<p>In practice, projects written in Zig very much can choose both.
        • bhaak3 hours ago
          You make it sound as if all bugs could be catched in development builds.
        • pjmlp3 hours ago
          Still doesn&#x27;t have a good answer for use after free, although the allocators on the last release might help into that regard.
      • audunw2 hours ago
        That’s not entirely true. There’s a third choice. You can go the TigerBeetle route (TigerStyle). Zig is extremely well suited for software where you just avoid dynamic memory allocation all together. It’s extremely fast, very effective and arguably very safe. But not suitable for all applications obviously.<p>There’s also another caveat that there’s an effort to build in build time static memory safety checks in a way that’s more general than Rusts borrow checker, through a kind of plug in system rather than forced into the language. It’s not part of mainline Zig yet but this seems to be the direction Andrew wants to go.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ityonemo&#x2F;clr" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ityonemo&#x2F;clr</a>
    • p-e-w3 hours ago
      When choosing a language, people don’t only look at language features but also at community adoption, the library ecosystem, industry backing etc.<p>Zig isn’t even in the same league as Rust regarding these things. Zig may still be around and active 10 years from now, Rust is guaranteed to be.
      • bryanlarsen2 hours ago
        Additionally, Zig just released 0.17, Rust&#x27;s 1.0 was 11 years ago. The choice may have been mostly for non-technical reasons.
  • uncle_kostya6 hours ago
    I&#x27;m curious about motivation - bounds checks for corrupted inputs seems like it would be one, but it also seems that fixing corrupted input handling in a C&#x2F;C++ code base would not be too hard, and probably less of an effort? So why did you choose the rewrite?<p>And second, did you use any AI tools for the rewrite?
    • fotcorn5 hours ago
      &gt; fixing corrupted input handling in a C&#x2F;C++ code base would not be too hard<p>The best programmers on the planet have tried and failed with this task for 50 years now, so I don&#x27;t think this is true.<p>The main disadvantage of Rust right now is not supporting some more obscure platforms, but because mold wouldn&#x27;t support them anyway I don&#x27;t see that as a problem.
      • embedding-shape5 hours ago
        &gt; The main disadvantage of Rust right now is not supporting some more obscure platforms<p>Last time I checked, I got impressed by the wide platform support, once you go down the tier list (<a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;nightly&#x2F;rustc&#x2F;platform-support.html" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;nightly&#x2F;rustc&#x2F;platform-support.htm...</a>). What &quot;obscure platform&quot; specifically are you thinking about, that is currently missing from those lists?
        • fotcorn4 hours ago
          Just to be clear, I think this is a very small disadvantage. GCC and therefore C&#x2F;C++ supports some old stuff like SuperH, Intel Itanium, PA-RISC and a bunch of microcontroller archs that LLVM does not.<p>However, there is now a Rust codegen plugin for GCC, so even this disadvantage is now basically moot.<p>Rewrite all the things!
          • afdbcreid2 hours ago
            The GCC backend is fairly complete but still does not support everything.
        • jcranmer1 hour ago
          The list of supported GCC architectures is here: <a href="https:&#x2F;&#x2F;gcc.gnu.org&#x2F;backends.html" rel="nofollow">https:&#x2F;&#x2F;gcc.gnu.org&#x2F;backends.html</a><p>LLVM doesn&#x27;t have an equivalent annotated list, but it is missing alpha, bfin, c6x, fr30, frv, gcn, h8300, ia64 (aka Itanium), lm32, m32c, m32r, mcore, mep, microblaze, mmix, mn10300, moxie, nds32, nios2, pa (aka PA-RISC), pdp11, pru, rl78, rs6000, rx, sh (aka SuperH), storm16, v850, vax, and visium. For its part, LLVM does have some targets that GCC doesn&#x27;t have (mostly related to GPU compilation).<p>The &quot;big&quot; targets that GCC has that LLVM lacks are Alpha, Itanium, PA-RISC, and SuperH, with Itanium being sufficiently weird that it&#x27;s pretty firmly in the &quot;fuck this&quot; category from a maintainer&#x27;s perspective, and people are actively ripping out support for it.
        • torginus5 hours ago
          yeah this makes no sense to me. Why would Rust limit the LLVM backend&#x27;s ability to generate code for a particular platform?
          • panzi5 hours ago
            I think the claim is that GCC supports a few obscure platforms that LLVM doesn&#x27;t. Don&#x27;t ask me which, that is just the claim that I heard multiple times. So it&#x27;s not Rust that limits platforms, but LLVM. And they say the GCC backend efforts of Rust are meant to deal with that.
            • bkallus4 hours ago
              &gt; Don&#x27;t ask me which<p>There are many. Two big ones are Alpha and PA-RISC. NetBSD and Linux continue to support both. Linux distro choices are pretty much limited to Gentoo though.
          • steveklabnik4 hours ago
            1. You&#x27;ve got the causality backwards. LLVM backends don&#x27;t come for free, you have to write code to enable support for them.<p>2. LLVM does not support as many backends as GCC does, so even if you did get 100% of the LLVM supported backends up and running, you&#x27;d still be missing some.
            • VorpalWay1 hour ago
              Worth adding to this: there may also be code needed in the rust part (not just the llvm part) to enable support for a target triplet. There certainly will be for the OS and libc part of the triplet: what specific syscalls exist and should be used to implement the standard library on a particular flavour of BSD etc.<p>But even for the architecture part there can be differences. For example, my understanding is that a lot of the calling convention details need to be handled by the frontend in LLVM, leading rustc to duplicate logic from clang here. Things like varargs FFI with C code can be particularly gnarly.
    • saghm5 hours ago
      My very naive understanding is that a part of what makes mold fast is concurrency, which I&#x27;d expect to be a lot more error-prone in C&#x2F;C++. Not having to worry about data races might give more confidence with trying out more complex techniques for how to split up work in a way that ends up making things faster
    • someonebaggy4 hours ago
      It&#x27;s possible to write safe code in C or C++ but it&#x27;s extremely difficult to read existing code and prove it&#x27;s safe, without using as much effort as it takes to write it in the first place. This includes the code you wrote last month whose surrounding code has changed. And you have to be right every time while the attacker only needs you to be wrong once. The problem is not writing the code, it is continually verifying it.
      • VorpalWay1 hour ago
        As someone who worked professionally with both C++ and Rust, I mostly agree with this, but I would say that writing the concurrent code in C++ is also hard.<p>The only way I found that works reliably is stick to a small well defined set of mostly safe primitives. E.g. at work we use message passing &#x2F; event bus architecture everywhere, which works great for a robotics &#x2F; industrial context. But even then, if you somehow mess up and have a variable accessed from event handlers in two different threads, it is tough to spot other than if you get lucky and observe it with a build using TSAN.<p>With rust that class of mistakes is just entirely eliminated, which makes it easier to to concentrate on the hard things that actually matter (like the domain specific logic).
    • pornel5 hours ago
      I suspect fearless concurrency is another motivating factor. Better perf can be achieved by squeezing more parallelism, but without borrow checking it&#x27;s difficult to do fine-grained parallelism correctly.
    • LoganDark5 hours ago
      &gt; And second, did you use any AI tools for the rewrite?<p>IMO, given the recent commits: almost certainly.
    • marsven_4225 hours ago
      [dead]
    • nine_k3 hours ago
      &gt; <i>in a C&#x2F;C++ code base</i><p>It&#x27;s like &quot;in a Zodiac boat &#x2F; aircraft carrier navy&quot;. This customary putting C and C++ into the same bucket is as amusing as it is unproductive.
      • flohofwoe41 minutes ago
        Apparently the old mold version had a couple of plain C source files in the source tree (both vendored 3rd party libs but also in the &#x27;regular&#x27; source code), so technically C&#x2F;C++ is correct in this case ...and looks like the Rust version also has some (very minimal) C code left (looks like mostly varargs stuff, I guess Rust doesn&#x27;t have a concept of varargs?), so it could be called a C&#x2F;Rust project ;)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;tree&#x2F;main&#x2F;c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;mold&#x2F;tree&#x2F;main&#x2F;c</a>
      • pjmlp3 hours ago
        Unfortunately too many folks still do C style programming in C++.