about summary refs log tree commit diff
path: root/compiler/rustc_symbol_mangling
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2025-03-25 16:12:56 +0100
committerMads Marquart <mads@marquart.dk>2025-09-05 16:18:49 +0200
commit846d6a4466813f3ad12e2bf15db4071f22b8ae0b (patch)
treef06e74b18ebd1d63a72f14b563c261189db97ac8 /compiler/rustc_symbol_mangling
parent523d3999dcd4bbd9a52661a29dbd7351a9c5fb03 (diff)
downloadrust-846d6a4466813f3ad12e2bf15db4071f22b8ae0b.tar.gz
rust-846d6a4466813f3ad12e2bf15db4071f22b8ae0b.zip
Add __isOSVersionAtLeast and __isPlatformVersionAtLeast symbols
Allows users to link to Objective-C code using `@available(...)`.
Diffstat (limited to 'compiler/rustc_symbol_mangling')
-rw-r--r--compiler/rustc_symbol_mangling/src/v0.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index 0cbd48ba08c..0655c2d5e81 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -82,9 +82,13 @@ pub(super) fn mangle<'tcx>(
 }
 
 pub fn mangle_internal_symbol<'tcx>(tcx: TyCtxt<'tcx>, item_name: &str) -> String {
-    if item_name == "rust_eh_personality" {
+    match item_name {
         // rust_eh_personality must not be renamed as LLVM hard-codes the name
-        return "rust_eh_personality".to_owned();
+        "rust_eh_personality" => return item_name.to_owned(),
+        // Apple availability symbols need to not be mangled to be usable by
+        // C/Objective-C code.
+        "__isPlatformVersionAtLeast" | "__isOSVersionAtLeast" => return item_name.to_owned(),
+        _ => {}
     }
 
     let prefix = "_R";