mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
adopt object changes
adopt wasm_encoder changes
This commit is contained in:
parent
58c9999f25
commit
87547103e8
@ -110,13 +110,11 @@ impl<'a> ArArchiveBuilder<'a> {
|
||||
}
|
||||
|
||||
fn try_filter_fat_archs(
|
||||
archs: object::read::Result<&[impl FatArch]>,
|
||||
archs: &[impl FatArch],
|
||||
target_arch: object::Architecture,
|
||||
archive_path: &Path,
|
||||
archive_map_data: &[u8],
|
||||
) -> io::Result<Option<PathBuf>> {
|
||||
let archs = archs.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
||||
|
||||
let desired = match archs.iter().find(|a| a.architecture() == target_arch) {
|
||||
Some(a) => a,
|
||||
None => return Ok(None),
|
||||
@ -146,17 +144,15 @@ pub fn try_extract_macho_fat_archive(
|
||||
_ => return Ok(None),
|
||||
};
|
||||
|
||||
match object::macho::FatHeader::parse(&*archive_map) {
|
||||
Ok(h) if h.magic.get(object::endian::BigEndian) == object::macho::FAT_MAGIC => {
|
||||
let archs = object::macho::FatHeader::parse_arch32(&*archive_map);
|
||||
try_filter_fat_archs(archs, target_arch, archive_path, &*archive_map)
|
||||
}
|
||||
Ok(h) if h.magic.get(object::endian::BigEndian) == object::macho::FAT_MAGIC_64 => {
|
||||
let archs = object::macho::FatHeader::parse_arch64(&*archive_map);
|
||||
try_filter_fat_archs(archs, target_arch, archive_path, &*archive_map)
|
||||
}
|
||||
if let Ok(h) = object::read::macho::MachOFatFile32::parse(&*archive_map) {
|
||||
let archs = h.arches();
|
||||
try_filter_fat_archs(archs, target_arch, archive_path, &*archive_map)
|
||||
} else if let Ok(h) = object::read::macho::MachOFatFile64::parse(&*archive_map) {
|
||||
let archs = h.arches();
|
||||
try_filter_fat_archs(archs, target_arch, archive_path, &*archive_map)
|
||||
} else {
|
||||
// Not a FatHeader at all, just return None.
|
||||
_ => Ok(None),
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ fn link_dwarf_object(sess: &Session, cg_results: &CodegenResults, executable_out
|
||||
.truncate(true)
|
||||
.open(dwp_out_filename)?,
|
||||
);
|
||||
let mut output_stream = object::write::StreamingBuffer::new(output_stream);
|
||||
let mut output_stream = thorin::object::write::StreamingBuffer::new(output_stream);
|
||||
package.finish()?.emit(&mut output_stream)?;
|
||||
output_stream.result()?;
|
||||
output_stream.into_inner().flush()?;
|
||||
|
@ -656,7 +656,13 @@ pub fn create_metadata_file_for_wasm(sess: &Session, data: &[u8], section_name:
|
||||
imports.import(
|
||||
"env",
|
||||
"__linear_memory",
|
||||
wasm_encoder::MemoryType { minimum: 0, maximum: None, memory64: true, shared: false },
|
||||
wasm_encoder::MemoryType {
|
||||
minimum: 0,
|
||||
maximum: None,
|
||||
memory64: true,
|
||||
shared: false,
|
||||
page_size_log2: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user