From 4935383ebbe71dc879d822a515a5b71ab286dd47 Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 21 Jul 2024 13:56:16 +0300 Subject: [PATCH 1/4] adopt object changes --- .../rustc_codegen_ssa/src/back/archive.rs | 22 +++++++++++-------- compiler/rustc_codegen_ssa/src/back/link.rs | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/archive.rs b/compiler/rustc_codegen_ssa/src/back/archive.rs index ae649cd77c420..57d0cf5e12445 100644 --- a/compiler/rustc_codegen_ssa/src/back/archive.rs +++ b/compiler/rustc_codegen_ssa/src/back/archive.rs @@ -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> { - 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,23 @@ 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); + if let Ok(h) = object::read::macho::MachOFatFile32::parse(&*archive_map) { + if h.header().magic.get(object::endian::BigEndian) == object::macho::FAT_MAGIC { + let archs = h.arches(); try_filter_fat_archs(archs, target_arch, archive_path, &*archive_map) + } else { + Ok(None) } - Ok(h) if h.magic.get(object::endian::BigEndian) == object::macho::FAT_MAGIC_64 => { - let archs = object::macho::FatHeader::parse_arch64(&*archive_map); + } else if let Ok(h) = object::read::macho::MachOFatFile64::parse(&*archive_map) { + if h.header().magic.get(object::endian::BigEndian) == object::macho::FAT_MAGIC_64 { + let archs = h.arches(); try_filter_fat_archs(archs, target_arch, archive_path, &*archive_map) + } else { + Ok(None) } + } else { // Not a FatHeader at all, just return None. - _ => Ok(None), + Ok(None) } } diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 8e07d128dbd64..73c516ee70b6c 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -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()?; From 892f7a07dc1cb35beaf0213e22604dcaf8fdbda9 Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 21 Jul 2024 21:57:24 +0300 Subject: [PATCH 2/4] try bump object to 0.33 --- Cargo.lock | 31 ++++++++++++++++++++++---- compiler/rustc_codegen_llvm/Cargo.toml | 2 +- compiler/rustc_codegen_ssa/Cargo.toml | 2 +- compiler/rustc_target/Cargo.toml | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d3bc59dddb21..1324e68884f15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2641,7 +2641,19 @@ dependencies = [ "indexmap", "memchr", "ruzstd 0.5.0", - "wasmparser 0.118.2", +] + +[[package]] +name = "object" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" +dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", + "memchr", + "wasmparser 0.201.0", ] [[package]] @@ -3769,7 +3781,7 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.32.2", + "object 0.33.0", "rustc-demangle", "rustc_ast", "rustc_attr", @@ -3808,7 +3820,7 @@ dependencies = [ "itertools", "jobserver", "libc", - "object 0.32.2", + "object 0.33.0", "pathdiff", "regex", "rustc_arena", @@ -4791,7 +4803,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags 2.5.0", - "object 0.32.2", + "object 0.33.0", "rustc_abi", "rustc_data_structures", "rustc_feature", @@ -6414,6 +6426,17 @@ dependencies = [ "semver", ] +[[package]] +name = "wasmparser" +version = "0.201.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84e5df6dba6c0d7fafc63a450f1738451ed7a0b52295d83e868218fa286bf708" +dependencies = [ + "bitflags 2.5.0", + "indexmap", + "semver", +] + [[package]] name = "wasmparser" version = "0.210.0" diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index bb5045ec87241..f8a63aaf55e79 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -12,7 +12,7 @@ bitflags = "2.4.1" itertools = "0.12" libc = "0.2" measureme = "11" -object = { version = "0.32.0", default-features = false, features = ["std", "read"] } +object = { version = "0.33.0", default-features = false, features = ["std", "read"] } rustc-demangle = "0.1.21" rustc_ast = { path = "../rustc_ast" } rustc_attr = { path = "../rustc_attr" } diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index f7b5b0f310b67..7543bb7e8c7db 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -50,7 +50,7 @@ libc = "0.2.50" # tidy-alphabetical-end [dependencies.object] -version = "0.32.1" +version = "0.33.0" default-features = false features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"] diff --git a/compiler/rustc_target/Cargo.toml b/compiler/rustc_target/Cargo.toml index 2cb8ac7e8bfb3..9787afb71cb07 100644 --- a/compiler/rustc_target/Cargo.toml +++ b/compiler/rustc_target/Cargo.toml @@ -22,5 +22,5 @@ tracing = "0.1" # tidy-alphabetical-start default-features = false features = ["elf", "macho"] -version = "0.32.0" +version = "0.33.0" # tidy-alphabetical-end From 5183cf5e3234ef2f5968ca1a0da9fac042eeabf7 Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 21 Jul 2024 22:49:23 +0300 Subject: [PATCH 3/4] to 0.34 --- Cargo.lock | 23 +++++++---------------- compiler/rustc_codegen_llvm/Cargo.toml | 2 +- compiler/rustc_codegen_ssa/Cargo.toml | 2 +- compiler/rustc_target/Cargo.toml | 2 +- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1324e68884f15..178d0a9737e62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2643,28 +2643,19 @@ dependencies = [ "ruzstd 0.5.0", ] -[[package]] -name = "object" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" -dependencies = [ - "crc32fast", - "hashbrown", - "indexmap", - "memchr", - "wasmparser 0.201.0", -] - [[package]] name = "object" version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7090bae93f8585aad99e595b7073c5de9ba89fbd6b4e9f0cdd7a10177273ac8" dependencies = [ + "crc32fast", "flate2", + "hashbrown", + "indexmap", "memchr", "ruzstd 0.6.0", + "wasmparser 0.201.0", ] [[package]] @@ -3781,7 +3772,7 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.33.0", + "object 0.34.0", "rustc-demangle", "rustc_ast", "rustc_attr", @@ -3820,7 +3811,7 @@ dependencies = [ "itertools", "jobserver", "libc", - "object 0.33.0", + "object 0.34.0", "pathdiff", "regex", "rustc_arena", @@ -4803,7 +4794,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags 2.5.0", - "object 0.33.0", + "object 0.34.0", "rustc_abi", "rustc_data_structures", "rustc_feature", diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index f8a63aaf55e79..0a0af663336c9 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -12,7 +12,7 @@ bitflags = "2.4.1" itertools = "0.12" libc = "0.2" measureme = "11" -object = { version = "0.33.0", default-features = false, features = ["std", "read"] } +object = { version = "0.34.0", default-features = false, features = ["std", "read"] } rustc-demangle = "0.1.21" rustc_ast = { path = "../rustc_ast" } rustc_attr = { path = "../rustc_attr" } diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 7543bb7e8c7db..b83b66cf6b37d 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -50,7 +50,7 @@ libc = "0.2.50" # tidy-alphabetical-end [dependencies.object] -version = "0.33.0" +version = "0.34.0" default-features = false features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"] diff --git a/compiler/rustc_target/Cargo.toml b/compiler/rustc_target/Cargo.toml index 9787afb71cb07..8e9e60c6f777a 100644 --- a/compiler/rustc_target/Cargo.toml +++ b/compiler/rustc_target/Cargo.toml @@ -22,5 +22,5 @@ tracing = "0.1" # tidy-alphabetical-start default-features = false features = ["elf", "macho"] -version = "0.33.0" +version = "0.34.0" # tidy-alphabetical-end From 9738deed6ed38a0f277bea64348bf61ac925e6ff Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 21 Jul 2024 23:41:03 +0300 Subject: [PATCH 4/4] to 0.35 --- Cargo.lock | 18 +++++++++--------- compiler/rustc_codegen_llvm/Cargo.toml | 2 +- compiler/rustc_codegen_ssa/Cargo.toml | 2 +- compiler/rustc_target/Cargo.toml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 178d0a9737e62..429a65e7b26b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2649,13 +2649,9 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7090bae93f8585aad99e595b7073c5de9ba89fbd6b4e9f0cdd7a10177273ac8" dependencies = [ - "crc32fast", "flate2", - "hashbrown", - "indexmap", "memchr", "ruzstd 0.6.0", - "wasmparser 0.201.0", ] [[package]] @@ -2664,7 +2660,11 @@ version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", "memchr", + "wasmparser 0.202.0", ] [[package]] @@ -3772,7 +3772,7 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.34.0", + "object 0.35.0", "rustc-demangle", "rustc_ast", "rustc_attr", @@ -3811,7 +3811,7 @@ dependencies = [ "itertools", "jobserver", "libc", - "object 0.34.0", + "object 0.35.0", "pathdiff", "regex", "rustc_arena", @@ -4794,7 +4794,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags 2.5.0", - "object 0.34.0", + "object 0.35.0", "rustc_abi", "rustc_data_structures", "rustc_feature", @@ -6419,9 +6419,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.201.0" +version = "0.202.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84e5df6dba6c0d7fafc63a450f1738451ed7a0b52295d83e868218fa286bf708" +checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413" dependencies = [ "bitflags 2.5.0", "indexmap", diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 0a0af663336c9..ed6bc8f519a0c 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -12,7 +12,7 @@ bitflags = "2.4.1" itertools = "0.12" libc = "0.2" measureme = "11" -object = { version = "0.34.0", default-features = false, features = ["std", "read"] } +object = { version = "0.35.0", default-features = false, features = ["std", "read"] } rustc-demangle = "0.1.21" rustc_ast = { path = "../rustc_ast" } rustc_attr = { path = "../rustc_attr" } diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index b83b66cf6b37d..70f3b94e88ff8 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -50,7 +50,7 @@ libc = "0.2.50" # tidy-alphabetical-end [dependencies.object] -version = "0.34.0" +version = "0.35.0" default-features = false features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"] diff --git a/compiler/rustc_target/Cargo.toml b/compiler/rustc_target/Cargo.toml index 8e9e60c6f777a..75f521497fa0d 100644 --- a/compiler/rustc_target/Cargo.toml +++ b/compiler/rustc_target/Cargo.toml @@ -22,5 +22,5 @@ tracing = "0.1" # tidy-alphabetical-start default-features = false features = ["elf", "macho"] -version = "0.34.0" +version = "0.35.0" # tidy-alphabetical-end