1
Fork 0

document our assumptions about symbols provided by the libc

This commit is contained in:
Ralf Jung 2023-08-03 14:05:18 +02:00
parent a922d1c0da
commit dfee1ba4c4

View file

@ -20,11 +20,15 @@
// FIXME: Fill me in with more detail when the interface settles // FIXME: Fill me in with more detail when the interface settles
//! This library is built on the assumption of a few existing symbols: //! This library is built on the assumption of a few existing symbols:
//! //!
//! * `memcpy`, `memcmp`, `memset`, `strlen` - These are core memory routines which are //! * `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines
//! often generated by LLVM. Additionally, this library can make explicit //! which are generated by Rust codegen backends. Additionally, this library can make explicit
//! calls to these functions. Their signatures are the same as found in C. //! calls to `strlen`. Their signatures are the same as found in C, but there are extra
//! These functions are often provided by the system libc, but can also be //! assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if
//! provided by the [compiler-builtins crate](https://crates.io/crates/compiler_builtins). //! the `n` parameter is 0, the function is assumed to not be UB. Furthermore, for `memcpy`, if
//! source and target pointer are equal, the function is assumed to not be UB.
//! (Note that these are [standard assumptions](https://reviews.llvm.org/D86993) among compilers.)
//! These functions are often provided by the system libc, but can also be provided by the
//! [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
//! //!
//! * `rust_begin_panic` - This function takes four arguments, a //! * `rust_begin_panic` - This function takes four arguments, a
//! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments //! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments