Auto merge of #98100 - bjorn3:use_object_for_bitcode_reading, r=wesleywiser

Use object instead of LLVM for reading bitcode from rlibs

Together with changes I plan to make as part of https://github.com/rust-lang/rust/pull/97485 this will allow entirely removing usage of LLVM's archive reader and thus allow removing `archive_ro.rs` and `ArchiveWrapper.cpp`.
This commit is contained in:
bors 2022-08-30 11:13:58 +00:00
commit 230a8ee364
6 changed files with 18 additions and 30 deletions

View file

@ -83,17 +83,6 @@ impl<'a> Child<'a> {
}
}
}
pub fn data(&self) -> &'a [u8] {
unsafe {
let mut data_len = 0;
let data_ptr = super::LLVMRustArchiveChildData(self.raw, &mut data_len);
if data_ptr.is_null() {
panic!("failed to read data from archive child");
}
slice::from_raw_parts(data_ptr as *const u8, data_len as usize)
}
}
}
impl<'a> Drop for Child<'a> {

View file

@ -2389,7 +2389,6 @@ extern "C" {
AIR: &ArchiveIterator<'a>,
) -> Option<&'a mut ArchiveChild<'a>>;
pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);