dust is the compiler and toolchain for the Dust Programming Language (DPL).
This repository contains:
- the DPL specification (
spec/) - reference examples (
examples/) - the
dustcompiler implementation (Rust) dust-runtime- OS services for bare-metal kernels
- DPL Specification: v0.2 (active development)
- Compiler: v0.2 (bare-metal and extended feature support)
- Host executable builds prefer
dustlinkas the linker frontend. - To bootstrap
dustlinkitself, the compiler bypassesdustlinkand falls back tolldpaths (-fuse-ld=lld,rust-lld,ld.lld) before the driver default linker. dust kernel-linkremains available but is deprecated; usedust obj+dustlink.- Host linker runtime support used by Dust-built tools now includes:
- cross-format shared-symbol ingestion (ELF/PE/COFF/Mach-O paths)
- COFF/Mach-O object-format probe and symbol-ingest acceptance for
arm64machine/cpu IDs in addition tox86_64 - block-aware linker-script statement splitting
- section output-address parsing inside
SECTIONS { ... } - script expression evaluation (
ORIGIN/LENGTH/ADDR/LOADADDR/SIZEOF/ALIGN, unary ops,+/-,*,/,%, shifts, bitwise ops) andASSERT(...)checks - strict script handling for unknown directive heads plus direct symbol-assignment statements (
SYMBOL = <expr>) PHDRS/VERSIONscript compatibility blocks with block-shape validationSECTIONS ... AT(<expr>)load-address capture- required-symbol registration for
ENTRY(symbol)script form - sysroot-aware
SEARCH_DIR(=...)linker-script resolution and scriptINPUThandling for-L/-ltokens - compatibility-flag state wiring for hash-style/threading/diagnostic/icf controls
- runtime consumption of compatibility-state fields for hash-style ELF dynamic tags,
--dependency-filedepfile emission,--emit-relocsmap-row expansion, and--print-gc-sectionsdrop diagnostics - broader CLI compatibility handling for script/export-related ld/lld flags (
--version-script,--dynamic-list,--trace-symbol,--print-map,--start-lib,--end-lib) - non-silent compatibility no-op handling in Dust-built
dustlinkCLI paths (warning diagnostics, or hard-fail under fatal-warnings mode) - improved unsupported flag/target diagnostics for host linker CLI parsing
- dynamic-policy alias handling for
--no-allow-shlib-undefined - expanded
-zsemantic handling fordefs/undefsplus accepted compatibility tokenstext/notext/origin lld-linkslash-option compatibility handling (/OUT,/ENTRY,/MACHINE,/LIBPATH,/DEFAULTLIB,/MAP,/DLL,/SUBSYSTEM,/OPT,/WX,/NOENTRY,/DYNAMICBASE,/NXCOMPAT,/LARGEADDRESSAWARE)- additional target alias parsing for
aarch64/arm64triples (mapped to platform linker target families), musl triples, Windows GNU triples, and bare-metal*-none[-elf]aliases - architecture-aware target preservation for both
x86_64andaarch64host linker target IDs - machine-aware relocation validation/application paths keyed by object machine type
- refined COFF and Mach-O relocation-kind mapping during host object ingestion (machine-aware COFF mapping and Mach-O reloc-type decoding)
- baseline AArch64 relocation support in Dust linker relocation pipeline (
R_AARCH64_NONE,R_AARCH64_ABS64,R_AARCH64_ABS32,R_AARCH64_PREL32) - expanded AArch64 relocation support in Dust linker relocation pipeline:
- branch/instruction forms (
CALL26,JUMP26,CONDBR19,TSTBR14,LD_PREL_LO19,ADR_PREL_LO21,ADRPpage relocs,ADD/LDSTlo12 patching includingLDST128) - MOVW families (
UABS,SABS,PREL) - starter TLS relocation families:
- instruction/descriptor forms (
TLSGD,TLSLD,TLSDESC) recognized/validated with strictERR_NOT_IMPLEMENTED_YETapplication for unsupported TLS descriptor semantics - data relocs (
TLS_DTPMOD/TLS_DTPREL/TLS_TPREL) use host-runtime TLS layout metadata helpers for non-shared links - shared-link TLS data reloc semantics now partially differentiate models:
TLS_DTPRELresolves from TLS layout metadata, shared-linkTLS_TPRELis rejected as invalid, and shared-linkTLS_DTPMODremains not yet implemented - TLSLE/TLSLD low12 offset instruction forms (
*_ADD_*_LO12_NC,*_LDST64_*_LO12_NC,*_LDST128_*_LO12_NC) now reuse host-runtime TLS offset helpers in non-shared links R_AARCH64_TLSDESC_CALLnow applies as an instruction-shape-validated preserve (BLR) instead of being blanket-rejected with the remaining unsupported TLS descriptor sequence relocs- host-runtime AArch64 TLS synthetic descriptor/GOT planning state and helper ABI are now used by Dust linker relocation application for
TLSGD/TLSLD/TLSDESCdescriptor-sequence instruction relocations (reserve,count,slot address,reloc-value) - ELF host writer now materializes a synthetic AArch64 TLS descriptor/GOT-like load-image region for reserved descriptor-sequence slots and emits minimal dynamic relocation metadata (
DT_SYMTAB,DT_SYMENT,DT_RELA*, synthetic.rela.dynrecords) for staged TLS descriptor-sequence parity work - initial TLS descriptor-sequence relaxation scope is limited to deterministic synthetic-slot reuse/coalescing (including TLSLD module-slot coalescing); full instruction-sequence rewrite relaxations remain pending
- instruction/descriptor forms (
- branch/instruction forms (
- host runtime shared-object symbol ingest now returns
ERR_INVALID_FORMATfor unknown/unsupported shared object payloads (no silent success on unknown format) - host runtime shared-object symbol ingest now validates target/ABI compatibility and shared-file kind before symbol ingest (ELF
ET_DYN, Windows PE DLL/COFF machine, Mach-O dylib CPU type) - host runtime shared-object symbol ingest now filters non-exported metadata entries more strictly (ELF hidden/internal dynsyms, Mach-O private extern/debug symbols)
- host runtime needed-library recording now prefers embedded shared-library names when available (ELF
DT_SONAME, PE export DLL name, Mach-OLC_ID_DYLIBinstall name) instead of filename-only normalization - Dust linker now reserves AArch64 TLS synthetic planning slots when unsupported TLS descriptor-sequence relocs are encountered (preparatory infrastructure only; no descriptor/GOT emission yet)
- architecture-correct output header stamping in ELF/PE/Mach-O writers based on resolved target
- real PE compatibility-state wiring for
/NOENTRY,/DYNAMICBASE,/NXCOMPAT,/LARGEADDRESSAWARE - broader soft-compatibility handling for common ld/lld/lld-link metadata/profiling flag families (
--warn-*,--time-trace*,--lto-*,/GUARD:*,/TIMESTAMP:*,/MERGE:*,/SECTION:*) - complete ELF writer execution in staged header/finalize flow (no ident-only prewrite)
- sectionized PE/Mach-O host writer emission from real alloc chunks
The compiler supports multiple output modes:
dust build hello.ds
./target/dust/hellodust obj hello.ds -o hello.odust obj hello.ds --target x86_64-unknown-linux-gnudust obj hello.ds --bare-metal -o kernel.bin- Entry Point:
K main { ... } - Variable Declarations:
let x = 5; - Control Flow:
if condition { ... } else { ... }while condition { ... }for i in 0..10 { ... }
- Effects:
emit "string"for output - Arithmetic:
+,-,*,/,% - Comparisons:
==,!=,<,<=,>,>=
- Returns
ERR_DOMAIN_NOT_AVAILABLE(100) - stub implementation
- Returns
ERR_DOMAIN_NOT_AVAILABLE(100) - stub implementation
UInt8,UInt16,UInt32,UInt64Int8,Int16,Int32,Int64Float32,Float64BoolChar
- Cranelift-based JIT/AOT compilation
- ELF (Linux), PE (Windows), Mach-O (macOS) executables
- Flat binary for bare-metal
- Object files (.o) for linking with dustlink
| Target | Description |
|---|---|
| (host) | Native (default) |
| x86_64-unknown-linux-gnu | Linux |
| x86_64-pc-windows-gnu | Windows |
| x86_64-apple-darwin | macOS |
| x86_64-unknown-none | Bare-metal (x86-64) |
cargo run -p dust -- build examples/K/k_hello_world.ds
./target/dust/k_hello_worldExpected output:
Hello, Dust
cargo run -p dust -- obj kernel.ds --bare-metal -o kernel.bincargo run -p dust -- obj mymodule.ds -o mymodule.ocargo run -p dust -- obj xdv-kernel/sector/xdv_kernel/src xdv-runtime/src xdv-xdvfs/src --target x86_64-pc-none-elf --out-dir target/dust/kernel_objs
dustlink --oformat=binary --image-base 0x100000 -Ttext 0x100000 -e _dust_kernel_start -o target/dust/xdv-kernel.bin target/dust/kernel_objs/*.oOS services for bare-metal DPL kernels written entirely in DPL:
- Console I/O - VGA text mode output
- Memory Management - Physical page allocation, heap management
- Process Management - Task scheduling and context switching
- Interrupt Handling - IDT and IRQ management
- I/O Ports - Direct hardware I/O for x86
K main {
Runtime::K::init();
emit "Kernel started";
}
// Console
Console::K::init()
Console::K::putchar(ch: UInt8)
Console::K::puts(s: UInt64)
Console::K::clear()
Console::K::set_cursor(row: UInt32, col: UInt32)
// Memory
Memory::K::init()
Memory::K::alloc(size: UInt32) -> UInt64
Memory::K::free(ptr: UInt64) -> UInt32
Memory::K::copy(dest: UInt64, src: UInt64, size: UInt32) -> UInt32
// Process
Process::K::init()
Process::K::create_task(entry: UInt64, stack: UInt64) -> UInt32
Process::K::schedule()
Process::K::yield()
// Interrupts
Interrupts::K::init()
Interrupts::K::enable()
Interrupts::K::disable()
Interrupts::K::register_handler(vector: UInt8, handler: UInt64)
// I/O Ports
IOPort::K::inb(port: UInt16) -> UInt8
IOPort::K::outb(port: UInt16, value: UInt8)
IOPort::K::inw(port: UInt16) -> UInt16
IOPort::K::outw(port: UInt16, value: UInt16)
Dust compiles to bare-metal binaries that can be used with xdv-os:
xdv-os/
├── boot_sector.asm # 512-byte boot sector
├── kernel.asm # Assembly kernel entry
├── kernel.ds # DPL kernel
└── kernel.bin # Compiled kernel
Build the bootable image:
cd xdv-os/src
./build.sh # Linux/Mac
build.bat # Windows.ds source → dust parser → dust semantics → DIR IR
↓
dust_codegen (Cranelift)
↓
┌─────────────┬──────────────┴──────────────┐
↓ ↓ ↓
Executable Object File (.o) Bare-Metal (.bin)
(ELF/PE/Mach) (for linking) (flat binary)
GitHub Actions verifies:
- Workspace build
- Unit tests
- Example compilation
- Executable execution
- Object file generation
- Bare-metal kernel compilation
Dust Open Source License
© 2026 Dust LLC