Skip to content

Commit aaca9e1

Browse files
committed
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 rust-lang/rust#57820. Signed-off-by: Yuxiang Zhu <[email protected]>
1 parent 3e6327a commit aaca9e1

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ jobs:
111111
- run: rustup target add ${{ matrix.target }}
112112
- name: Download compiler-rt reference sources
113113
run: |
114-
curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/8.0-2019-03-18.tar.gz
115-
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-8.0-2019-03-18/compiler-rt
114+
curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/10.0-2020-02-05.zip
115+
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-10.0-2020-02-05/compiler-rt
116116
echo "##[set-env name=RUST_COMPILER_RT_ROOT]./compiler-rt"
117117
shell: bash
118118

build.rs

+19
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,25 @@ mod c {
396396
}
397397
}
398398

399+
if target_arch == "mips" {
400+
sources.extend(&[("__bswapsi2", "bswapsi2.c")]);
401+
}
402+
403+
if target_arch == "mips64" {
404+
sources.extend(&[
405+
("__extenddftf2", "extenddftf2.c"),
406+
("__netf2", "comparetf2.c"),
407+
("__addtf3", "addtf3.c"),
408+
("__multf3", "multf3.c"),
409+
("__subtf3", "subtf3.c"),
410+
("__fixtfsi", "fixtfsi.c"),
411+
("__floatsitf", "floatsitf.c"),
412+
("__fixunstfsi", "fixunstfsi.c"),
413+
("__floatunsitf", "floatunsitf.c"),
414+
("__fe_getround", "fp_mode.c"),
415+
]);
416+
}
417+
399418
// Remove the assembly implementations that won't compile for the target
400419
if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" {
401420
let mut to_remove = Vec::new();

0 commit comments

Comments
 (0)