Rewrite LLVM's archive writer in Rust

This allows it to be used by other codegen backends
This commit is contained in:
bjorn3 2022-05-28 10:43:51 +00:00 committed by bjorn3
parent c3a1c023c0
commit be6708428f
24 changed files with 445 additions and 527 deletions

View file

@ -40,6 +40,12 @@ impl Deref for Mmap {
}
}
impl AsRef<[u8]> for Mmap {
fn as_ref(&self) -> &[u8] {
&*self.0
}
}
// SAFETY: On architectures other than WASM, mmap is used as backing storage. The address of this
// memory map is stable. On WASM, `Vec<u8>` is used as backing storage. The `Mmap` type doesn't
// export any function that can cause the `Vec` to be re-allocated. As such the address of the