summarylogtreecommitdiffstats
path: root/0008-compiler-Swap-primary-and-secondary-lib-dirs.patch
blob: 068e267c59e23a12dc111d637b06684549732651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Thu, 7 Aug 2025 20:12:53 +0200
Subject: [PATCH] compiler: Swap primary and secondary lib dirs

Arch Linux prefers "lib" over "lib64".
---
 compiler/rustc_target/src/lib.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs
index dfa1b2320718..fe7d266dea7f 100644
--- a/compiler/rustc_target/src/lib.rs
+++ b/compiler/rustc_target/src/lib.rs
@@ -50,20 +50,22 @@ fn find_relative_libdir(sysroot: &Path) -> std::borrow::Cow<'static, str> {
     // If --libdir is set during configuration to the value other than
     // "lib" (i.e., non-default), this value is used (see issue #16552).
 
+    const PRIMARY_LIB_DIR: &str = "lib";
+
     #[cfg(target_pointer_width = "64")]
-    const PRIMARY_LIB_DIR: &str = "lib64";
+    const SECONDARY_LIB_DIR: &str = "lib64";
 
     #[cfg(target_pointer_width = "32")]
-    const PRIMARY_LIB_DIR: &str = "lib32";
-
-    const SECONDARY_LIB_DIR: &str = "lib";
+    const SECONDARY_LIB_DIR: &str = "lib32";
 
     match option_env!("CFG_LIBDIR_RELATIVE") {
         None | Some("lib") => {
             if sysroot.join(PRIMARY_LIB_DIR).join(RUST_LIB_DIR).exists() {
                 PRIMARY_LIB_DIR.into()
-            } else {
+            } else if sysroot.join(SECONDARY_LIB_DIR).join(RUST_LIB_DIR).exists() {
                 SECONDARY_LIB_DIR.into()
+            } else {
+                PRIMARY_LIB_DIR.into()
             }
         }
         Some(libdir) => libdir.into(),