diff options
| author | Mads Marquart <mads@marquart.dk> | 2025-09-08 20:10:08 +0200 |
|---|---|---|
| committer | Mads Marquart <mads@marquart.dk> | 2025-09-08 20:10:43 +0200 |
| commit | fe6f8cc6f5eef1e0dc5e51ca621b32208af0da3c (patch) | |
| tree | 2d0092fed9e84b5b862cbb1c87a963563ae257c9 /library | |
| parent | d51f0ea172290f2e99e98a061c326af12edfbd3c (diff) | |
| download | rust-fe6f8cc6f5eef1e0dc5e51ca621b32208af0da3c.tar.gz rust-fe6f8cc6f5eef1e0dc5e51ca621b32208af0da3c.zip | |
Weakly export platform_version symbols
The symbols __isPlatformVersionAtLeast and __isOSVersionAtLeast. This allows the user to link both compiler_rt and std.
Diffstat (limited to 'library')
| -rw-r--r-- | library/std/src/sys/platform_version/darwin/public_extern.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/std/src/sys/platform_version/darwin/public_extern.rs b/library/std/src/sys/platform_version/darwin/public_extern.rs index 967cdb4920f..c0848d94798 100644 --- a/library/std/src/sys/platform_version/darwin/public_extern.rs +++ b/library/std/src/sys/platform_version/darwin/public_extern.rs @@ -77,6 +77,10 @@ use super::{current_version, pack_i32_os_version}; // NOTE: This symbol has a workaround in the compiler's symbol mangling to avoid mangling it, while // still not exposing it from non-cdylib (like `#[no_mangle]` would). #[rustc_std_internal_symbol] +// NOTE: Making this a weak symbol might not be entirely the right solution for this, `compiler_rt` +// doesn't do that, it instead makes the symbol have "hidden" visibility. But since this is placed +// in `libstd`, which might be used as a dylib, we cannot do the same here. +#[linkage = "weak"] // extern "C" is correct, Clang assumes the function cannot unwind: // https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/clang/lib/CodeGen/CGObjC.cpp#L3980 // @@ -145,6 +149,7 @@ pub(super) extern "C" fn __isPlatformVersionAtLeast( /// Old entry point for availability. Used when compiling with older Clang versions. // SAFETY: Same as for `__isPlatformVersionAtLeast`. #[rustc_std_internal_symbol] +#[linkage = "weak"] pub(super) extern "C" fn __isOSVersionAtLeast(major: i32, minor: i32, subminor: i32) -> i32 { let version = pack_i32_os_version(major, minor, subminor); (version <= current_version()) as i32 |
