@@ -71,7 +71,10 @@ use super::{current_version, pack_u32_os_version};
7171// SAFETY: The signature is the same as what Clang expects, and we export weakly to allow linking
7272// both this and `libclang_rt.*.a`, similar to how `compiler-builtins` does it:
7373// https://github.com/rust-lang/compiler-builtins/blob/0.1.113/src/macros.rs#L494
74- #[ cfg_attr( not( feature = "compiler-builtins-mangled-names" ) , unsafe ( no_mangle) , linkage = "weak" ) ]
74+ //
75+ // NOTE: This symbol has a workaround in the compiler's symbol mangling to avoid mangling it, while
76+ // still not exposing it from non-cdylib (like `#[no_mangle]` would).
77+ #[ rustc_std_internal_symbol]
7578// extern "C" is correct, Clang assumes the function cannot unwind:
7679// https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/clang/lib/CodeGen/CGObjC.cpp#L3980
7780//
@@ -139,7 +142,7 @@ pub(super) extern "C" fn __isPlatformVersionAtLeast(
139142
140143/// Old entry point for availability. Used when compiling with older Clang versions.
141144// SAFETY: Same as for `__isPlatformVersionAtLeast`.
142- #[ cfg_attr ( not ( feature = "compiler-builtins-mangled-names" ) , unsafe ( no_mangle ) , linkage = "weak" ) ]
145+ #[ rustc_std_internal_symbol ]
143146pub ( super ) extern "C" fn __isOSVersionAtLeast ( major : u32 , minor : u32 , subminor : u32 ) -> i32 {
144147 let version = pack_u32_os_version ( major, minor, subminor) ;
145148 ( version <= current_version ( ) ) as i32
0 commit comments