From a529ba8f67861c21a6f4d1c497aa1f602b335ecb Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Mon, 9 Jan 2023 17:49:24 +0000 Subject: [PATCH] Fix aarch64-unknown-linux-gnu_ilp32 target This was broken because the synthetic object files produced by rustc were for 64-bit AArch64, which caused link failures when combined with 32-bit ILP32 object files. This PR updates the object crate to 0.30.1 which adds support for generating ILP32 AArch64 object files. --- Cargo.lock | 73 +++++++++++++------ compiler/rustc_codegen_llvm/Cargo.toml | 5 +- compiler/rustc_codegen_ssa/Cargo.toml | 4 +- .../rustc_codegen_ssa/src/back/metadata.rs | 8 +- 4 files changed, 64 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 117295014e6..4f28a0cb358 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,6 +35,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -107,7 +118,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "276881980556fdadeb88aa1ffc667e4d2e8fe72531dfabcb7a82bb3c9ea9ba31" dependencies = [ - "object", + "object 0.29.0", ] [[package]] @@ -193,7 +204,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.29.0", "rustc-demangle", ] @@ -1650,9 +1661,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "compiler_builtins", "fallible-iterator", @@ -1752,12 +1763,21 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.4", "compiler_builtins", "rustc-std-workspace-alloc", "rustc-std-workspace-core", ] +[[package]] +name = "hashbrown" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +dependencies = [ + "ahash 0.8.2", +] + [[package]] name = "heck" version = "0.4.0" @@ -1976,12 +1996,12 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "rustc-rayon", "serde", ] @@ -2578,15 +2598,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "compiler_builtins", - "crc32fast", - "flate2", - "hashbrown", - "indexmap", "memchr", "rustc-std-workspace-alloc", "rustc-std-workspace-core", ] +[[package]] +name = "object" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d864c91689fdc196779b98dba0aceac6118594c2df6ee5d943eb6a8df4d107a" +dependencies = [ + "crc32fast", + "flate2", + "hashbrown 0.13.1", + "indexmap", + "memchr", +] + [[package]] name = "odht" version = "0.3.1" @@ -3596,7 +3625,7 @@ dependencies = [ "cstr", "libc", "measureme", - "object", + "object 0.30.1", "rustc-demangle", "rustc_ast", "rustc_attr", @@ -3631,7 +3660,7 @@ dependencies = [ "itertools", "jobserver", "libc", - "object", + "object 0.30.1", "pathdiff", "regex", "rustc_arena", @@ -5062,11 +5091,11 @@ dependencies = [ "core", "dlmalloc", "fortanix-sgx-abi", - "hashbrown", + "hashbrown 0.12.3", "hermit-abi 0.2.6", "libc", "miniz_oxide", - "object", + "object 0.29.0", "panic_abort", "panic_unwind", "profiler_builtins", @@ -5298,13 +5327,13 @@ dependencies = [ [[package]] name = "thorin-dwp" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6cb0c7868d7f90407531108ab03263d9452a8811b7cdd87675343a40d4aa254" +checksum = "da8fbf660a019b6bf11ea95762041464aa9099cc293b6a66d77cea5107619671" dependencies = [ "gimli", - "hashbrown", - "object", + "hashbrown 0.12.3", + "object 0.30.1", "tracing", ] @@ -5813,9 +5842,9 @@ checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vte" diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 93d6234dc88..9c1bcd431ec 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -11,7 +11,10 @@ bitflags = "1.0" cstr = "0.2" libc = "0.2" measureme = "10.0.0" -object = { version = "0.29.0", default-features = false, features = ["std", "read"] } +object = { version = "0.30.1", default-features = false, features = [ + "std", + "read", +] } tracing = "0.1" rustc_middle = { path = "../rustc_middle" } rustc-demangle = "0.1.21" diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 345174fb595..7ada9c0e12a 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -15,7 +15,7 @@ tracing = "0.1" libc = "0.2.50" jobserver = "0.1.22" tempfile = "3.2" -thorin-dwp = "0.3" +thorin-dwp = "0.4" pathdiff = "0.2.0" serde_json = "1.0.59" snap = "1" @@ -43,6 +43,6 @@ rustc_session = { path = "../rustc_session" } rustc_const_eval = { path = "../rustc_const_eval" } [dependencies.object] -version = "0.29.0" +version = "0.30.1" default-features = false features = ["read_core", "elf", "macho", "pe", "unaligned", "archive", "write"] diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index 51c5c375d51..237b8849a35 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -100,7 +100,13 @@ pub(crate) fn create_object_file(sess: &Session) -> Option Architecture::Arm, - "aarch64" => Architecture::Aarch64, + "aarch64" => { + if sess.target.pointer_width == 32 { + Architecture::Aarch64_Ilp32 + } else { + Architecture::Aarch64 + } + } "x86" => Architecture::I386, "s390x" => Architecture::S390x, "mips" => Architecture::Mips,