Define the freestanding memory-operation runtime contract

Aperta
#918 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

Start with llvm/src/codegen/ir.rs at the linked starting point, then reproduce the O0/O2 object builds and inspect undefined symbols with llvm-nm. Discuss the design with @LunaStev before implementation. Done means the runtime ownership contract is documented, applied consistently to optimized loops and aggregate operations, and checked for overlapping memmove, zero-length operations, and unintended hosted linkage.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

discussion enhancement

Motivation

A raw byte-zeroing loop has no undefined symbol at O0, but O2 creates llvm.memset and the object has an undefined memset symbol. --freestanding disables default libc/libm links but does not prevent this lowering. This behavior is also common in C freestanding compilers; the gap is an explicit Wave ownership/provider contract.

Starting points: llvm/src/codegen/ir.rs.

fun clear(p: ptr<u8>, n: i64) { var i: i64 = 0; while (i < n) { deref p[i] = 0; i += 1; } }

Reproduced at 73aff59e on Linux amd64/LLVM 21.1.8: build with --freestanding --target=x86_64-unknown-none-elf --emit=obj at O0/O2, then inspect with llvm-nm --undefined-only. Only O2 has U memset in the sampled loop.

Scope

Decide compiler-owned memory helpers versus an explicit caller-supplied kernel runtime contract. Cover memcpy/memmove/memset and optimized loops/aggregates, including preservation of memory semantics.

Completion criteria

  • Agree on and document whether memory primitives are compiler-owned or explicitly provided by the freestanding environment.
  • Implement the approved contract consistently for optimized loops and aggregate copies/initialization.
  • Inspect O0/O2 undefined symbols and test overlapping memmove and zero-length operations without accidental hosted linkage.

Design required. Please mention @LunaStev to discuss the design before starting implementation.

Lingua principale
Rust
Stelle
56
Fork
21
Merge medio
23h 20m
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wavefnd/Wave

Tutte le issue di wavefnd/Wave

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.