Building self-hosted from the original C++ implementation

For that one I think you can do the following:

  • Check out 7b2a936173165002105ba5e76bed69654e132fea
  • Add the following declaration to lib/std/builtin.zig:
    pub const CallOptions = struct {
        modifier: CallModifier = .auto,
        stack: ?[]align(std.Target.stack_align) u8 = null,
    };
    
  • Update zig1.wasm
  • All done (you can revert the change)

The trick here is that since a type was removed rather than changed, you can just include both declarations in std.builtin when building the compiler here. You want 7b2a936173165002105ba5e76bed69654e132fea rather than 08b2d491bcd8c79c68495267cc71967661caea1e because the compiler you’re using to build zig1.wasm expects the old usage, so we want the commit before usages were changed.

(By the way, I hope you’re noting down what you had to do for each of these; it’d be nice to have a way to reproduce the full bootstrap path!)

2 Likes