Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Support lld on pure wasm backend #2

Closed

Description

@aturon

Currently we avoid the need for any linked on wasm32-unknown-unknown, by combining all Rust code into a single compilation unit. This allows us to work around the immaturity of the lld story for wasm, but at the cost of compile times. This issue tracks the status of the lld readiness and rustc's ability to use it.

Activity

  1. alexcrichton commented on Jan 10, 2018

    @alexcrichton
    Contributor

    Awhile back I filed https://bugs.llvm.org/show_bug.cgi?id=35369 with at least one cause of "we can't use lld vanilla upstream". There's a whole lot more issues to solve here, but that's at least one concrete actionable one :)

  2. pepyakin commented on Jan 23, 2018

    @pepyakin
    Member

    JFYI Experimental LLD support has been landed in Emscripten

    WebAssembly/binaryen#1346
    emscripten-core/emscripten#6056

  3. alexcrichton commented on Jan 30, 2018

    @alexcrichton
    Contributor

    I've tested on top of the LLVM 6 upgrade (plus a bit farther on LLVM for a few more patches) with LLD master and everything looks to be working beautifully! Once https://reviews.llvm.org/D42511 lands we won't even need wasm-gc any more, yay!

  4. alexcrichton commented on Jan 30, 2018

    @alexcrichton
    Contributor

    Ok I've now completed a test run of our entire test suite using LLD to link wasm binaries together. Specifically I was using llvm-mirror/lld@95a9b67 with https://reviews.llvm.org/D42511 applied manually (but that probably wasn't necessary), llvm-mirror/llvm@d14b8f6, and alexcrichton/rust@106657e.

    I believe the sequence of steps here are now:

    • Wait for LLVM 6 - rustc: Upgrade to LLVM 6 rust-lang/rust#47828
    • Add lld as a submodule (turned off by default) in the rust-lang/rust repository.
    • Add build system support to build LLD and make its binary available to rustc to run
    • Probably upgrade LLVM again (but a much smaller one) necessary to get LLD building
    • Land something along the lines of alexcrichton/rust@106657e in rustc to switch wasm's default linker.

    I'd hope we can just switch the defaults overnight and not worry about maintaining the old "LTO everything" link mode. There'll proably be bugs but likely nothing that's too hard to backport!

  5. alexcrichton commented on Jan 31, 2018

    @alexcrichton
    Contributor

    Ok I got a little excited and I've now implemented all of this -- alexcrichton/rust@cbf406f

    Once LLVM 6 lands I'll send that as a PR and we should be able to switch to LLD pronto.

  6. alexcrichton commented on Feb 10, 2018

    @alexcrichton
    Contributor
  7. alexcrichton commented on Mar 4, 2018

    @alexcrichton
    Contributor

    Landed!

  8. alexcrichton commented on Mar 6, 2018

    @alexcrichton
    Contributor

    FWIW as a testament to the improvements brought about by LLD related to build times, the wasm32-unknown-unknown builder we have in rust-lang/rust reduced from 1h53m per build to 1h10m per build when this landed, a huge reduction in our build times!

  9. mgattozzi commented on Mar 6, 2018

    @mgattozzi
    Contributor

    Wow that's a huge reduction. Shaving 40+ minutes off is not a trivial gain at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions