From 752e35a11f2e7eb29df84668bef0945e75cf3eb5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 May 2019 13:35:50 -0700 Subject: [PATCH 1/2] Fix duplicate symbol __clzsi2 Looks like our tests weren't quite testing compiler-builtins when it was compiled with unmangled symbols, so update the tests to catch this and then fix the compilation of the `__clzsi2` intrinsic to use the C version if it's compiled. --- ci/run.sh | 9 +++++++++ src/int/mod.rs | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ci/run.sh b/ci/run.sh index 589553a..27e2de2 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -42,6 +42,10 @@ else $run --release $run --features c $run --features c --release + cargo build --target $1 + cargo build --target $1 --release + cargo build --target $1 --features c + cargo build --target $1 --release --features c fi PREFIX=$(echo $1 | sed -e 's/unknown-//')- @@ -68,6 +72,10 @@ fi # Look out for duplicated symbols when we include the compiler-rt (C) implementation for rlib in $(echo $path); do set +x + echo "================================================================" + echo checking $rlib for duplicate symbols + echo "================================================================" + stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1) # NOTE On i586, It's normal that the get_pc_thunk symbol appears several @@ -86,6 +94,7 @@ for rlib in $(echo $path); do if test $? = 0; then exit 1 fi + set -ex done diff --git a/src/int/mod.rs b/src/int/mod.rs index 52a4227..07f72f8 100644 --- a/src/int/mod.rs +++ b/src/int/mod.rs @@ -302,6 +302,7 @@ impl_wide_int!(u32, u64, 32); impl_wide_int!(u64, u128, 64); intrinsics! { + #[use_c_shim_if(/* always if C compilation is enabled */)] #[cfg(any( target_pointer_width = "16", target_pointer_width = "32", @@ -310,7 +311,7 @@ intrinsics! { pub extern "C" fn __clzsi2(x: usize) -> usize { // TODO: const this? Would require const-if // Note(Lokathor): the `intrinsics!` macro can't process mut inputs - let mut x = x; + let mut x = x; let mut y: usize; let mut n: usize = { #[cfg(target_pointer_width = "64")] From 80a998df921f572891107a51f47226e7b6858269 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 May 2019 14:22:19 -0700 Subject: [PATCH 2/2] Fix duplicate floatdisf symbol on Windows MSVC --- src/float/conv.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/float/conv.rs b/src/float/conv.rs index 3171e45..8d3e5fc 100644 --- a/src/float/conv.rs +++ b/src/float/conv.rs @@ -83,6 +83,7 @@ intrinsics! { #[use_c_shim_if(any( all(target_arch = "x86", not(target_env = "msvc")), all(target_arch = "x86_64", not(windows)), + all(target_arch = "x86_64", target_env = "msvc"), ))] #[arm_aeabi_alias = __aeabi_l2f] pub extern "C" fn __floatdisf(i: i64) -> f32 {