Luce / engineering
Learn Luce LuciaOS

Artifacts and compatibility

Every .lc contains a Luce artifact record inside its native container. Before loading code, the runner checks the tag format, machine target, host ABI, generator identity, and serialized-program hash.

Four files, four roles

.lcminternal deterministic serialized MIR used between the runner, cache, and compiler
.orelocatable host-machine object; user can link it with the installed runtime/start archives
.lcnative loadable library carrying runtime code, luce_main, and an artifact section
executablenative program plus start archive, host construction, and process-status bridge

The artifact tag

The tag is a fixed record in a dedicated Mach-O or ELF section. It contains magic, the tag layout version, host ABI version, machine identity, a hash of the serialized program, generator identity, and whether source origins were retained.

FieldQuestion it answers
magic + tag versionIs this a Luce artifact whose tag layout this loader understands?
machineWas it built for this architecture, system, and C ABI?
host ABI · 29Will generated host-table slots mean what this runner provides?
source hashDoes it contain the exact serialized program requested now?
generatorWas it produced by the current lowering, runtime, build mode, target, and LLVM identity?
originsShould traces contain source line and column detail?

Read before dlopen

The loader walks the file's container headers and checks every followed offset against file length before asking the platform loader to map it. This detects truncation on either side of the tag and reports the damaged field while the file is still inert data.

read bytesinspect the file as inert data
validate containerall segments and sections bounded
compare tagmachine, ABI, content, generator
dlopenonly a believed artifact

Three version/identity seams

MIR format · 62Changes when serialized instruction/type/layout meaning changes. Stale modules recompile.
Host ABI · 29Changes when the published service table or value boundary changes. Stale native artifacts are refused.
Generator identityComputed from codegen/runtime content and build inputs, so an implementation change automatically invalidates older generated code.
Tag formatChanges when the loader-readable tag itself changes; it must be understood before the ABI field can be trusted.

Content identity controls cache reuse

A cached artifact is reusable when its serialized MIR hash and generator identity match the current request. Identical program bytes can reuse the same artifact regardless of file modification time. Artifacts beside source are visible and removable with it; unwritable or embedded sources use a session-owned temporary location.

Why artifacts carry a machine triple

A .lc includes the Luce runtime for one machine triple. Cross-compilation requires target runtime libraries, target object emission, and a target-capable platform link. The loader reports the artifact's machine triple when it differs from the current host.