From d370d2728bfbf5ea1fcc1437b32a48eb4f0d2855 Mon Sep 17 00:00:00 2001 From: Yuxiang Zhu Date: Wed, 12 Feb 2020 10:44:10 +0800 Subject: [PATCH] add mips/mips64 compiler-rt fallbacks so that libgcc is not required This adds compiler-rt fallbacks for mips and mips64 arches. Solves linking issues like https://github.com/rust-lang/rust/issues/57820. Signed-off-by: Yuxiang Zhu --- .../.github/workflows/main.yml | 4 ++-- library/compiler-builtins/build.rs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/library/compiler-builtins/.github/workflows/main.yml b/library/compiler-builtins/.github/workflows/main.yml index 469154997648..750f288cf40e 100644 --- a/library/compiler-builtins/.github/workflows/main.yml +++ b/library/compiler-builtins/.github/workflows/main.yml @@ -111,8 +111,8 @@ jobs: - run: rustup target add ${{ matrix.target }} - name: Download compiler-rt reference sources run: | - curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/8.0-2019-03-18.tar.gz - tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-8.0-2019-03-18/compiler-rt + curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/10.0-2020-02-05.tar.gz + tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-10.0-2020-02-05/compiler-rt echo "##[set-env name=RUST_COMPILER_RT_ROOT]./compiler-rt" shell: bash diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index b520b62477ed..b3c65d5b9c6b 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -396,6 +396,25 @@ mod c { } } + if target_arch == "mips" { + sources.extend(&[("__bswapsi2", "bswapsi2.c")]); + } + + if target_arch == "mips64" { + sources.extend(&[ + ("__extenddftf2", "extenddftf2.c"), + ("__netf2", "comparetf2.c"), + ("__addtf3", "addtf3.c"), + ("__multf3", "multf3.c"), + ("__subtf3", "subtf3.c"), + ("__fixtfsi", "fixtfsi.c"), + ("__floatsitf", "floatsitf.c"), + ("__fixunstfsi", "fixunstfsi.c"), + ("__floatunsitf", "floatunsitf.c"), + ("__fe_getround", "fp_mode.c"), + ]); + } + // Remove the assembly implementations that won't compile for the target if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" { let mut to_remove = Vec::new();