Define the freestanding memory-operation runtime contract

Đang mở
#918 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
compilers

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
56
Fork
21
Merge trung bình
23 giờ 20 phút
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wavefnd/Wave

Tất cả issue của wavefnd/Wave

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.