Skip to content

Commit

Permalink
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Jan 14, 2023
2 parents c0b8735 + a529ba8 commit 44a500c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 25 deletions.
71 changes: 50 additions & 21 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -193,7 +204,7 @@ dependencies = [
"cfg-if",
"libc",
"miniz_oxide",
"object",
"object 0.29.0",
"rustc-demangle",
]

Expand Down Expand Up @@ -1774,9 +1785,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",
Expand Down Expand Up @@ -1887,12 +1898,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"
Expand Down Expand Up @@ -2129,12 +2149,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",
]
Expand Down Expand Up @@ -2740,13 +2760,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
dependencies = [
"compiler_builtins",
"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",
"hashbrown 0.13.1",
"indexmap",
"memchr",
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
]

[[package]]
Expand Down Expand Up @@ -3791,7 +3820,7 @@ dependencies = [
"cstr",
"libc",
"measureme",
"object",
"object 0.30.1",
"rustc-demangle",
"rustc_ast",
"rustc_attr",
Expand Down Expand Up @@ -3826,7 +3855,7 @@ dependencies = [
"itertools",
"jobserver",
"libc",
"object",
"object 0.30.1",
"pathdiff",
"regex",
"rustc_arena",
Expand Down Expand Up @@ -5296,11 +5325,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",
Expand Down Expand Up @@ -5549,13 +5578,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",
]

Expand Down Expand Up @@ -6090,9 +6119,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"
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -44,6 +44,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"]
8 changes: 7 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
};
let architecture = match &sess.target.arch[..] {
"arm" => 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,
Expand Down

0 comments on commit 44a500c

Please sign in to comment.