From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 4 Jan 2025 06:52:13 +0100
Subject: [PATCH] compiler: Use aarch64-linux-gnu-gcc to link aarch64 targets

Otherwise it defaults to 'cc', which is inappropriate as we're
cross-compiling.
---
 .../rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs   | 1 +
 .../rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
index 4220d74dfc89..f1aca6f68a17 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
@@ -32,6 +32,7 @@ pub(crate) fn target() -> Target {
                 | SanitizerSet::THREAD
                 | SanitizerSet::HWADDRESS,
             supports_xray: true,
+            linker: Some("aarch64-linux-gnu-gcc".into()),
             ..base::linux_gnu::opts()
         },
     }
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
index 478726fbef69..e97bd41abc35 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
@@ -13,6 +13,7 @@ pub(crate) fn target() -> Target {
         | SanitizerSet::LEAK
         | SanitizerSet::MEMORY
         | SanitizerSet::THREAD;
+    base.linker = Some("aarch64-linux-gnu-gcc".into());
 
     // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
     base.crt_static_default = true;
