Skip to content

Commit 6651d11

Browse files
committed
Fix weak linkage on windows and apple platforms
There were some issues regarding windows and apple platform, we were exporting symbols that are already provided by the compiler but weren't marked as `weak` which resulted in conflicted symbols in the linking process. Initially, we didn't add `weak` because we thought it is not supported on windows and apple platforms, but it looks like its only not supported on windows-gnu platforms Signed-off-by: Amjad Alsharafi <[email protected]>
1 parent d96d3a7 commit 6651d11

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/macros.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ macro_rules! intrinsics {
256256
#[cfg(all(any(windows, target_os = "uefi"), target_arch = "x86_64", not(feature = "mangled-names")))]
257257
mod $name {
258258
#[no_mangle]
259-
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
259+
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
260260
extern $abi fn $name( $($argname: $ty),* )
261261
-> $crate::macros::win64_128bit_abi_hack::U64x2
262262
{
@@ -298,7 +298,7 @@ macro_rules! intrinsics {
298298
#[cfg(all(target_arch = "arm", not(feature = "mangled-names")))]
299299
mod $name {
300300
#[no_mangle]
301-
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
301+
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
302302
$(#[$($attr)*])*
303303
extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
304304
super::$name($($argname),*)
@@ -308,7 +308,7 @@ macro_rules! intrinsics {
308308
#[cfg(all(target_arch = "arm", not(feature = "mangled-names")))]
309309
mod $alias {
310310
#[no_mangle]
311-
#[cfg_attr(all(not(windows), not(target_vendor="apple")), linkage = "weak")]
311+
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
312312
$(#[$($attr)*])*
313313
extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? {
314314
super::$name($($argname),*)
@@ -375,7 +375,7 @@ macro_rules! intrinsics {
375375
mod $name {
376376
$(#[$($attr)*])*
377377
#[no_mangle]
378-
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
378+
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
379379
unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
380380
super::$name($($argname),*)
381381
}
@@ -400,7 +400,7 @@ macro_rules! intrinsics {
400400
#[naked]
401401
$(#[$($attr)*])*
402402
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
403-
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
403+
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
404404
pub unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
405405
$($body)*
406406
}
@@ -467,7 +467,7 @@ macro_rules! intrinsics {
467467
mod $name {
468468
$(#[$($attr)*])*
469469
#[no_mangle]
470-
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
470+
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
471471
$(unsafe $($empty)?)? extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
472472
super::$name($($argname),*)
473473
}

0 commit comments

Comments
 (0)