Skip to content

Restructure staged build / cross-compile architecture for speed #3772

Closed
@brson

Description

@brson

Right now a complete stageN image is composed of artifacts from multiple stages' compilers. This intermixing of stages makes us do more work than we should. It also causes unusual bugs like #3660.

At it's most simple, we want the build to consist of downloading the snapshot compiler and building the binaries once. Right now the closest we can get to that is a stage0 build, but the result of a stage0 build is still using the snapshot compiler. To get a rebuilt compiler you have to build stage1, but building stage1 forces you to rebuild the host libraries.

To recap, we distinguish between the host and target binaries. They live on different places on disk, but they are always built as target binaries, then 'promoted' to the next stage as host binaries.

It looks like this:

bin/ - the 'host' bin directory, /usr/local/bin
  rustc, etc.
lib/ - the 'host' lib directory
  libcore - used by the host toolchain only
  libstd - etc.
  rustc/
    x86_64-unknown-linux-gnu/
       ... target versions of bin/ and lib/

When we create stage0 on disk we drop the snapshot binaries into the stage0 host directories, then build the stage0 target directories. This is not right.

stage0 should be only snapshot binaries, stage1 should be built entirely by stage0, etc. Then a basic build is just download the snapshot and build all the binaries (once) directly to their final on-disk stage1 location. That's it.

Related to #2237

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions