Skip to content

build: add -Donly-c option#13278

Merged
andrewrk merged 1 commit intomasterfrom
build-c-bootstrap
Oct 24, 2022
Merged

build: add -Donly-c option#13278
andrewrk merged 1 commit intomasterfrom
build-c-bootstrap

Conversation

@andrewrk
Copy link
Copy Markdown
Member

This option can be used to produce a C backend build of the self-hosted compiler, which only has the C backend enabled. Once the C backend is capable of self-hosting, this will be a way for us to replace our stage1 codebase with a C backend build of self-hosted, which we can then use for bootstrapping. See #5246 for more details.

Using this option right now results in a crash because the C backend is not yet passing all the behavior tests.

@andrewrk andrewrk mentioned this pull request Oct 23, 2022
@kubkon
Copy link
Copy Markdown
Member

kubkon commented Oct 23, 2022

Very exciting!

This option can be used to produce a C backend build of the self-hosted
compiler, which only has the C backend enabled. Once the C backend is
capable of self-hosting, this will be a way for us to replace our stage1
codebase with a C backend build of self-hosted, which we can then use
for bootstrapping. See #5246 for more details.

Using this option right now results in a crash because the C backend is
not yet passing all the behavior tests.
@andrewrk andrewrk merged commit 4f04759 into master Oct 24, 2022
@andrewrk andrewrk deleted the build-c-bootstrap branch October 24, 2022 03:05
@jacobly0
Copy link
Copy Markdown
Member

Just FYI this can also trigger some compile errors when enabled:

src/Compilation.zig:2454:9: note: 'error.FlushFailure' not a member of destination error set
src/Compilation.zig:2455:9: note: 'error.LLDReportedFailure' not a member of destination error set

@andrewrk
Copy link
Copy Markdown
Member Author

Thanks for pointing this out - fixed in #13294.

After this, the unique errors that remain to build Zig with -Donly-c in your branch are these:

/home/andy/dev/zig/lib/std/multi_array_list.zig:438:9: error: TODO: C backend: implement value of type Vector
        fn capacityInBytes(capacity: usize) usize {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andy/dev/zig/src/link.zig:624:9: error: TODO: C backend: implement airFieldParentPtr
    pub fn destroy(base: *File) void {
    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andy/dev/zig/lib/std/child_process.zig:496:5: error: TODO: C backend: implement cmp_lt_errors_len
    fn cleanupAfterWait(self: *ChildProcess, status: u32) !Term {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andy/dev/zig/src/value.zig:1615:5: error: TODO: C backend: implement lowering large float values
    fn bigIntToFloat(limbs: []const std.math.big.Limb, positive: bool) f128 {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andy/dev/zig/lib/std/fmt/parse_float/parse_float.zig:14:5: error: TODO float types > 64 bits are not support in renderValue() as of now
pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T {
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

😮

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants