Skip to content

further reduce bootstrapping dependencies by making stage1 output C rather than LLVM IR #5246

@andrewrk

Description

@andrewrk

Related but different: #3772

This issue is to delete the Clang, LLVM, and LLD dependencies of stage1. It will make it possible to bootstrap a fully self-hosted zig without ever touching the LLVM project.

This issue depends on the self-hosted compiler being completely done (#89).

Further, the next step after that will be to stop using C++ features in stage1, making it pure C, with no dependency on a C++ compiler or libc++.

The self-hosted Zig compiler will have an optional dependency on Clang, LLVM, and LLD. The bootstrapping process will look like the following, if this issue is implemented:

  • Use system C compiler to compile .c source files into zig1 executable
  • Use zig1 executable to compile .zig source files into .c generated files
  • Use system C compiler to compile .c source files + generated .c files into zig2 executable
  • Use zig2 executable to compile .zig source files into zig executable

Any further recompiling of zig would yield the same binary. E.g. using the final zig executable to compile the .zig source files would result in the same zig executable.

On the final step it would be possible to select any desired target (cross compiling) as well as selecting the option of enabling LLVM features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.stage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions