Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/bootstrap.x

Source-bearing APE to native x2c transition.

Functions

FunctionSummary
bootstrap_build_requestBuilds an ordinary native request for one materialized bootstrap component.
bootstrap_materializeVerifies and materializes the APE source payload at request.prefix.
bootstrap_record_installRecords the resolved host tools and then publishes bootstrap completion.

Functions

bootstrap_build_request

CliRequest bootstrap_build_request( CliRequest command, Bootstrap payload, Symbol component)

Builds an ordinary native request for one materialized bootstrap component. component must be <runtime> or <compiler>. The former selects a static archive over runtime_srcs; the latter selects an executable over compiler_srcs. The Scope-owned result borrows the payload’s source List and the command’s compiler-argument List; its new Strings and List retain their actual canonical pool lifetimes, which may belong to ancestor pools.

Raises: <alloc-fail> or <size-limit> while constructing the request.

Source: src/bootstrap.x:178

bootstrap_materialize

Bootstrap bootstrap_materialize(CliRequest request)

Verifies and materializes the APE source payload at request.prefix. The prefix must be nonempty and must not be /. An existing tree is reused only when its source identity matches and every manifest entry verifies. On success the process holds the exclusive lock on <prefix>/.x2c-bootstrap.lock until it exits; the file stays in place. complete additionally requires the matching completion marker, executable compiler, and readable runtime archive. Validation, locking, or filesystem failure prints a bootstrap diagnostic and exits with status 2.

Raises: <bad-arg> for embedded manifest bytes that are not String text, or <alloc-fail> or <size-limit> while reading the manifest or constructing the result.

Source: src/bootstrap.x:146

bootstrap_record_install

void bootstrap_record_install(Bootstrap b, String cc, String ar)

Records the resolved host tools and then publishes bootstrap completion. The completion marker is written only after the toolchain record succeeds. The call does not update payload.complete. A directory, record, or marker failure prints a bootstrap diagnostic and exits with status 2.

Raises: <alloc-fail> or <size-limit> while constructing canonical paths.

Source: src/bootstrap.x:207

Public types

TypeKindSummary
BootstrapstructRepresents one verified source payload while its installation lock is held.

Bootstrap

typedef struct Bootstrap { String prefix, identity, List runtime_srcs, compiler_srcs; int complete; } *Bootstrap

Represents one verified source payload while its installation lock is held. The record is Scope-owned; its Strings and source Lists retain their actual canonical pool lifetimes, which may belong to ancestor pools.

Source: src/bootstrap.x:18

Design notes

The Cosmopolitan seed publishes the source and drives native build requests. Host tools never receive /zip paths, and the native compiler is linked only with the runtime built for that host.