about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2024-02-22 03:06:25 +0100
committerMads Marquart <mads@marquart.dk>2024-04-10 16:54:49 +0200
commite27290e529315012c4f69f22893fab4ff2e665c5 (patch)
tree52669ee23590df7b5dbad5094c40448e972b2383 /compiler/rustc_codegen_ssa/src
parentb14d8b2ef20c64c1002e2c6c724025c3d0846b91 (diff)
downloadrust-e27290e529315012c4f69f22893fab4ff2e665c5.tar.gz
rust-e27290e529315012c4f69f22893fab4ff2e665c5.zip
Add `/System/iOSSupport` to the library search path on Mac Catalyst
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index ac278de02af..38960a4734c 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -2997,6 +2997,16 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
         }
         _ => unreachable!(),
     }
+
+    if llvm_target.contains("macabi") {
+        // Mac Catalyst uses the macOS SDK, but to link to iOS-specific
+        // frameworks, we must have the support library stubs in the library
+        // search path.
+
+        // The flags are called `-L` and `-F` both in Clang, ld64 and ldd.
+        cmd.arg(format!("-L{sdk_root}/System/iOSSupport/usr/lib"));
+        cmd.arg(format!("-F{sdk_root}/System/iOSSupport/System/Library/Frameworks"));
+    }
 }
 
 fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootError<'_>> {