From b8ef969d927e9f85746d1ec3092c3c0b69482c1a Mon Sep 17 00:00:00 2001 From: Derek Hageman Date: Sun, 20 Feb 2022 10:26:58 -0700 Subject: [PATCH] Generate intrinsic aliases directly Using the full module structure generated by the intrinsics macro interacts oddly with inlining on some optimization levels, causing a duplicate identical function body to be generated. This doesn't affect performance, but it wastes space, so just declare the alias directly which seems to cause the symbol to be aliased as it should be. --- rp2040-hal/src/intrinsics.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rp2040-hal/src/intrinsics.rs b/rp2040-hal/src/intrinsics.rs index dbb67a9..5b13247 100644 --- a/rp2040-hal/src/intrinsics.rs +++ b/rp2040-hal/src/intrinsics.rs @@ -13,9 +13,10 @@ macro_rules! intrinsics_aliases { $($rest:ident)* ) => { #[cfg(all(target_arch = "arm", not(feature = "disable-intrinsics")))] - intrinsics! { - extern $abi fn $alias( $($argname: $ty),* ) -> $ret { - $name($($argname),*) + mod $alias { + #[no_mangle] + pub extern $abi fn $alias( $($argname: $ty),* ) -> $ret { + super::$name($($argname),*) } } @@ -31,9 +32,10 @@ macro_rules! intrinsics_aliases { $($rest:ident)* ) => { #[cfg(all(target_arch = "arm", not(feature = "disable-intrinsics")))] - intrinsics! { + mod $alias { + #[no_mangle] unsafe extern $abi fn $alias( $($argname: $ty),* ) -> $ret { - $name($($argname),*) + super::$name($($argname),*) } }